@unbrained/pm-cli 2026.7.16 → 2026.7.18

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 (620) hide show
  1. package/.claude-plugin/marketplace.json +2 -2
  2. package/CHANGELOG.md +30 -2
  3. package/CONTRIBUTING.md +2 -2
  4. package/dist/cli/bootstrap-args.d.ts +2 -115
  5. package/dist/cli/bootstrap-args.js +4 -831
  6. package/dist/cli/bootstrap-args.js.map +1 -1
  7. package/dist/cli/commands/close.d.ts +1 -1
  8. package/dist/cli/commands/close.js +3 -3
  9. package/dist/cli/commands/close.js.map +1 -1
  10. package/dist/cli/commands/completion.js +47 -5
  11. package/dist/cli/commands/completion.js.map +1 -1
  12. package/dist/cli/commands/context.d.ts +2 -2
  13. package/dist/cli/commands/context.js +42 -28
  14. package/dist/cli/commands/context.js.map +1 -1
  15. package/dist/cli/commands/contracts.js +5 -3
  16. package/dist/cli/commands/contracts.js.map +1 -1
  17. package/dist/cli/commands/eval.d.ts +4 -64
  18. package/dist/cli/commands/eval.js +4 -153
  19. package/dist/cli/commands/eval.js.map +1 -1
  20. package/dist/cli/commands/graph.d.ts +7 -0
  21. package/dist/cli/commands/graph.js +11 -0
  22. package/dist/cli/commands/graph.js.map +1 -0
  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-test-entry.d.ts +6 -6
  27. package/dist/cli/commands/linked-test-entry.js +4 -65
  28. package/dist/cli/commands/linked-test-entry.js.map +1 -1
  29. package/dist/cli/commands/linked-test-parsers.d.ts +3 -45
  30. package/dist/cli/commands/linked-test-parsers.js +4 -516
  31. package/dist/cli/commands/linked-test-parsers.js.map +1 -1
  32. package/dist/cli/commands/list.d.ts +3 -210
  33. package/dist/cli/commands/list.js +4 -1068
  34. package/dist/cli/commands/list.js.map +1 -1
  35. package/dist/cli/commands/next.d.ts +1 -1
  36. package/dist/cli/commands/next.js +3 -3
  37. package/dist/cli/commands/next.js.map +1 -1
  38. package/dist/cli/commands/search.d.ts +3 -464
  39. package/dist/cli/commands/search.js +4 -2236
  40. package/dist/cli/commands/search.js.map +1 -1
  41. package/dist/cli/commands/stats.d.ts +6 -66
  42. package/dist/cli/commands/stats.js +4 -157
  43. package/dist/cli/commands/stats.js.map +1 -1
  44. package/dist/cli/commands/telemetry.d.ts +6 -14
  45. package/dist/cli/commands/telemetry.js +4 -349
  46. package/dist/cli/commands/telemetry.js.map +1 -1
  47. package/dist/cli/commands/test-all.d.ts +6 -95
  48. package/dist/cli/commands/test-all.js +4 -439
  49. package/dist/cli/commands/test-all.js.map +1 -1
  50. package/dist/cli/commands/test-runs.d.ts +6 -92
  51. package/dist/cli/commands/test-runs.js +4 -189
  52. package/dist/cli/commands/test-runs.js.map +1 -1
  53. package/dist/cli/commands/test.d.ts +6 -244
  54. package/dist/cli/commands/test.js +4 -1780
  55. package/dist/cli/commands/test.js.map +1 -1
  56. package/dist/cli/commands/update-many.d.ts +15 -29
  57. package/dist/cli/commands/update-many.js +355 -259
  58. package/dist/cli/commands/update-many.js.map +1 -1
  59. package/dist/cli/main.js +141 -133
  60. package/dist/cli/main.js.map +1 -1
  61. package/dist/cli/register-list-query.js +49 -7
  62. package/dist/cli/register-list-query.js.map +1 -1
  63. package/dist/cli/register-mutation.js +7 -3
  64. package/dist/cli/register-mutation.js.map +1 -1
  65. package/dist/cli/search-refresh.js +4 -9
  66. package/dist/cli/search-refresh.js.map +1 -1
  67. package/dist/cli/shared-parsers.d.ts +6 -9
  68. package/dist/cli/shared-parsers.js +4 -37
  69. package/dist/cli/shared-parsers.js.map +1 -1
  70. package/dist/cli/telemetry-flush.js +4 -4
  71. package/dist/cli/telemetry-flush.js.map +1 -1
  72. package/dist/cli-bundle/bundle-manifest.json +334 -326
  73. package/dist/cli-bundle/chunks/{append-OJQFUQ4T.js → append-5YF3TO7I.js} +5 -5
  74. package/dist/cli-bundle/chunks/append-JHO5K6RP.js +11 -0
  75. package/dist/cli-bundle/chunks/{chunk-BCOFWYW4.js → chunk-2BX74BAS.js} +3 -3
  76. package/dist/cli-bundle/chunks/{chunk-APRVSW2O.js → chunk-2CXL335K.js} +3 -3
  77. package/dist/cli-bundle/chunks/{chunk-KG44YSKD.js → chunk-2FUOXSRN.js} +4 -4
  78. package/dist/cli-bundle/chunks/{chunk-HDH3JUGG.js → chunk-2IPNL3DR.js} +3 -3
  79. package/dist/cli-bundle/chunks/{chunk-GM5QHQU6.js → chunk-2XOSFSTH.js} +5 -5
  80. package/dist/cli-bundle/chunks/{chunk-UFXU44HV.js → chunk-35FHWD4C.js} +6 -6
  81. package/dist/cli-bundle/chunks/{chunk-2WSE6PO2.js.map → chunk-35FHWD4C.js.map} +1 -7
  82. package/dist/cli-bundle/chunks/{chunk-K3WII2ME.js → chunk-37DRDP2B.js} +5 -5
  83. package/dist/cli-bundle/chunks/{chunk-BKVG6XOA.js → chunk-3CUQZNQ6.js} +67 -509
  84. package/dist/cli-bundle/chunks/chunk-3CUQZNQ6.js.map +7 -0
  85. package/dist/cli-bundle/chunks/chunk-3QDR6ZLU.js +800 -0
  86. package/dist/cli-bundle/chunks/chunk-3QDR6ZLU.js.map +7 -0
  87. package/dist/cli-bundle/chunks/{chunk-5JLUII3O.js → chunk-43UMFKCK.js} +321 -240
  88. package/dist/cli-bundle/chunks/chunk-43UMFKCK.js.map +1 -0
  89. package/dist/cli-bundle/chunks/{chunk-PMOSXADO.js → chunk-47HXN6RX.js} +3 -3
  90. package/dist/cli-bundle/chunks/{chunk-6CFNAVTF.js → chunk-5HGZKQUL.js} +4 -4
  91. package/dist/cli-bundle/chunks/{chunk-2IFFUZLC.js → chunk-5UKQLQM2.js} +2 -2
  92. package/dist/cli-bundle/chunks/{chunk-DM4H7FP4.js → chunk-633PKXLT.js} +3 -3
  93. package/dist/cli-bundle/chunks/{chunk-XSJUSQAE.js → chunk-646MQXFW.js} +2 -2
  94. package/dist/cli-bundle/chunks/{chunk-ZI6VQWQ7.js → chunk-66MKH7SZ.js} +4 -4
  95. package/dist/cli-bundle/chunks/{chunk-S6MQESFR.js → chunk-67RO3H4N.js} +4 -4
  96. package/dist/cli-bundle/chunks/{chunk-34L5OT3Y.js → chunk-6DYOZS6C.js} +2 -2
  97. package/dist/cli-bundle/chunks/{chunk-RRM5JYJC.js → chunk-6O44IN44.js} +2 -2
  98. package/dist/cli-bundle/chunks/{chunk-5ZSLZLDN.js → chunk-6VHUGVNP.js} +608 -456
  99. package/dist/cli-bundle/chunks/chunk-6VHUGVNP.js.map +1 -0
  100. package/dist/cli-bundle/chunks/{chunk-PENXZX3U.js → chunk-74FKFFXO.js} +2 -2
  101. package/dist/cli-bundle/chunks/{chunk-HO4KXD6I.js → chunk-7H5NNCJ5.js} +4 -4
  102. package/dist/cli-bundle/chunks/{chunk-7B67ZL4N.js → chunk-7R6UIHYY.js} +75 -5
  103. package/dist/cli-bundle/chunks/{chunk-7B67ZL4N.js.map → chunk-7R6UIHYY.js.map} +1 -1
  104. package/dist/cli-bundle/chunks/{chunk-3S5QVM5H.js → chunk-7UCY6DR5.js} +193 -22
  105. package/dist/cli-bundle/chunks/chunk-7UCY6DR5.js.map +1 -0
  106. package/dist/cli-bundle/chunks/{chunk-WT3ZEOGH.js → chunk-ADXDCAKP.js} +16 -7
  107. package/dist/cli-bundle/chunks/{chunk-WT3ZEOGH.js.map → chunk-ADXDCAKP.js.map} +1 -1
  108. package/dist/cli-bundle/chunks/{chunk-TQSZFPIS.js → chunk-AFGKSHAM.js} +4 -4
  109. package/dist/cli-bundle/chunks/{chunk-6N2VXVTQ.js → chunk-ARGDWQ4J.js} +2 -2
  110. package/dist/cli-bundle/chunks/{chunk-XXXF6PAQ.js → chunk-AXRT7K5V.js} +83 -62
  111. package/dist/cli-bundle/chunks/chunk-AXRT7K5V.js.map +7 -0
  112. package/dist/cli-bundle/chunks/{chunk-3U7ZR6M4.js → chunk-B57RJHBZ.js} +4 -4
  113. package/dist/cli-bundle/chunks/{chunk-YCQET3OT.js → chunk-BAP7G3N2.js} +2 -2
  114. package/dist/cli-bundle/chunks/{chunk-NLDFBC6J.js → chunk-BDA35QG5.js} +35 -5
  115. package/dist/cli-bundle/chunks/chunk-BDA35QG5.js.map +7 -0
  116. package/dist/cli-bundle/chunks/{chunk-QKXHFPYM.js → chunk-BIRYX32V.js} +3 -3
  117. package/dist/cli-bundle/chunks/{chunk-RMLWNPH2.js → chunk-BVLOMU6O.js} +2 -2
  118. package/dist/cli-bundle/chunks/{chunk-2VPAVL7O.js → chunk-CKX4WOPC.js} +2 -2
  119. package/dist/cli-bundle/chunks/{chunk-TKOVBP6C.js → chunk-D52ZN3BF.js} +2 -2
  120. package/dist/cli-bundle/chunks/{chunk-KPMKHGEA.js → chunk-D53RTYVI.js} +4 -4
  121. package/dist/cli-bundle/chunks/{chunk-ODALILG3.js → chunk-D5XHO4Q7.js} +2 -2
  122. package/dist/cli-bundle/chunks/{chunk-YAQEBNY7.js → chunk-DDFGYUCQ.js} +4 -4
  123. package/dist/cli-bundle/chunks/{chunk-EAB64KLB.js → chunk-DG2EQRIH.js} +4 -4
  124. package/dist/cli-bundle/chunks/{chunk-J6364LFM.js → chunk-DHNG452T.js} +9 -18
  125. package/dist/cli-bundle/chunks/{chunk-J6364LFM.js.map → chunk-DHNG452T.js.map} +1 -1
  126. package/dist/cli-bundle/chunks/{chunk-JXQUXVMI.js → chunk-E4FXM2XB.js} +77 -7
  127. package/dist/cli-bundle/chunks/{chunk-JXQUXVMI.js.map → chunk-E4FXM2XB.js.map} +1 -1
  128. package/dist/cli-bundle/chunks/{chunk-IG3SWA4A.js → chunk-EHJFUOXL.js} +3 -3
  129. package/dist/cli-bundle/chunks/{chunk-P74IZQ7A.js → chunk-EWIT5WIC.js} +7 -7
  130. package/dist/cli-bundle/chunks/chunk-EX7OQT3Y.js +783 -0
  131. package/dist/cli-bundle/chunks/chunk-EX7OQT3Y.js.map +1 -0
  132. package/dist/cli-bundle/chunks/{chunk-ONREO4ST.js → chunk-EY7ZE3TG.js} +3 -3
  133. package/dist/cli-bundle/chunks/{chunk-ILX33QXL.js → chunk-F3VC3GOV.js} +669 -472
  134. package/dist/cli-bundle/chunks/chunk-F3VC3GOV.js.map +7 -0
  135. package/dist/cli-bundle/chunks/{chunk-EJEXHTY5.js → chunk-FHOBCGQO.js} +2 -2
  136. package/dist/cli-bundle/chunks/{chunk-H3EIEWGR.js → chunk-FL4D53ND.js} +2 -2
  137. package/dist/cli-bundle/chunks/{chunk-WUJQK4YV.js → chunk-FVNWHUME.js} +4 -4
  138. package/dist/cli-bundle/chunks/{chunk-INU6DKT5.js → chunk-FXFCFL73.js} +5 -5
  139. package/dist/cli-bundle/chunks/{chunk-QEHQ2GVG.js → chunk-FY4RLHSC.js} +2 -2
  140. package/dist/cli-bundle/chunks/{chunk-AHVTB5I5.js → chunk-G6MYGULG.js} +4 -4
  141. package/dist/cli-bundle/chunks/{chunk-HYB5AZ63.js → chunk-GKPCTQYG.js} +1822 -72
  142. package/dist/cli-bundle/chunks/chunk-GKPCTQYG.js.map +7 -0
  143. package/dist/cli-bundle/chunks/{chunk-TSMHDIW4.js → chunk-GLZKZON6.js} +2 -2
  144. package/dist/cli-bundle/chunks/{chunk-2JKGO6QX.js → chunk-H5IOT54C.js} +4 -4
  145. package/dist/cli-bundle/chunks/{chunk-SELVXEZK.js → chunk-HO4DLBNK.js} +2 -2
  146. package/dist/cli-bundle/chunks/{chunk-CRVF2JDM.js → chunk-HPAYDSR2.js} +8 -8
  147. package/dist/cli-bundle/chunks/{chunk-3CLU2XZO.js → chunk-HSYV4ZYT.js} +4 -4
  148. package/dist/cli-bundle/chunks/{chunk-EH2OPHBI.js → chunk-HTXXXF45.js} +23 -19
  149. package/dist/cli-bundle/chunks/chunk-HTXXXF45.js.map +1 -0
  150. package/dist/cli-bundle/chunks/{chunk-J5AOEGDC.js → chunk-HYTOJW2Q.js} +8 -8
  151. package/dist/cli-bundle/chunks/{chunk-4XQ3BDV4.js → chunk-I3INI567.js} +536 -449
  152. package/dist/cli-bundle/chunks/chunk-I3INI567.js.map +7 -0
  153. package/dist/cli-bundle/chunks/{chunk-NU3IMIEA.js → chunk-I7DIDUSP.js} +2 -2
  154. package/dist/cli-bundle/chunks/{chunk-JYFOV7FC.js → chunk-IE5KRAKN.js} +4 -4
  155. package/dist/cli-bundle/chunks/{chunk-YAROI3PD.js → chunk-IL5SPRMH.js} +7 -7
  156. package/dist/cli-bundle/chunks/{chunk-UY2ACEMF.js → chunk-ILVOOAT4.js} +5 -5
  157. package/dist/cli-bundle/chunks/{chunk-GOSLKLFE.js → chunk-KH6QAHME.js} +3 -3
  158. package/dist/cli-bundle/chunks/{chunk-QKECXBBG.js → chunk-KX62NMZC.js} +3 -3
  159. package/dist/cli-bundle/chunks/{chunk-QKECXBBG.js.map → chunk-KX62NMZC.js.map} +1 -1
  160. package/dist/cli-bundle/chunks/{chunk-WQPUU7XD.js → chunk-L337QKWJ.js} +5 -5
  161. package/dist/cli-bundle/chunks/{chunk-JFTKLTEF.js → chunk-L5BTTDU5.js} +68 -503
  162. package/dist/cli-bundle/chunks/chunk-L5BTTDU5.js.map +1 -0
  163. package/dist/cli-bundle/chunks/{chunk-LSG2U345.js → chunk-L6FVNR7X.js} +5 -5
  164. package/dist/cli-bundle/chunks/{chunk-FMBNM2EN.js → chunk-LSOWTLEM.js} +2 -2
  165. package/dist/cli-bundle/chunks/{chunk-4223PVZT.js → chunk-M7MVOKVV.js} +3 -3
  166. package/dist/cli-bundle/chunks/{chunk-UMOPHQSU.js → chunk-MR4SHYR4.js} +41 -19
  167. package/dist/cli-bundle/chunks/chunk-MR4SHYR4.js.map +7 -0
  168. package/dist/cli-bundle/chunks/{chunk-3WM75PWC.js → chunk-N33FD2UI.js} +3 -3
  169. package/dist/cli-bundle/chunks/{chunk-UXONS674.js → chunk-NCVT6XEL.js} +68 -56
  170. package/dist/cli-bundle/chunks/chunk-NCVT6XEL.js.map +1 -0
  171. package/dist/cli-bundle/chunks/{chunk-6S3YSUYG.js → chunk-NNANAWFH.js} +3 -3
  172. package/dist/cli-bundle/chunks/{chunk-IJIICKVW.js → chunk-NTRQLE2R.js} +2 -2
  173. package/dist/cli-bundle/chunks/{chunk-SDQLJWBO.js → chunk-NVZ6NVHJ.js} +4 -4
  174. package/dist/cli-bundle/chunks/{chunk-E2OJMKML.js → chunk-OGVTB5VO.js} +47 -37
  175. package/dist/cli-bundle/chunks/chunk-OGVTB5VO.js.map +7 -0
  176. package/dist/cli-bundle/chunks/{chunk-H2Z3FYXQ.js → chunk-OWP6QFBV.js} +4 -4
  177. package/dist/cli-bundle/chunks/{chunk-Q7A43DS4.js → chunk-P22HGFFI.js} +2 -2
  178. package/dist/cli-bundle/chunks/{chunk-NVPZIJVR.js → chunk-PT7MCCGD.js} +2 -2
  179. package/dist/cli-bundle/chunks/{chunk-ONG5V5CI.js → chunk-QPGQNLPI.js} +1751 -70
  180. package/dist/cli-bundle/chunks/chunk-QPGQNLPI.js.map +1 -0
  181. package/dist/cli-bundle/chunks/{chunk-J6EY5V4N.js → chunk-QRZNCRNA.js} +9 -9
  182. package/dist/cli-bundle/chunks/{chunk-QIPLHNP7.js → chunk-QWBKN3QC.js} +5 -5
  183. package/dist/cli-bundle/chunks/{chunk-7PIWCHTW.js → chunk-R5XTTZSJ.js} +5 -5
  184. package/dist/cli-bundle/chunks/{chunk-JOUQZENX.js → chunk-RC4UOUXA.js} +3 -3
  185. package/dist/cli-bundle/chunks/{chunk-BEP7WJA2.js → chunk-RGMWJLXF.js} +4 -4
  186. package/dist/cli-bundle/chunks/{chunk-NP22ERDF.js → chunk-RTBX3C4C.js} +3 -3
  187. package/dist/cli-bundle/chunks/{chunk-FNSPG7MU.js → chunk-RXPQ5Q23.js} +7 -7
  188. package/dist/cli-bundle/chunks/{chunk-LPYWLWDS.js → chunk-SIPOACV5.js} +534 -447
  189. package/dist/cli-bundle/chunks/chunk-SIPOACV5.js.map +1 -0
  190. package/dist/cli-bundle/chunks/chunk-TGBTLGPX.js +851 -0
  191. package/dist/cli-bundle/chunks/chunk-TGBTLGPX.js.map +7 -0
  192. package/dist/cli-bundle/chunks/{chunk-2WSE6PO2.js → chunk-TLWJP5BF.js} +5 -5
  193. package/dist/cli-bundle/chunks/chunk-TLWJP5BF.js.map +7 -0
  194. package/dist/cli-bundle/chunks/{chunk-ULTHRDBP.js → chunk-TM5CIO3F.js} +3 -3
  195. package/dist/cli-bundle/chunks/{chunk-UWQHLMEB.js → chunk-TZAE66GQ.js} +8 -8
  196. package/dist/cli-bundle/chunks/{chunk-OW4JWD5M.js → chunk-VAHZIPWS.js} +4 -4
  197. package/dist/cli-bundle/chunks/{chunk-DYH63FX7.js → chunk-VE6ZSTQW.js} +4 -4
  198. package/dist/cli-bundle/chunks/{chunk-3AUGG2DP.js → chunk-W5E2UUSH.js} +3 -3
  199. package/dist/cli-bundle/chunks/{chunk-BSEQUTQP.js → chunk-WACRQ26A.js} +2 -2
  200. package/dist/cli-bundle/chunks/{chunk-BSEQUTQP.js.map → chunk-WACRQ26A.js.map} +1 -1
  201. package/dist/cli-bundle/chunks/{chunk-UOHFKBUV.js → chunk-WL3SS45P.js} +3 -3
  202. package/dist/cli-bundle/chunks/{chunk-H5APFTHZ.js → chunk-WQXRZMFN.js} +204 -33
  203. package/dist/cli-bundle/chunks/chunk-WQXRZMFN.js.map +7 -0
  204. package/dist/cli-bundle/chunks/{chunk-QKJGPFAF.js → chunk-WU3KAN6A.js} +3 -3
  205. package/dist/cli-bundle/chunks/{chunk-IA5FKNII.js → chunk-X2MGQMZO.js} +2 -2
  206. package/dist/cli-bundle/chunks/{chunk-TD3LVC7D.js → chunk-X5YCTFKT.js} +3 -3
  207. package/dist/cli-bundle/chunks/{chunk-B7PE22W6.js → chunk-XC2HEEOV.js} +4 -4
  208. package/dist/cli-bundle/chunks/{chunk-7Z4LKRS4.js → chunk-XPUTSGJU.js} +38 -37
  209. package/dist/cli-bundle/chunks/chunk-XPUTSGJU.js.map +1 -0
  210. package/dist/cli-bundle/chunks/{chunk-YBLZ2VE7.js → chunk-XWBD6DSR.js} +320 -239
  211. package/dist/cli-bundle/chunks/chunk-XWBD6DSR.js.map +7 -0
  212. package/dist/cli-bundle/chunks/chunk-XWYQ2LT4.js +834 -0
  213. package/dist/cli-bundle/chunks/chunk-XWYQ2LT4.js.map +1 -0
  214. package/dist/cli-bundle/chunks/{chunk-K2X6U4UA.js → chunk-XXLXJL7V.js} +4 -4
  215. package/dist/cli-bundle/chunks/{chunk-2NCIPMQP.js → chunk-YFE7JHX3.js} +27 -6
  216. package/dist/cli-bundle/chunks/chunk-YFE7JHX3.js.map +1 -0
  217. package/dist/cli-bundle/chunks/{chunk-EACOH7AU.js → chunk-YIIIAKCE.js} +8 -8
  218. package/dist/cli-bundle/chunks/{chunk-RLCHOOHC.js → chunk-YJSURTBB.js} +2 -2
  219. package/dist/cli-bundle/chunks/{chunk-PGY23YTC.js → chunk-YKFHF37B.js} +3 -3
  220. package/dist/cli-bundle/chunks/{chunk-EYLCSJAI.js → chunk-YQEZWI3R.js} +2 -2
  221. package/dist/cli-bundle/chunks/close-GPD7DTJV.js +12 -0
  222. package/dist/cli-bundle/chunks/{close-CWODTPKG.js → close-X3CF6FQP.js} +5 -5
  223. package/dist/cli-bundle/chunks/{close-many-CQFUY7MR.js → close-many-J7A5EHOQ.js} +14 -14
  224. package/dist/cli-bundle/chunks/close-many-NQLYGPYW.js +23 -0
  225. package/dist/cli-bundle/chunks/comments-2AOZQ5D2.js +13 -0
  226. package/dist/cli-bundle/chunks/{comments-WGLHR7LB.js → comments-TMHMALA5.js} +7 -7
  227. package/dist/cli-bundle/chunks/{copy-LXVDXH7B.js → copy-FWQA5OU4.js} +4 -4
  228. package/dist/cli-bundle/chunks/copy-N3LCQBMC.js +9 -0
  229. package/dist/cli-bundle/chunks/{create-LBVCYMEG.js → create-AQ5SIGZC.js} +9 -9
  230. package/dist/cli-bundle/chunks/{create-J5U6ND4K.js → create-KOGQ3JKD.js} +9 -9
  231. package/dist/cli-bundle/chunks/delete-6G3MBZ6S.js +10 -0
  232. package/dist/cli-bundle/chunks/{delete-PMJBNY5G.js → delete-YYYFOSEA.js} +4 -4
  233. package/dist/cli-bundle/chunks/{deps-JZ7TMVCB.js → deps-MQ4ZIGZB.js} +16 -7
  234. package/dist/cli-bundle/chunks/deps-NIIKXLPB.js +28 -0
  235. package/dist/cli-bundle/chunks/{docs-FEWB2DQB.js → docs-53NUGMIQ.js} +6 -6
  236. package/dist/cli-bundle/chunks/docs-OWRGDMNY.js +14 -0
  237. package/dist/cli-bundle/chunks/{files-EFIWKFTM.js → files-3PXGXYDB.js} +6 -6
  238. package/dist/cli-bundle/chunks/{files-6YFBJRBG.js → files-EGLKHD7O.js} +6 -6
  239. package/dist/cli-bundle/chunks/focus-KZLIA6WS.js +10 -0
  240. package/dist/cli-bundle/chunks/{focus-4QJR7FOQ.js → focus-SRPASFTN.js} +5 -5
  241. package/dist/cli-bundle/chunks/{history-compact-CKRPDTJN.js → history-compact-G4DULDCX.js} +6 -6
  242. package/dist/cli-bundle/chunks/history-compact-HHIUOMZ7.js +16 -0
  243. package/dist/cli-bundle/chunks/{history-redact-BB3TGDAE.js → history-redact-IUSJ6X3E.js} +4 -4
  244. package/dist/cli-bundle/chunks/{history-redact-D225BHOZ.js → history-redact-THHGRQXV.js} +4 -4
  245. package/dist/cli-bundle/chunks/history-repair-KG7SWXI6.js +16 -0
  246. package/dist/cli-bundle/chunks/{history-repair-RQXKQHL4.js → history-repair-LUQWRS7X.js} +6 -6
  247. package/dist/cli-bundle/chunks/{learnings-JLNLCOL5.js → learnings-2MRNBFJF.js} +7 -7
  248. package/dist/cli-bundle/chunks/learnings-ZVHSALJY.js +13 -0
  249. package/dist/cli-bundle/chunks/{notes-GB47XXQQ.js → notes-73JWKWUD.js} +7 -7
  250. package/dist/cli-bundle/chunks/notes-BAKUL5DJ.js +13 -0
  251. package/dist/cli-bundle/chunks/{plan-VDCJ2PCN.js → plan-AZPMCG37.js} +10 -10
  252. package/dist/cli-bundle/chunks/plan-LEAGLPGP.js +24 -0
  253. package/dist/cli-bundle/chunks/{profile-FAU7NZML.js → profile-AVCIIZID.js} +9 -9
  254. package/dist/cli-bundle/chunks/{profile-IVXQEL3D.js → profile-LFYO3HHX.js} +9 -9
  255. package/dist/cli-bundle/chunks/{register-list-query-UL4UKBBN.js → register-list-query-MZUF2EEC.js} +50 -22
  256. package/dist/cli-bundle/chunks/register-list-query-MZUF2EEC.js.map +1 -0
  257. package/dist/cli-bundle/chunks/{register-list-query-DKA3EH5D.js → register-list-query-UKMF55FT.js} +49 -21
  258. package/dist/cli-bundle/chunks/register-list-query-UKMF55FT.js.map +7 -0
  259. package/dist/cli-bundle/chunks/{register-mutation-RBBJ52DK.js → register-mutation-2PBW2GEX.js} +35 -33
  260. package/dist/cli-bundle/chunks/register-mutation-2PBW2GEX.js.map +1 -0
  261. package/dist/cli-bundle/chunks/{register-mutation-ARFHRW55.js → register-mutation-T6RVNJC4.js} +34 -32
  262. package/dist/cli-bundle/chunks/{register-mutation-ARFHRW55.js.map → register-mutation-T6RVNJC4.js.map} +2 -2
  263. package/dist/cli-bundle/chunks/{register-operations-ZIBBRSED.js → register-operations-KHZYR6MG.js} +35 -35
  264. package/dist/cli-bundle/chunks/{register-operations-ZUJ5JWPE.js → register-operations-WPQ2LWZJ.js} +35 -35
  265. package/dist/cli-bundle/chunks/{register-setup-BCVLFEYS.js → register-setup-PGDNOXDQ.js} +15 -15
  266. package/dist/cli-bundle/chunks/{register-setup-TDCGWIOS.js → register-setup-TDN7WAO6.js} +15 -15
  267. package/dist/cli-bundle/chunks/{restore-25DLT2Q2.js → restore-E3PRGDN3.js} +6 -6
  268. package/dist/cli-bundle/chunks/restore-KIUYTAEJ.js +14 -0
  269. package/dist/cli-bundle/chunks/{schema-FNU3WE4O.js → schema-5JNFQFUW.js} +6 -6
  270. package/dist/cli-bundle/chunks/{schema-NBCM3RAD.js → schema-TMIW4XZC.js} +6 -6
  271. package/dist/cli-bundle/chunks/{update-XHSIAIXE.js → update-SQYZA3ZW.js} +12 -12
  272. package/dist/cli-bundle/chunks/update-XZJYS5X7.js +21 -0
  273. package/dist/cli-bundle/chunks/update-many-R24B3GBK.js +36 -0
  274. package/dist/cli-bundle/chunks/update-many-WQ3R3J6N.js +32 -0
  275. package/dist/cli-bundle/main.js +170 -856
  276. package/dist/cli-bundle/main.js.map +4 -4
  277. package/dist/cli-bundle/sdk-runtime.js +57 -54
  278. package/dist/cli-bundle/sdk-testing.js +6 -6
  279. package/dist/cli-bundle/sdk.js +266 -340
  280. package/dist/cli-bundle/sdk.js.map +4 -4
  281. package/dist/core/extensions/item-fields.js +2 -2
  282. package/dist/core/extensions/item-fields.js.map +1 -1
  283. package/dist/core/item/actionability.d.ts +12 -0
  284. package/dist/core/item/actionability.js +39 -4
  285. package/dist/core/item/actionability.js.map +1 -1
  286. package/dist/core/sentry/instrument.d.ts +11 -0
  287. package/dist/core/sentry/instrument.js +21 -2
  288. package/dist/core/sentry/instrument.js.map +1 -1
  289. package/dist/mcp/server.d.ts +16 -18
  290. package/dist/mcp/server.js +84 -31
  291. package/dist/mcp/server.js.map +1 -1
  292. package/dist/mcp/tool-definitions.js +17 -4
  293. package/dist/mcp/tool-definitions.js.map +1 -1
  294. package/dist/sdk/actionability.d.ts +10 -0
  295. package/dist/sdk/actionability.js +14 -0
  296. package/dist/sdk/actionability.js.map +1 -0
  297. package/dist/sdk/cli-bootstrap.d.ts +122 -0
  298. package/dist/sdk/cli-bootstrap.js +879 -0
  299. package/dist/sdk/cli-bootstrap.js.map +1 -0
  300. package/dist/sdk/cli-contracts/enum-contracts.d.ts +6 -2
  301. package/dist/sdk/cli-contracts/enum-contracts.js +19 -2
  302. package/dist/sdk/cli-contracts/enum-contracts.js.map +1 -1
  303. package/dist/sdk/cli-contracts/flag-contracts.d.ts +2 -0
  304. package/dist/sdk/cli-contracts/flag-contracts.js +21 -2
  305. package/dist/sdk/cli-contracts/flag-contracts.js.map +1 -1
  306. package/dist/sdk/cli-contracts/tool-option-contracts.d.ts +2 -0
  307. package/dist/sdk/cli-contracts/tool-option-contracts.js +16 -2
  308. package/dist/sdk/cli-contracts/tool-option-contracts.js.map +1 -1
  309. package/dist/sdk/cli-contracts/tool-parameter-tables.js +80 -3
  310. package/dist/sdk/cli-contracts/tool-parameter-tables.js.map +1 -1
  311. package/dist/sdk/cli-contracts/tool-schema.d.ts +20 -0
  312. package/dist/sdk/cli-contracts/tool-schema.js +97 -9
  313. package/dist/sdk/cli-contracts/tool-schema.js.map +1 -1
  314. package/dist/sdk/cli-contracts.d.ts +2 -2
  315. package/dist/sdk/cli-contracts.js +4 -4
  316. package/dist/sdk/cli-contracts.js.map +1 -1
  317. package/dist/sdk/dependencies.d.ts +42 -53
  318. package/dist/sdk/dependencies.js +177 -125
  319. package/dist/sdk/dependencies.js.map +1 -1
  320. package/dist/sdk/eval.d.ts +66 -0
  321. package/dist/sdk/eval.js +186 -0
  322. package/dist/sdk/eval.js.map +1 -0
  323. package/dist/sdk/governance/validate.js +3 -3
  324. package/dist/sdk/governance/validate.js.map +1 -1
  325. package/dist/sdk/graph/analytics.d.ts +124 -0
  326. package/dist/sdk/graph/analytics.js +464 -0
  327. package/dist/sdk/graph/analytics.js.map +1 -0
  328. package/dist/sdk/graph/assembly.d.ts +97 -0
  329. package/dist/sdk/graph/assembly.js +146 -0
  330. package/dist/sdk/graph/assembly.js.map +1 -0
  331. package/dist/sdk/graph/cache.d.ts +66 -0
  332. package/dist/sdk/graph/cache.js +148 -0
  333. package/dist/sdk/graph/cache.js.map +1 -0
  334. package/dist/sdk/graph/governance.d.ts +108 -0
  335. package/dist/sdk/graph/governance.js +360 -0
  336. package/dist/sdk/graph/governance.js.map +1 -0
  337. package/dist/sdk/graph/index.d.ts +16 -0
  338. package/dist/sdk/graph/index.js +20 -0
  339. package/dist/sdk/graph/index.js.map +1 -0
  340. package/dist/sdk/graph/remediation.d.ts +52 -0
  341. package/dist/sdk/graph/remediation.js +148 -0
  342. package/dist/sdk/graph/remediation.js.map +1 -0
  343. package/dist/sdk/graph/run.d.ts +295 -0
  344. package/dist/sdk/graph/run.js +468 -0
  345. package/dist/sdk/graph/run.js.map +1 -0
  346. package/dist/sdk/graph/traversal.d.ts +77 -0
  347. package/dist/sdk/graph/traversal.js +262 -0
  348. package/dist/sdk/graph/traversal.js.map +1 -0
  349. package/dist/sdk/index.d.ts +19 -5
  350. package/dist/sdk/index.js +21 -7
  351. package/dist/sdk/index.js.map +1 -1
  352. package/dist/{cli/commands → sdk/query}/item-filter-options.d.ts +1 -1
  353. package/dist/{cli/commands → sdk/query}/item-filter-options.js +3 -3
  354. package/dist/sdk/query/item-filter-options.js.map +1 -0
  355. package/dist/sdk/query/list.d.ts +262 -0
  356. package/dist/sdk/query/list.js +1089 -0
  357. package/dist/sdk/query/list.js.map +1 -0
  358. package/dist/sdk/query/parsers.d.ts +9 -0
  359. package/dist/sdk/query/parsers.js +45 -0
  360. package/dist/sdk/query/parsers.js.map +1 -0
  361. package/dist/{cli/commands → sdk/query}/search-pagination.js +4 -4
  362. package/dist/sdk/query/search-pagination.js.map +1 -0
  363. package/dist/{cli/commands → sdk/query}/search-rendering.js +3 -3
  364. package/dist/sdk/query/search-rendering.js.map +1 -0
  365. package/dist/sdk/query/search.d.ts +469 -0
  366. package/dist/sdk/query/search.js +2247 -0
  367. package/dist/sdk/query/search.js.map +1 -0
  368. package/dist/sdk/relationship-context.d.ts +42 -0
  369. package/dist/sdk/relationship-context.js +99 -20
  370. package/dist/sdk/relationship-context.js.map +1 -1
  371. package/dist/sdk/relationships.d.ts +13 -0
  372. package/dist/sdk/relationships.js +30 -2
  373. package/dist/sdk/relationships.js.map +1 -1
  374. package/dist/sdk/runtime-input.d.ts +41 -0
  375. package/dist/sdk/runtime-input.js +422 -2
  376. package/dist/sdk/runtime-input.js.map +1 -1
  377. package/dist/sdk/runtime.d.ts +19 -30
  378. package/dist/sdk/runtime.js +30 -376
  379. package/dist/sdk/runtime.js.map +1 -1
  380. package/dist/sdk/search-refresh-worker.d.ts +2 -0
  381. package/dist/sdk/search-refresh-worker.js +19 -0
  382. package/dist/sdk/search-refresh-worker.js.map +1 -0
  383. package/dist/sdk/stats.d.ts +66 -0
  384. package/dist/sdk/stats.js +151 -0
  385. package/dist/sdk/stats.js.map +1 -0
  386. package/dist/sdk/telemetry-flush.d.ts +2 -0
  387. package/dist/sdk/telemetry-flush.js +14 -0
  388. package/dist/sdk/telemetry-flush.js.map +1 -0
  389. package/dist/sdk/telemetry.d.ts +14 -0
  390. package/dist/sdk/telemetry.js +398 -0
  391. package/dist/sdk/telemetry.js.map +1 -0
  392. package/dist/sdk/test/batch.d.ts +94 -0
  393. package/dist/sdk/test/batch.js +492 -0
  394. package/dist/sdk/test/batch.js.map +1 -0
  395. package/dist/sdk/test/entry.d.ts +6 -0
  396. package/dist/sdk/test/entry.js +74 -0
  397. package/dist/sdk/test/entry.js.map +1 -0
  398. package/dist/sdk/test/execution.d.ts +282 -0
  399. package/dist/sdk/test/execution.js +1817 -0
  400. package/dist/sdk/test/execution.js.map +1 -0
  401. package/dist/sdk/test/linked-command-detection.js +12 -3
  402. package/dist/sdk/test/linked-command-detection.js.map +1 -1
  403. package/dist/sdk/test/parsers.d.ts +48 -0
  404. package/dist/sdk/test/parsers.js +522 -0
  405. package/dist/sdk/test/parsers.js.map +1 -0
  406. package/dist/sdk/test/runs.d.ts +92 -0
  407. package/dist/sdk/test/runs.js +195 -0
  408. package/dist/sdk/test/runs.js.map +1 -0
  409. package/docs/AGENT_GUIDE.md +1 -0
  410. package/docs/COMMANDS.md +19 -1
  411. package/docs/RELATIONSHIP_GRAPH.md +99 -3
  412. package/docs/SDK.md +139 -3
  413. package/docs/SDK_PRIMITIVE_INVENTORY.md +5 -3
  414. package/docs/examples/sdk-custom-tool/README.md +27 -0
  415. package/docs/examples/sdk-custom-tool/package.json +13 -0
  416. package/docs/examples/sdk-custom-tool/src/cli.ts +36 -0
  417. package/docs/examples/sdk-custom-tool/src/entry.ts +15 -0
  418. package/docs/examples/sdk-custom-tool/src/index.ts +223 -0
  419. package/marketplace.json +2 -2
  420. package/package.json +4 -4
  421. package/packages/pm-beads/package.json +1 -1
  422. package/packages/pm-calendar/package.json +1 -1
  423. package/packages/pm-command-kit/package.json +1 -1
  424. package/packages/pm-governance-audit/extensions/governance-audit/comments-audit.ts +77 -57
  425. package/packages/pm-governance-audit/extensions/governance-audit/dedupe-audit.ts +202 -194
  426. package/packages/pm-governance-audit/extensions/governance-audit/dedupe-merge.ts +227 -153
  427. package/packages/pm-governance-audit/extensions/governance-audit/normalize.ts +169 -125
  428. package/packages/pm-governance-audit/extensions/governance-audit/runtime-utils.ts +130 -81
  429. package/packages/pm-governance-audit/extensions/governance-audit/sdk.ts +53 -4
  430. package/packages/pm-governance-audit/package.json +1 -1
  431. package/packages/pm-guide-shell/package.json +1 -1
  432. package/packages/pm-kanban/package.json +1 -1
  433. package/packages/pm-lifecycle-hooks/package.json +1 -1
  434. package/packages/pm-linked-test-adapters/package.json +1 -1
  435. package/packages/pm-search-advanced/package.json +1 -1
  436. package/packages/pm-templates/package.json +1 -1
  437. package/packages/pm-todos/package.json +1 -1
  438. package/plugins/pm-claude/.claude-plugin/plugin.json +1 -1
  439. package/plugins/pm-codex/.codex-plugin/plugin.json +1 -1
  440. package/dist/cli/commands/item-filter-options.js.map +0 -1
  441. package/dist/cli/commands/search-pagination.js.map +0 -1
  442. package/dist/cli/commands/search-rendering.js.map +0 -1
  443. package/dist/cli-bundle/chunks/append-UZVHUO74.js +0 -11
  444. package/dist/cli-bundle/chunks/chunk-2NCIPMQP.js.map +0 -1
  445. package/dist/cli-bundle/chunks/chunk-3S5QVM5H.js.map +0 -1
  446. package/dist/cli-bundle/chunks/chunk-4XQ3BDV4.js.map +0 -7
  447. package/dist/cli-bundle/chunks/chunk-5JLUII3O.js.map +0 -1
  448. package/dist/cli-bundle/chunks/chunk-5ZSLZLDN.js.map +0 -1
  449. package/dist/cli-bundle/chunks/chunk-7Z4LKRS4.js.map +0 -1
  450. package/dist/cli-bundle/chunks/chunk-BKVG6XOA.js.map +0 -7
  451. package/dist/cli-bundle/chunks/chunk-E2OJMKML.js.map +0 -7
  452. package/dist/cli-bundle/chunks/chunk-EH2OPHBI.js.map +0 -1
  453. package/dist/cli-bundle/chunks/chunk-H5APFTHZ.js.map +0 -7
  454. package/dist/cli-bundle/chunks/chunk-HYB5AZ63.js.map +0 -7
  455. package/dist/cli-bundle/chunks/chunk-ILX33QXL.js.map +0 -7
  456. package/dist/cli-bundle/chunks/chunk-JFTKLTEF.js.map +0 -1
  457. package/dist/cli-bundle/chunks/chunk-LPYWLWDS.js.map +0 -1
  458. package/dist/cli-bundle/chunks/chunk-NLDFBC6J.js.map +0 -7
  459. package/dist/cli-bundle/chunks/chunk-ONG5V5CI.js.map +0 -1
  460. package/dist/cli-bundle/chunks/chunk-UFXU44HV.js.map +0 -1
  461. package/dist/cli-bundle/chunks/chunk-UMOPHQSU.js.map +0 -7
  462. package/dist/cli-bundle/chunks/chunk-UXONS674.js.map +0 -1
  463. package/dist/cli-bundle/chunks/chunk-XXXF6PAQ.js.map +0 -7
  464. package/dist/cli-bundle/chunks/chunk-YBLZ2VE7.js.map +0 -7
  465. package/dist/cli-bundle/chunks/chunk-YXSHIAUJ.js +0 -58
  466. package/dist/cli-bundle/chunks/chunk-YXSHIAUJ.js.map +0 -1
  467. package/dist/cli-bundle/chunks/chunk-ZKRZY773.js +0 -68
  468. package/dist/cli-bundle/chunks/chunk-ZKRZY773.js.map +0 -7
  469. package/dist/cli-bundle/chunks/close-W6LI2PKM.js +0 -12
  470. package/dist/cli-bundle/chunks/close-many-DLDDVSH5.js +0 -23
  471. package/dist/cli-bundle/chunks/comments-E3TNTK24.js +0 -13
  472. package/dist/cli-bundle/chunks/copy-Q5ZJPUKR.js +0 -9
  473. package/dist/cli-bundle/chunks/delete-WNHB3LYW.js +0 -10
  474. package/dist/cli-bundle/chunks/deps-OA26IS25.js +0 -19
  475. package/dist/cli-bundle/chunks/docs-HA2AIDBB.js +0 -14
  476. package/dist/cli-bundle/chunks/focus-POIW5LTJ.js +0 -10
  477. package/dist/cli-bundle/chunks/history-compact-FWG2C7FZ.js +0 -16
  478. package/dist/cli-bundle/chunks/history-repair-6GEAM7HE.js +0 -16
  479. package/dist/cli-bundle/chunks/learnings-RSNLSWDC.js +0 -13
  480. package/dist/cli-bundle/chunks/notes-2WDH6DXU.js +0 -13
  481. package/dist/cli-bundle/chunks/plan-DOVI2VMW.js +0 -24
  482. package/dist/cli-bundle/chunks/register-list-query-DKA3EH5D.js.map +0 -7
  483. package/dist/cli-bundle/chunks/register-list-query-UL4UKBBN.js.map +0 -1
  484. package/dist/cli-bundle/chunks/register-mutation-RBBJ52DK.js.map +0 -1
  485. package/dist/cli-bundle/chunks/restore-YPMVUUEX.js +0 -14
  486. package/dist/cli-bundle/chunks/update-WWBYOPXO.js +0 -21
  487. package/dist/cli-bundle/chunks/update-many-OUGIU5SF.js +0 -32
  488. package/dist/cli-bundle/chunks/update-many-TA7NGQBO.js +0 -36
  489. /package/dist/cli-bundle/chunks/{append-OJQFUQ4T.js.map → append-5YF3TO7I.js.map} +0 -0
  490. /package/dist/cli-bundle/chunks/{append-UZVHUO74.js.map → append-JHO5K6RP.js.map} +0 -0
  491. /package/dist/cli-bundle/chunks/{chunk-BCOFWYW4.js.map → chunk-2BX74BAS.js.map} +0 -0
  492. /package/dist/cli-bundle/chunks/{chunk-APRVSW2O.js.map → chunk-2CXL335K.js.map} +0 -0
  493. /package/dist/cli-bundle/chunks/{chunk-KG44YSKD.js.map → chunk-2FUOXSRN.js.map} +0 -0
  494. /package/dist/cli-bundle/chunks/{chunk-HDH3JUGG.js.map → chunk-2IPNL3DR.js.map} +0 -0
  495. /package/dist/cli-bundle/chunks/{chunk-GM5QHQU6.js.map → chunk-2XOSFSTH.js.map} +0 -0
  496. /package/dist/cli-bundle/chunks/{chunk-K3WII2ME.js.map → chunk-37DRDP2B.js.map} +0 -0
  497. /package/dist/cli-bundle/chunks/{chunk-PMOSXADO.js.map → chunk-47HXN6RX.js.map} +0 -0
  498. /package/dist/cli-bundle/chunks/{chunk-6CFNAVTF.js.map → chunk-5HGZKQUL.js.map} +0 -0
  499. /package/dist/cli-bundle/chunks/{chunk-2IFFUZLC.js.map → chunk-5UKQLQM2.js.map} +0 -0
  500. /package/dist/cli-bundle/chunks/{chunk-DM4H7FP4.js.map → chunk-633PKXLT.js.map} +0 -0
  501. /package/dist/cli-bundle/chunks/{chunk-XSJUSQAE.js.map → chunk-646MQXFW.js.map} +0 -0
  502. /package/dist/cli-bundle/chunks/{chunk-ZI6VQWQ7.js.map → chunk-66MKH7SZ.js.map} +0 -0
  503. /package/dist/cli-bundle/chunks/{chunk-S6MQESFR.js.map → chunk-67RO3H4N.js.map} +0 -0
  504. /package/dist/cli-bundle/chunks/{chunk-34L5OT3Y.js.map → chunk-6DYOZS6C.js.map} +0 -0
  505. /package/dist/cli-bundle/chunks/{chunk-RRM5JYJC.js.map → chunk-6O44IN44.js.map} +0 -0
  506. /package/dist/cli-bundle/chunks/{chunk-PENXZX3U.js.map → chunk-74FKFFXO.js.map} +0 -0
  507. /package/dist/cli-bundle/chunks/{chunk-HO4KXD6I.js.map → chunk-7H5NNCJ5.js.map} +0 -0
  508. /package/dist/cli-bundle/chunks/{chunk-TQSZFPIS.js.map → chunk-AFGKSHAM.js.map} +0 -0
  509. /package/dist/cli-bundle/chunks/{chunk-6N2VXVTQ.js.map → chunk-ARGDWQ4J.js.map} +0 -0
  510. /package/dist/cli-bundle/chunks/{chunk-3U7ZR6M4.js.map → chunk-B57RJHBZ.js.map} +0 -0
  511. /package/dist/cli-bundle/chunks/{chunk-YCQET3OT.js.map → chunk-BAP7G3N2.js.map} +0 -0
  512. /package/dist/cli-bundle/chunks/{chunk-QKXHFPYM.js.map → chunk-BIRYX32V.js.map} +0 -0
  513. /package/dist/cli-bundle/chunks/{chunk-RMLWNPH2.js.map → chunk-BVLOMU6O.js.map} +0 -0
  514. /package/dist/cli-bundle/chunks/{chunk-2VPAVL7O.js.map → chunk-CKX4WOPC.js.map} +0 -0
  515. /package/dist/cli-bundle/chunks/{chunk-TKOVBP6C.js.map → chunk-D52ZN3BF.js.map} +0 -0
  516. /package/dist/cli-bundle/chunks/{chunk-KPMKHGEA.js.map → chunk-D53RTYVI.js.map} +0 -0
  517. /package/dist/cli-bundle/chunks/{chunk-ODALILG3.js.map → chunk-D5XHO4Q7.js.map} +0 -0
  518. /package/dist/cli-bundle/chunks/{chunk-YAQEBNY7.js.map → chunk-DDFGYUCQ.js.map} +0 -0
  519. /package/dist/cli-bundle/chunks/{chunk-EAB64KLB.js.map → chunk-DG2EQRIH.js.map} +0 -0
  520. /package/dist/cli-bundle/chunks/{chunk-IG3SWA4A.js.map → chunk-EHJFUOXL.js.map} +0 -0
  521. /package/dist/cli-bundle/chunks/{chunk-P74IZQ7A.js.map → chunk-EWIT5WIC.js.map} +0 -0
  522. /package/dist/cli-bundle/chunks/{chunk-ONREO4ST.js.map → chunk-EY7ZE3TG.js.map} +0 -0
  523. /package/dist/cli-bundle/chunks/{chunk-EJEXHTY5.js.map → chunk-FHOBCGQO.js.map} +0 -0
  524. /package/dist/cli-bundle/chunks/{chunk-H3EIEWGR.js.map → chunk-FL4D53ND.js.map} +0 -0
  525. /package/dist/cli-bundle/chunks/{chunk-WUJQK4YV.js.map → chunk-FVNWHUME.js.map} +0 -0
  526. /package/dist/cli-bundle/chunks/{chunk-INU6DKT5.js.map → chunk-FXFCFL73.js.map} +0 -0
  527. /package/dist/cli-bundle/chunks/{chunk-QEHQ2GVG.js.map → chunk-FY4RLHSC.js.map} +0 -0
  528. /package/dist/cli-bundle/chunks/{chunk-AHVTB5I5.js.map → chunk-G6MYGULG.js.map} +0 -0
  529. /package/dist/cli-bundle/chunks/{chunk-TSMHDIW4.js.map → chunk-GLZKZON6.js.map} +0 -0
  530. /package/dist/cli-bundle/chunks/{chunk-2JKGO6QX.js.map → chunk-H5IOT54C.js.map} +0 -0
  531. /package/dist/cli-bundle/chunks/{chunk-SELVXEZK.js.map → chunk-HO4DLBNK.js.map} +0 -0
  532. /package/dist/cli-bundle/chunks/{chunk-CRVF2JDM.js.map → chunk-HPAYDSR2.js.map} +0 -0
  533. /package/dist/cli-bundle/chunks/{chunk-3CLU2XZO.js.map → chunk-HSYV4ZYT.js.map} +0 -0
  534. /package/dist/cli-bundle/chunks/{chunk-J5AOEGDC.js.map → chunk-HYTOJW2Q.js.map} +0 -0
  535. /package/dist/cli-bundle/chunks/{chunk-NU3IMIEA.js.map → chunk-I7DIDUSP.js.map} +0 -0
  536. /package/dist/cli-bundle/chunks/{chunk-JYFOV7FC.js.map → chunk-IE5KRAKN.js.map} +0 -0
  537. /package/dist/cli-bundle/chunks/{chunk-YAROI3PD.js.map → chunk-IL5SPRMH.js.map} +0 -0
  538. /package/dist/cli-bundle/chunks/{chunk-UY2ACEMF.js.map → chunk-ILVOOAT4.js.map} +0 -0
  539. /package/dist/cli-bundle/chunks/{chunk-GOSLKLFE.js.map → chunk-KH6QAHME.js.map} +0 -0
  540. /package/dist/cli-bundle/chunks/{chunk-WQPUU7XD.js.map → chunk-L337QKWJ.js.map} +0 -0
  541. /package/dist/cli-bundle/chunks/{chunk-LSG2U345.js.map → chunk-L6FVNR7X.js.map} +0 -0
  542. /package/dist/cli-bundle/chunks/{chunk-FMBNM2EN.js.map → chunk-LSOWTLEM.js.map} +0 -0
  543. /package/dist/cli-bundle/chunks/{chunk-4223PVZT.js.map → chunk-M7MVOKVV.js.map} +0 -0
  544. /package/dist/cli-bundle/chunks/{chunk-3WM75PWC.js.map → chunk-N33FD2UI.js.map} +0 -0
  545. /package/dist/cli-bundle/chunks/{chunk-6S3YSUYG.js.map → chunk-NNANAWFH.js.map} +0 -0
  546. /package/dist/cli-bundle/chunks/{chunk-IJIICKVW.js.map → chunk-NTRQLE2R.js.map} +0 -0
  547. /package/dist/cli-bundle/chunks/{chunk-SDQLJWBO.js.map → chunk-NVZ6NVHJ.js.map} +0 -0
  548. /package/dist/cli-bundle/chunks/{chunk-H2Z3FYXQ.js.map → chunk-OWP6QFBV.js.map} +0 -0
  549. /package/dist/cli-bundle/chunks/{chunk-Q7A43DS4.js.map → chunk-P22HGFFI.js.map} +0 -0
  550. /package/dist/cli-bundle/chunks/{chunk-NVPZIJVR.js.map → chunk-PT7MCCGD.js.map} +0 -0
  551. /package/dist/cli-bundle/chunks/{chunk-J6EY5V4N.js.map → chunk-QRZNCRNA.js.map} +0 -0
  552. /package/dist/cli-bundle/chunks/{chunk-QIPLHNP7.js.map → chunk-QWBKN3QC.js.map} +0 -0
  553. /package/dist/cli-bundle/chunks/{chunk-7PIWCHTW.js.map → chunk-R5XTTZSJ.js.map} +0 -0
  554. /package/dist/cli-bundle/chunks/{chunk-JOUQZENX.js.map → chunk-RC4UOUXA.js.map} +0 -0
  555. /package/dist/cli-bundle/chunks/{chunk-BEP7WJA2.js.map → chunk-RGMWJLXF.js.map} +0 -0
  556. /package/dist/cli-bundle/chunks/{chunk-NP22ERDF.js.map → chunk-RTBX3C4C.js.map} +0 -0
  557. /package/dist/cli-bundle/chunks/{chunk-FNSPG7MU.js.map → chunk-RXPQ5Q23.js.map} +0 -0
  558. /package/dist/cli-bundle/chunks/{chunk-ULTHRDBP.js.map → chunk-TM5CIO3F.js.map} +0 -0
  559. /package/dist/cli-bundle/chunks/{chunk-UWQHLMEB.js.map → chunk-TZAE66GQ.js.map} +0 -0
  560. /package/dist/cli-bundle/chunks/{chunk-OW4JWD5M.js.map → chunk-VAHZIPWS.js.map} +0 -0
  561. /package/dist/cli-bundle/chunks/{chunk-DYH63FX7.js.map → chunk-VE6ZSTQW.js.map} +0 -0
  562. /package/dist/cli-bundle/chunks/{chunk-3AUGG2DP.js.map → chunk-W5E2UUSH.js.map} +0 -0
  563. /package/dist/cli-bundle/chunks/{chunk-UOHFKBUV.js.map → chunk-WL3SS45P.js.map} +0 -0
  564. /package/dist/cli-bundle/chunks/{chunk-QKJGPFAF.js.map → chunk-WU3KAN6A.js.map} +0 -0
  565. /package/dist/cli-bundle/chunks/{chunk-IA5FKNII.js.map → chunk-X2MGQMZO.js.map} +0 -0
  566. /package/dist/cli-bundle/chunks/{chunk-TD3LVC7D.js.map → chunk-X5YCTFKT.js.map} +0 -0
  567. /package/dist/cli-bundle/chunks/{chunk-B7PE22W6.js.map → chunk-XC2HEEOV.js.map} +0 -0
  568. /package/dist/cli-bundle/chunks/{chunk-K2X6U4UA.js.map → chunk-XXLXJL7V.js.map} +0 -0
  569. /package/dist/cli-bundle/chunks/{chunk-EACOH7AU.js.map → chunk-YIIIAKCE.js.map} +0 -0
  570. /package/dist/cli-bundle/chunks/{chunk-RLCHOOHC.js.map → chunk-YJSURTBB.js.map} +0 -0
  571. /package/dist/cli-bundle/chunks/{chunk-PGY23YTC.js.map → chunk-YKFHF37B.js.map} +0 -0
  572. /package/dist/cli-bundle/chunks/{chunk-EYLCSJAI.js.map → chunk-YQEZWI3R.js.map} +0 -0
  573. /package/dist/cli-bundle/chunks/{close-W6LI2PKM.js.map → close-GPD7DTJV.js.map} +0 -0
  574. /package/dist/cli-bundle/chunks/{close-CWODTPKG.js.map → close-X3CF6FQP.js.map} +0 -0
  575. /package/dist/cli-bundle/chunks/{close-many-CQFUY7MR.js.map → close-many-J7A5EHOQ.js.map} +0 -0
  576. /package/dist/cli-bundle/chunks/{close-many-DLDDVSH5.js.map → close-many-NQLYGPYW.js.map} +0 -0
  577. /package/dist/cli-bundle/chunks/{comments-E3TNTK24.js.map → comments-2AOZQ5D2.js.map} +0 -0
  578. /package/dist/cli-bundle/chunks/{comments-WGLHR7LB.js.map → comments-TMHMALA5.js.map} +0 -0
  579. /package/dist/cli-bundle/chunks/{copy-LXVDXH7B.js.map → copy-FWQA5OU4.js.map} +0 -0
  580. /package/dist/cli-bundle/chunks/{copy-Q5ZJPUKR.js.map → copy-N3LCQBMC.js.map} +0 -0
  581. /package/dist/cli-bundle/chunks/{create-LBVCYMEG.js.map → create-AQ5SIGZC.js.map} +0 -0
  582. /package/dist/cli-bundle/chunks/{create-J5U6ND4K.js.map → create-KOGQ3JKD.js.map} +0 -0
  583. /package/dist/cli-bundle/chunks/{delete-WNHB3LYW.js.map → delete-6G3MBZ6S.js.map} +0 -0
  584. /package/dist/cli-bundle/chunks/{delete-PMJBNY5G.js.map → delete-YYYFOSEA.js.map} +0 -0
  585. /package/dist/cli-bundle/chunks/{deps-JZ7TMVCB.js.map → deps-MQ4ZIGZB.js.map} +0 -0
  586. /package/dist/cli-bundle/chunks/{deps-OA26IS25.js.map → deps-NIIKXLPB.js.map} +0 -0
  587. /package/dist/cli-bundle/chunks/{docs-FEWB2DQB.js.map → docs-53NUGMIQ.js.map} +0 -0
  588. /package/dist/cli-bundle/chunks/{docs-HA2AIDBB.js.map → docs-OWRGDMNY.js.map} +0 -0
  589. /package/dist/cli-bundle/chunks/{files-EFIWKFTM.js.map → files-3PXGXYDB.js.map} +0 -0
  590. /package/dist/cli-bundle/chunks/{files-6YFBJRBG.js.map → files-EGLKHD7O.js.map} +0 -0
  591. /package/dist/cli-bundle/chunks/{focus-POIW5LTJ.js.map → focus-KZLIA6WS.js.map} +0 -0
  592. /package/dist/cli-bundle/chunks/{focus-4QJR7FOQ.js.map → focus-SRPASFTN.js.map} +0 -0
  593. /package/dist/cli-bundle/chunks/{history-compact-CKRPDTJN.js.map → history-compact-G4DULDCX.js.map} +0 -0
  594. /package/dist/cli-bundle/chunks/{history-compact-FWG2C7FZ.js.map → history-compact-HHIUOMZ7.js.map} +0 -0
  595. /package/dist/cli-bundle/chunks/{history-redact-BB3TGDAE.js.map → history-redact-IUSJ6X3E.js.map} +0 -0
  596. /package/dist/cli-bundle/chunks/{history-redact-D225BHOZ.js.map → history-redact-THHGRQXV.js.map} +0 -0
  597. /package/dist/cli-bundle/chunks/{history-repair-6GEAM7HE.js.map → history-repair-KG7SWXI6.js.map} +0 -0
  598. /package/dist/cli-bundle/chunks/{history-repair-RQXKQHL4.js.map → history-repair-LUQWRS7X.js.map} +0 -0
  599. /package/dist/cli-bundle/chunks/{learnings-JLNLCOL5.js.map → learnings-2MRNBFJF.js.map} +0 -0
  600. /package/dist/cli-bundle/chunks/{learnings-RSNLSWDC.js.map → learnings-ZVHSALJY.js.map} +0 -0
  601. /package/dist/cli-bundle/chunks/{notes-GB47XXQQ.js.map → notes-73JWKWUD.js.map} +0 -0
  602. /package/dist/cli-bundle/chunks/{notes-2WDH6DXU.js.map → notes-BAKUL5DJ.js.map} +0 -0
  603. /package/dist/cli-bundle/chunks/{plan-VDCJ2PCN.js.map → plan-AZPMCG37.js.map} +0 -0
  604. /package/dist/cli-bundle/chunks/{plan-DOVI2VMW.js.map → plan-LEAGLPGP.js.map} +0 -0
  605. /package/dist/cli-bundle/chunks/{profile-FAU7NZML.js.map → profile-AVCIIZID.js.map} +0 -0
  606. /package/dist/cli-bundle/chunks/{profile-IVXQEL3D.js.map → profile-LFYO3HHX.js.map} +0 -0
  607. /package/dist/cli-bundle/chunks/{register-operations-ZIBBRSED.js.map → register-operations-KHZYR6MG.js.map} +0 -0
  608. /package/dist/cli-bundle/chunks/{register-operations-ZUJ5JWPE.js.map → register-operations-WPQ2LWZJ.js.map} +0 -0
  609. /package/dist/cli-bundle/chunks/{register-setup-BCVLFEYS.js.map → register-setup-PGDNOXDQ.js.map} +0 -0
  610. /package/dist/cli-bundle/chunks/{register-setup-TDCGWIOS.js.map → register-setup-TDN7WAO6.js.map} +0 -0
  611. /package/dist/cli-bundle/chunks/{restore-25DLT2Q2.js.map → restore-E3PRGDN3.js.map} +0 -0
  612. /package/dist/cli-bundle/chunks/{restore-YPMVUUEX.js.map → restore-KIUYTAEJ.js.map} +0 -0
  613. /package/dist/cli-bundle/chunks/{schema-FNU3WE4O.js.map → schema-5JNFQFUW.js.map} +0 -0
  614. /package/dist/cli-bundle/chunks/{schema-NBCM3RAD.js.map → schema-TMIW4XZC.js.map} +0 -0
  615. /package/dist/cli-bundle/chunks/{update-XHSIAIXE.js.map → update-SQYZA3ZW.js.map} +0 -0
  616. /package/dist/cli-bundle/chunks/{update-WWBYOPXO.js.map → update-XZJYS5X7.js.map} +0 -0
  617. /package/dist/cli-bundle/chunks/{update-many-TA7NGQBO.js.map → update-many-R24B3GBK.js.map} +0 -0
  618. /package/dist/cli-bundle/chunks/{update-many-OUGIU5SF.js.map → update-many-WQ3R3J6N.js.map} +0 -0
  619. /package/dist/{cli/commands → sdk/query}/search-pagination.d.ts +0 -0
  620. /package/dist/{cli/commands → sdk/query}/search-rendering.d.ts +0 -0
@@ -1,6 +1,18 @@
1
+ import {
2
+ computeWorkspaceGraphFingerprint,
3
+ parseDirection,
4
+ parseKinds,
5
+ parseMaxDepth,
6
+ parsePositiveInteger,
7
+ workspaceGraphCache
8
+ } from "./chunk-3QDR6ZLU.js";
1
9
  import {
2
10
  collectStaleVectorizationIds
3
- } from "./chunk-E2OJMKML.js";
11
+ } from "./chunk-OGVTB5VO.js";
12
+ import {
13
+ assembleWorkspaceRelationshipGraph,
14
+ createRelationshipKindRegistry
15
+ } from "./chunk-3CUQZNQ6.js";
4
16
  import {
5
17
  buildListQueryFilters
6
18
  } from "./chunk-KWYX6ZIR.js";
@@ -19,28 +31,28 @@ import {
19
31
  resolveContentFieldFilters,
20
32
  resolveMissingMetadataFilters,
21
33
  runList
22
- } from "./chunk-XXXF6PAQ.js";
34
+ } from "./chunk-AXRT7K5V.js";
23
35
  import {
24
36
  createQueryFingerprint,
25
37
  paginateQueryRows
26
- } from "./chunk-4223PVZT.js";
38
+ } from "./chunk-M7MVOKVV.js";
27
39
  import {
28
40
  getItemAt
29
- } from "./chunk-3U7ZR6M4.js";
41
+ } from "./chunk-B57RJHBZ.js";
30
42
  import {
31
43
  hasMissingMetadataFilter,
32
44
  itemMatchesMissingMetadata,
33
45
  lifecycleClassifierFromStatusRegistry
34
- } from "./chunk-IJIICKVW.js";
46
+ } from "./chunk-NTRQLE2R.js";
35
47
  import {
36
48
  readHistoryEntries
37
- } from "./chunk-TD3LVC7D.js";
49
+ } from "./chunk-X5YCTFKT.js";
38
50
  import {
39
51
  parseLimit
40
- } from "./chunk-NU3IMIEA.js";
52
+ } from "./chunk-I7DIDUSP.js";
41
53
  import {
42
54
  recordContextUsageTouches
43
- } from "./chunk-YCQET3OT.js";
55
+ } from "./chunk-BAP7G3N2.js";
44
56
  import {
45
57
  resolveRegisteredSearchProvider,
46
58
  resolveRegisteredVectorStoreAdapter
@@ -57,7 +69,10 @@ import {
57
69
  resolveSearchCorpusFields,
58
70
  resolveSettingsWithSemanticRuntimeDefaults,
59
71
  resolveVectorStores
60
- } from "./chunk-7B67ZL4N.js";
72
+ } from "./chunk-7R6UIHYY.js";
73
+ import {
74
+ GRAPH_SUBCOMMAND_VALUES
75
+ } from "./chunk-WQXRZMFN.js";
61
76
  import {
62
77
  splitCommaList
63
78
  } from "./chunk-D6HZN36B.js";
@@ -79,7 +94,7 @@ import {
79
94
  resolveIsoOrRelative,
80
95
  runActiveOnReadHooks,
81
96
  toItemRecord
82
- } from "./chunk-XSJUSQAE.js";
97
+ } from "./chunk-646MQXFW.js";
83
98
  import {
84
99
  EXIT_CODE,
85
100
  ITEM_METADATA_KEY_ORDER,
@@ -100,7 +115,7 @@ import {
100
115
  resolveRuntimeStatusRegistry,
101
116
  toNonEmptyString,
102
117
  toNonEmptyStringOrUndefined
103
- } from "./chunk-BSEQUTQP.js";
118
+ } from "./chunk-WACRQ26A.js";
104
119
 
105
120
  // dist/cli/commands/aggregate.js
106
121
  !(function() {
@@ -451,7 +466,7 @@ async function runAggregate(options, global2) {
451
466
  };
452
467
  }
453
468
 
454
- // dist/cli/commands/search.js
469
+ // dist/sdk/query/search.js
455
470
  import fs from "node:fs/promises";
456
471
  import path from "node:path";
457
472
 
@@ -794,11 +809,11 @@ function resolveBm25Params(settings) {
794
809
  };
795
810
  }
796
811
 
797
- // dist/cli/commands/search-rendering.js
812
+ // dist/sdk/query/search-rendering.js
798
813
  !(function() {
799
814
  try {
800
815
  var e = "undefined" != typeof window ? window : "undefined" != typeof global ? global : "undefined" != typeof globalThis ? globalThis : "undefined" != typeof self ? self : {}, n = new e.Error().stack;
801
- n && (e._sentryDebugIds = e._sentryDebugIds || {}, e._sentryDebugIds[n] = "4445c28d-0c05-583a-8b92-9dbe60e8b467");
816
+ n && (e._sentryDebugIds = e._sentryDebugIds || {}, e._sentryDebugIds[n] = "b1092f14-e16e-5d4e-b92b-3456083b1438");
802
817
  } catch (e2) {
803
818
  }
804
819
  })();
@@ -891,11 +906,11 @@ function buildVerboseSearchFilters(params) {
891
906
  };
892
907
  }
893
908
 
894
- // dist/cli/commands/search-pagination.js
909
+ // dist/sdk/query/search-pagination.js
895
910
  !(function() {
896
911
  try {
897
912
  var e = "undefined" != typeof window ? window : "undefined" != typeof global ? global : "undefined" != typeof globalThis ? globalThis : "undefined" != typeof self ? self : {}, n = new e.Error().stack;
898
- n && (e._sentryDebugIds = e._sentryDebugIds || {}, e._sentryDebugIds[n] = "39599b41-97b7-53e2-9318-db5e3724bf2e");
913
+ n && (e._sentryDebugIds = e._sentryDebugIds || {}, e._sentryDebugIds[n] = "6da6518b-1686-5bf3-8444-a9f48dc4f407");
899
914
  } catch (e2) {
900
915
  }
901
916
  })();
@@ -933,11 +948,11 @@ function resolveSearchPage(options) {
933
948
  };
934
949
  }
935
950
 
936
- // dist/cli/commands/search.js
951
+ // dist/sdk/query/search.js
937
952
  !(function() {
938
953
  try {
939
954
  var e = "undefined" != typeof window ? window : "undefined" != typeof global ? global : "undefined" != typeof globalThis ? globalThis : "undefined" != typeof self ? self : {}, n = new e.Error().stack;
940
- n && (e._sentryDebugIds = e._sentryDebugIds || {}, e._sentryDebugIds[n] = "c6c363b7-9d2f-5a6b-8cc9-ab0a8db6c495");
955
+ n && (e._sentryDebugIds = e._sentryDebugIds || {}, e._sentryDebugIds[n] = "7d6721eb-1e28-58ea-a5fc-4494f249275c");
941
956
  } catch (e2) {
942
957
  }
943
958
  })();
@@ -1530,6 +1545,7 @@ function highlightFieldSnippet(text, tokens) {
1530
1545
  }
1531
1546
  const lowerText = text.toLowerCase();
1532
1547
  let firstMatchIndex = -1;
1548
+ let firstMatchLength = 0;
1533
1549
  for (const token of tokens) {
1534
1550
  if (token.length === 0) {
1535
1551
  continue;
@@ -1537,13 +1553,14 @@ function highlightFieldSnippet(text, tokens) {
1537
1553
  const index = lowerText.indexOf(token);
1538
1554
  if (index >= 0 && (firstMatchIndex < 0 || index < firstMatchIndex)) {
1539
1555
  firstMatchIndex = index;
1556
+ firstMatchLength = token.length;
1540
1557
  }
1541
1558
  }
1542
1559
  if (firstMatchIndex < 0) {
1543
1560
  return null;
1544
1561
  }
1545
1562
  const windowStart = Math.max(0, firstMatchIndex - HIGHLIGHT_SNIPPET_RADIUS);
1546
- const windowEnd = Math.min(text.length, firstMatchIndex + HIGHLIGHT_SNIPPET_RADIUS);
1563
+ const windowEnd = Math.min(text.length, firstMatchIndex + firstMatchLength + HIGHLIGHT_SNIPPET_RADIUS);
1547
1564
  const marked = markTokenRuns(text.slice(windowStart, windowEnd), tokens);
1548
1565
  const prefix = windowStart > 0 ? "\u2026" : "";
1549
1566
  const suffix = windowEnd < text.length ? "\u2026" : "";
@@ -2316,7 +2333,7 @@ function readSearchFieldValue(hit, field) {
2316
2333
  }
2317
2334
  function projectSearchHits(hits, projection) {
2318
2335
  if (projection.mode === "full") {
2319
- return hits.map(({ matched_all_terms: _matchedAllTerms, ...hit }) => hit);
2336
+ return hits.map(({ matched_all_terms: _matchedAllTerms, exact_id_match: _exactIdMatch, ...hit }) => hit);
2320
2337
  }
2321
2338
  return hits.map((hit) => {
2322
2339
  const projected = {};
@@ -2715,7 +2732,7 @@ async function runSearch(rawQuery, rawOptions, global2) {
2715
2732
  warnings,
2716
2733
  runtimeFieldFilters: runtime.runtimeFieldFilters
2717
2734
  };
2718
- if (runtime.effectiveMode === "keyword" && (corpus.filteredDocuments.length === 0 || prepared.limit === 0)) {
2735
+ if (runtime.effectiveMode === "keyword" && (corpus.filteredDocuments.length === 0 || prepared.limit === 0 && !prepared.countOnly)) {
2719
2736
  return buildEmptySearchResultFromContext({ ...responseBase, effectiveMode: runtime.effectiveMode }, prepared.countOnly);
2720
2737
  }
2721
2738
  const keywordHits = await computeKeywordSearchHits(prepared, runtime, corpus.filteredDocuments);
@@ -2727,7 +2744,7 @@ async function runSearch(rawQuery, rawOptions, global2) {
2727
2744
  warnings,
2728
2745
  modeWasExplicit: prepared.modeWasExplicit
2729
2746
  });
2730
- if (modeResult.effectiveMode !== "keyword" && modeResult.hits.length === 0 && (corpus.filteredDocuments.length === 0 || prepared.limit === 0)) {
2747
+ if (modeResult.effectiveMode !== "keyword" && modeResult.hits.length === 0 && (corpus.filteredDocuments.length === 0 || prepared.limit === 0 && !prepared.countOnly)) {
2731
2748
  return buildEmptySearchResultFromContext({ ...responseBase, effectiveMode: modeResult.effectiveMode }, prepared.countOnly);
2732
2749
  }
2733
2750
  const thresholded = modeResult.hits.filter((entry) => entry.exact_id_match === true || entry.score >= runtime.scoreThreshold);
@@ -2749,7 +2766,7 @@ async function runSearch(rawQuery, rawOptions, global2) {
2749
2766
  return buildSearchResultForHits(response, projectedItems, total, page.limited.length, effectiveProjection, page.pageExtras);
2750
2767
  }
2751
2768
 
2752
- // dist/cli/commands/eval.js
2769
+ // dist/sdk/eval.js
2753
2770
  import fs2 from "node:fs/promises";
2754
2771
  import path2 from "node:path";
2755
2772
 
@@ -2896,11 +2913,11 @@ function parseEvalQuerySet(raw) {
2896
2913
  };
2897
2914
  }
2898
2915
 
2899
- // dist/cli/commands/eval.js
2916
+ // dist/sdk/eval.js
2900
2917
  !(function() {
2901
2918
  try {
2902
2919
  var e = "undefined" != typeof window ? window : "undefined" != typeof global ? global : "undefined" != typeof globalThis ? globalThis : "undefined" != typeof self ? self : {}, n = new e.Error().stack;
2903
- n && (e._sentryDebugIds = e._sentryDebugIds || {}, e._sentryDebugIds[n] = "bf3ddf99-3338-5cfc-a1f0-3d4bb15877da");
2920
+ n && (e._sentryDebugIds = e._sentryDebugIds || {}, e._sentryDebugIds[n] = "57d5033f-647c-5813-8294-33096b5e090e");
2904
2921
  } catch (e2) {
2905
2922
  }
2906
2923
  })();
@@ -2910,7 +2927,7 @@ var VALID_EVAL_MODES2 = /* @__PURE__ */ new Set([
2910
2927
  "semantic",
2911
2928
  "hybrid"
2912
2929
  ]);
2913
- function parseEvalMode(raw) {
2930
+ var parseEvalMode = (raw) => {
2914
2931
  if (raw === void 0) {
2915
2932
  return "keyword";
2916
2933
  }
@@ -2919,8 +2936,8 @@ function parseEvalMode(raw) {
2919
2936
  throw new PmCliError("Eval --mode must be one of keyword|semantic|hybrid", EXIT_CODE.USAGE);
2920
2937
  }
2921
2938
  return normalized;
2922
- }
2923
- function parseEvalK(raw) {
2939
+ };
2940
+ var parseEvalK = (raw) => {
2924
2941
  if (raw === void 0 || raw === "") {
2925
2942
  return DEFAULT_EVAL_K;
2926
2943
  }
@@ -2929,28 +2946,31 @@ function parseEvalK(raw) {
2929
2946
  throw new PmCliError("Eval --k must be a positive integer", EXIT_CODE.USAGE);
2930
2947
  }
2931
2948
  return parsed;
2932
- }
2933
- function parseFailUnder(raw) {
2949
+ };
2950
+ var parseFailUnder = (raw) => {
2934
2951
  if (raw === void 0 || raw === "") {
2935
2952
  return void 0;
2936
2953
  }
2937
- const parsed = typeof raw === "number" ? raw : Number(String(raw).trim());
2938
- if (!Number.isFinite(parsed) || parsed < 0 || parsed > 1) {
2954
+ const normalized = String(raw).trim();
2955
+ const parsed = Number(normalized);
2956
+ if ([
2957
+ normalized.length === 0,
2958
+ !Number.isFinite(parsed),
2959
+ parsed < 0,
2960
+ parsed > 1
2961
+ ].includes(true)) {
2939
2962
  throw new PmCliError("Eval --fail-under must be a number in the range [0, 1]", EXIT_CODE.USAGE);
2940
2963
  }
2941
2964
  return parsed;
2942
- }
2943
- function roundMetric(value) {
2944
- return Math.round(value * 1e4) / 1e4;
2945
- }
2946
- async function loadEvalQuerySet(queriesPath) {
2947
- let raw;
2965
+ };
2966
+ var roundMetric = (value) => Math.round(value * 1e4) / 1e4;
2967
+ var readEvalQuerySetFile = async (queriesPath) => {
2948
2968
  try {
2949
- raw = await fs2.readFile(queriesPath, "utf8");
2969
+ return await fs2.readFile(queriesPath, "utf8");
2950
2970
  } catch {
2951
2971
  throw new PmCliError(`Eval query set not found at ${queriesPath}`, EXIT_CODE.NOT_FOUND, {
2952
2972
  examples: [
2953
- `echo '[{"query":"offline search","relevant_ids":["pm-75k9"]}]' > ` + queriesPath,
2973
+ `echo '[{"query":"offline search","relevant_ids":["pm-75k9"]}]' > ${queriesPath}`,
2954
2974
  "pm eval --queries ./my-eval.json"
2955
2975
  ],
2956
2976
  nextSteps: [
@@ -2958,37 +2978,39 @@ async function loadEvalQuerySet(queriesPath) {
2958
2978
  ]
2959
2979
  });
2960
2980
  }
2961
- let parsed;
2981
+ };
2982
+ var parseEvalQuerySetJson = (raw, queriesPath) => {
2962
2983
  try {
2963
- parsed = JSON.parse(raw);
2984
+ return JSON.parse(raw);
2964
2985
  } catch (error) {
2965
- throw new PmCliError(`Eval query set at ${queriesPath} is not valid JSON: ${error.message}`, EXIT_CODE.USAGE);
2986
+ throw new PmCliError(
2987
+ /* c8 ignore next -- JSON.parse throws Error instances; String fallback protects nonstandard hosts. */
2988
+ `Eval query set at ${queriesPath} is not valid JSON: ${error instanceof Error ? error.message : String(error)}`,
2989
+ EXIT_CODE.USAGE
2990
+ );
2966
2991
  }
2992
+ };
2993
+ var validateEvalQuerySet = (parsed) => {
2967
2994
  try {
2968
2995
  return parseEvalQuerySet(parsed);
2969
2996
  } catch (error) {
2970
- throw new PmCliError(error.message, EXIT_CODE.USAGE);
2971
- }
2972
- }
2973
- async function runEval(options, global2) {
2974
- const pmRoot = resolvePmRoot(process.cwd(), global2.path);
2975
- if (!await pathExists(getSettingsPath(pmRoot))) {
2976
- throw new PmCliError(`Tracker is not initialized at ${pmRoot}. Run pm init first.`, EXIT_CODE.NOT_FOUND);
2997
+ throw new PmCliError(
2998
+ /* c8 ignore next -- parseEvalQuerySet throws Error instances; String fallback protects nonstandard hosts. */
2999
+ error instanceof Error ? error.message : String(error),
3000
+ EXIT_CODE.USAGE
3001
+ );
2977
3002
  }
2978
- const k = parseEvalK(options.k);
2979
- const defaultMode = parseEvalMode(options.mode);
2980
- const failUnder = parseFailUnder(options.failUnder);
2981
- const queriesPath = options.queries ? path2.resolve(process.cwd(), options.queries) : path2.join(pmRoot, DEFAULT_EVAL_QUERIES_RELATIVE_PATH);
2982
- const querySet = await loadEvalQuerySet(queriesPath);
2983
- const reports = [];
2984
- const rawMetrics = [];
2985
- for (const evalQuery of querySet.queries) {
2986
- const mode = evalQuery.mode ?? defaultMode;
2987
- const searchResult = await runSearch(evalQuery.query, { mode, limit: String(k), fields: "id" }, global2);
2988
- const rankedIds = searchResult.items.map((item) => item.id).filter((id) => typeof id === "string");
2989
- const metrics = evaluateRanking(rankedIds, new Set(evalQuery.relevant_ids), k);
2990
- rawMetrics.push(metrics);
2991
- reports.push({
3003
+ };
3004
+ var loadEvalQuerySet = async (queriesPath) => validateEvalQuerySet(parseEvalQuerySetJson(await readEvalQuerySetFile(queriesPath), queriesPath));
3005
+ var resolveEvalQueriesPath = (pmRoot, queries) => queries ? path2.resolve(process.cwd(), queries) : path2.join(pmRoot, DEFAULT_EVAL_QUERIES_RELATIVE_PATH);
3006
+ var evaluateEvalQuery = async (evalQuery, defaultMode, k, global2) => {
3007
+ const mode = evalQuery.mode ?? defaultMode;
3008
+ const searchResult = await runSearch(evalQuery.query, { mode, limit: String(k), fields: "id" }, global2);
3009
+ const rankedIds = searchResult.items.map((item) => item.id).filter((id) => typeof id === "string");
3010
+ const metrics = evaluateRanking(rankedIds, new Set(evalQuery.relevant_ids), k);
3011
+ return {
3012
+ metrics,
3013
+ report: {
2992
3014
  query: evalQuery.query,
2993
3015
  mode,
2994
3016
  relevant_total: metrics.relevant_total,
@@ -2997,13 +3019,14 @@ async function runEval(options, global2) {
2997
3019
  mrr: roundMetric(metrics.mrr),
2998
3020
  precision: roundMetric(metrics.precision),
2999
3021
  recall: roundMetric(metrics.recall)
3000
- });
3001
- }
3022
+ }
3023
+ };
3024
+ };
3025
+ var buildEvalResult = (k, reports, rawMetrics, failUnder) => {
3002
3026
  const aggregate = aggregateEvalMetrics(rawMetrics);
3003
- const passed = failUnder === void 0 || aggregate.ndcg >= failUnder;
3004
3027
  return {
3005
3028
  k,
3006
- query_count: querySet.queries.length,
3029
+ query_count: reports.length,
3007
3030
  aggregate: {
3008
3031
  ndcg: roundMetric(aggregate.ndcg),
3009
3032
  mrr: roundMetric(aggregate.mrr),
@@ -3012,9 +3035,37 @@ async function runEval(options, global2) {
3012
3035
  },
3013
3036
  queries: reports,
3014
3037
  ...failUnder !== void 0 ? { fail_under: failUnder } : {},
3015
- passed
3038
+ passed: failUnder === void 0 || aggregate.ndcg >= failUnder
3016
3039
  };
3017
- }
3040
+ };
3041
+ var runEval = async (options, global2) => {
3042
+ const pmRoot = resolvePmRoot(process.cwd(), global2.path);
3043
+ if (!await pathExists(getSettingsPath(pmRoot))) {
3044
+ throw new PmCliError(`Tracker is not initialized at ${pmRoot}. Run pm init first.`, EXIT_CODE.NOT_FOUND);
3045
+ }
3046
+ const k = parseEvalK(options.k);
3047
+ const defaultMode = parseEvalMode(options.mode);
3048
+ const failUnder = parseFailUnder(options.failUnder);
3049
+ const queriesPath = resolveEvalQueriesPath(pmRoot, options.queries);
3050
+ const querySet = await loadEvalQuerySet(queriesPath);
3051
+ const reports = [];
3052
+ const rawMetrics = [];
3053
+ for (const evalQuery of querySet.queries) {
3054
+ const { report, metrics } = await evaluateEvalQuery(evalQuery, defaultMode, k, global2);
3055
+ rawMetrics.push(metrics);
3056
+ reports.push(report);
3057
+ }
3058
+ return buildEvalResult(k, reports, rawMetrics, failUnder);
3059
+ };
3060
+
3061
+ // dist/cli/commands/eval.js
3062
+ !(function() {
3063
+ try {
3064
+ var e = "undefined" != typeof window ? window : "undefined" != typeof global ? global : "undefined" != typeof globalThis ? globalThis : "undefined" != typeof self ? self : {}, n = new e.Error().stack;
3065
+ n && (e._sentryDebugIds = e._sentryDebugIds || {}, e._sentryDebugIds[n] = "6282863e-edcf-5259-9c0e-ec8d5923e98c");
3066
+ } catch (e2) {
3067
+ }
3068
+ })();
3018
3069
 
3019
3070
  // dist/sdk/item-children.js
3020
3071
  !(function() {
@@ -3424,15 +3475,1714 @@ async function runGet(id, global2, options = {}) {
3424
3475
  return result;
3425
3476
  }
3426
3477
 
3478
+ // dist/sdk/relationship-analytics.js
3479
+ !(function() {
3480
+ try {
3481
+ var e = "undefined" != typeof window ? window : "undefined" != typeof global ? global : "undefined" != typeof globalThis ? globalThis : "undefined" != typeof self ? self : {}, n = new e.Error().stack;
3482
+ n && (e._sentryDebugIds = e._sentryDebugIds || {}, e._sentryDebugIds[n] = "0a54b889-6d5c-565c-85ff-47e5cce68a32");
3483
+ } catch (e2) {
3484
+ }
3485
+ })();
3486
+ function appendNeighbor(adjacency, source, target) {
3487
+ adjacency.get(source).add(target);
3488
+ }
3489
+ function createAdjacency(nodes) {
3490
+ return new Map(nodes.map((node) => [node, /* @__PURE__ */ new Set()]));
3491
+ }
3492
+ function sortComponents(components) {
3493
+ for (const component of components)
3494
+ component.sort();
3495
+ return components.sort((left, right) => right.length - left.length || left[0].localeCompare(right[0]));
3496
+ }
3497
+ function stableJsonValue(value) {
3498
+ if (Array.isArray(value))
3499
+ return value.map((entry) => stableJsonValue(entry));
3500
+ if (value === null || typeof value !== "object")
3501
+ return value;
3502
+ const toJSON = value.toJSON;
3503
+ if (typeof toJSON === "function")
3504
+ return stableJsonValue(toJSON.call(value));
3505
+ return Object.fromEntries(Object.entries(value).sort(([left], [right]) => left.localeCompare(right)).map(([key, entry]) => [key, stableJsonValue(entry)]));
3506
+ }
3507
+ function relationshipEdgeKey(edge) {
3508
+ return JSON.stringify(stableJsonValue(edge));
3509
+ }
3510
+ function appendFinishingOrder(start, adjacency, visited, order) {
3511
+ const stack = [{ id: start, expanded: false }];
3512
+ while (stack.length > 0) {
3513
+ const current = stack.pop();
3514
+ if (current.expanded) {
3515
+ order.push(current.id);
3516
+ continue;
3517
+ }
3518
+ if (visited.has(current.id))
3519
+ continue;
3520
+ visited.add(current.id);
3521
+ stack.push({ id: current.id, expanded: true });
3522
+ const neighbors = [...adjacency.get(current.id)].sort().reverse();
3523
+ for (const neighbor of neighbors)
3524
+ if (!visited.has(neighbor))
3525
+ stack.push({ id: neighbor, expanded: false });
3526
+ }
3527
+ }
3528
+ function computeFinishingOrder(nodes, adjacency) {
3529
+ const visited = /* @__PURE__ */ new Set();
3530
+ const order = [];
3531
+ for (const start of nodes)
3532
+ if (!visited.has(start))
3533
+ appendFinishingOrder(start, adjacency, visited, order);
3534
+ return order;
3535
+ }
3536
+ function collectReverseComponents(order, reverse) {
3537
+ const visited = /* @__PURE__ */ new Set();
3538
+ const components = [];
3539
+ for (const start of [...order].reverse()) {
3540
+ if (visited.has(start))
3541
+ continue;
3542
+ const component = [];
3543
+ const stack = [start];
3544
+ visited.add(start);
3545
+ while (stack.length > 0) {
3546
+ const current = stack.pop();
3547
+ component.push(current);
3548
+ for (const neighbor of reverse.get(current)) {
3549
+ if (visited.has(neighbor))
3550
+ continue;
3551
+ visited.add(neighbor);
3552
+ stack.push(neighbor);
3553
+ }
3554
+ }
3555
+ components.push(component);
3556
+ }
3557
+ return sortComponents(components);
3558
+ }
3559
+ function stronglyConnectedComponents(nodes, adjacency) {
3560
+ const reverse = createAdjacency(nodes);
3561
+ for (const [source, targets] of adjacency)
3562
+ for (const target of targets)
3563
+ appendNeighbor(reverse, target, source);
3564
+ return collectReverseComponents(computeFinishingOrder(nodes, adjacency), reverse);
3565
+ }
3566
+ function buildExecutionAdjacency(graph, registry) {
3567
+ const adjacency = createAdjacency(graph.nodes());
3568
+ for (const edge of graph.edges()) {
3569
+ const definition = registry.require(edge.kind);
3570
+ if (!definition.ordering)
3571
+ continue;
3572
+ const sourceFirst = (definition.precedence ?? "source_before_target") === "source_before_target";
3573
+ appendNeighbor(adjacency, sourceFirst ? edge.source : edge.target, sourceFirst ? edge.target : edge.source);
3574
+ }
3575
+ return adjacency;
3576
+ }
3577
+ function topologicalLayers(nodes, adjacency) {
3578
+ const indegree = new Map(nodes.map((node) => [node, 0]));
3579
+ for (const targets of adjacency.values())
3580
+ for (const target of targets)
3581
+ indegree.set(target, indegree.get(target) + 1);
3582
+ let frontier = nodes.filter((node) => indegree.get(node) === 0).sort();
3583
+ const layers = [];
3584
+ while (frontier.length > 0) {
3585
+ layers.push(frontier);
3586
+ const next = [];
3587
+ for (const source of frontier) {
3588
+ for (const target of adjacency.get(source)) {
3589
+ const remaining = indegree.get(target) - 1;
3590
+ indegree.set(target, remaining);
3591
+ if (remaining === 0)
3592
+ next.push(target);
3593
+ }
3594
+ }
3595
+ frontier = next.sort();
3596
+ }
3597
+ return layers;
3598
+ }
3599
+ function longestPath(order, adjacency) {
3600
+ const depth = new Map(order.map((node) => [node, 0]));
3601
+ const parent = /* @__PURE__ */ new Map();
3602
+ for (const source of order) {
3603
+ for (const target of adjacency.get(source)) {
3604
+ if (!depth.has(target))
3605
+ continue;
3606
+ const candidate = depth.get(source) + 1;
3607
+ const currentParent = parent.get(target);
3608
+ if (candidate > depth.get(target) || candidate === depth.get(target) && (currentParent === void 0 || source.localeCompare(currentParent) < 0)) {
3609
+ depth.set(target, candidate);
3610
+ parent.set(target, source);
3611
+ }
3612
+ }
3613
+ }
3614
+ const end = [...order].sort((left, right) => depth.get(right) - depth.get(left) || left.localeCompare(right))[0];
3615
+ const path3 = end === void 0 ? [] : [end];
3616
+ while (path3[0] !== void 0 && parent.has(path3[0]))
3617
+ path3.unshift(parent.get(path3[0]));
3618
+ return { depth: Object.fromEntries(depth), path: path3 };
3619
+ }
3620
+ function reconstructImpactPath(root, target, parents) {
3621
+ const path3 = [target];
3622
+ let cursor = target;
3623
+ while (cursor !== root) {
3624
+ cursor = parents.get(cursor);
3625
+ path3.push(cursor);
3626
+ }
3627
+ return path3.reverse();
3628
+ }
3629
+ function analyzeRelationshipExecution(graph, options = {}) {
3630
+ const registry = options.registry ?? createRelationshipKindRegistry();
3631
+ const nodes = [...graph.nodes()];
3632
+ const adjacency = buildExecutionAdjacency(graph, registry);
3633
+ const layers = topologicalLayers(nodes, adjacency);
3634
+ const order = layers.flat();
3635
+ const acyclic = order.length === nodes.length;
3636
+ const cycles = acyclic ? [] : stronglyConnectedComponents(nodes, adjacency).filter((component) => component.length > 1 || adjacency.get(component[0]).has(component[0]));
3637
+ const longest = longestPath(order, adjacency);
3638
+ return {
3639
+ exact: true,
3640
+ acyclic,
3641
+ order,
3642
+ layers,
3643
+ frontier: layers[0] ?? [],
3644
+ depth: longest.depth,
3645
+ criticalPath: longest.path,
3646
+ criticalPathLength: Math.max(0, longest.path.length - 1),
3647
+ cycles,
3648
+ provenance: { algorithm: "kahn-longest-path", edgeFamily: "ordering" }
3649
+ };
3650
+ }
3651
+ function analyzeGraphImpact(graph, root, options = {}) {
3652
+ const direction = options.direction ?? "outgoing";
3653
+ const maxDepth = options.maxDepth ?? Number.POSITIVE_INFINITY;
3654
+ const limit = options.limit ?? Number.POSITIVE_INFINITY;
3655
+ const queue = [{ id: root, depth: 0 }];
3656
+ const seen = /* @__PURE__ */ new Set([root]);
3657
+ const parents = /* @__PURE__ */ new Map();
3658
+ const affected = [];
3659
+ let visitedNodes = 0;
3660
+ let inspectedEdges = 0;
3661
+ let truncated = false;
3662
+ traversal: for (let index = 0; index < queue.length; index += 1) {
3663
+ options.signal?.throwIfAborted();
3664
+ const current = queue[index];
3665
+ visitedNodes += 1;
3666
+ const adjacent = graph.adjacency(current.id, {
3667
+ direction,
3668
+ kinds: options.kinds,
3669
+ signal: options.signal
3670
+ });
3671
+ inspectedEdges += adjacent.meta.inspectedEdges;
3672
+ if (current.depth >= maxDepth) {
3673
+ if (adjacent.value.some((id) => !seen.has(id)))
3674
+ truncated = true;
3675
+ continue;
3676
+ }
3677
+ for (const id of adjacent.value) {
3678
+ if (seen.has(id))
3679
+ continue;
3680
+ if (affected.length >= limit) {
3681
+ truncated = true;
3682
+ break traversal;
3683
+ }
3684
+ seen.add(id);
3685
+ parents.set(id, current.id);
3686
+ const depth = current.depth + 1;
3687
+ affected.push({
3688
+ id,
3689
+ distance: depth,
3690
+ path: reconstructImpactPath(root, id, parents)
3691
+ });
3692
+ queue.push({ id, depth });
3693
+ }
3694
+ }
3695
+ return {
3696
+ root,
3697
+ affected,
3698
+ exact: true,
3699
+ truncated,
3700
+ cost: { visitedNodes, inspectedEdges }
3701
+ };
3702
+ }
3703
+ function analyzeKnowledgeGraph(graph) {
3704
+ const nodes = [...graph.nodes()];
3705
+ const weak = createAdjacency(nodes);
3706
+ const directed = createAdjacency(nodes);
3707
+ for (const edge of graph.edges()) {
3708
+ appendNeighbor(weak, edge.source, edge.target);
3709
+ appendNeighbor(weak, edge.target, edge.source);
3710
+ appendNeighbor(directed, edge.source, edge.target);
3711
+ }
3712
+ const components = [];
3713
+ const visited = /* @__PURE__ */ new Set();
3714
+ for (const start of nodes) {
3715
+ if (visited.has(start))
3716
+ continue;
3717
+ const component = [];
3718
+ const stack = [start];
3719
+ visited.add(start);
3720
+ while (stack.length > 0) {
3721
+ const current = stack.pop();
3722
+ component.push(current);
3723
+ for (const neighbor of weak.get(current)) {
3724
+ if (visited.has(neighbor))
3725
+ continue;
3726
+ visited.add(neighbor);
3727
+ stack.push(neighbor);
3728
+ }
3729
+ }
3730
+ components.push(component);
3731
+ }
3732
+ const degrees = nodes.map((id) => ({ id, degree: weak.get(id).size }));
3733
+ const maximum = Math.max(0, ...degrees.map(({ degree }) => degree));
3734
+ return {
3735
+ components: sortComponents(components),
3736
+ stronglyConnected: stronglyConnectedComponents(nodes, directed),
3737
+ orphans: degrees.filter(({ degree }) => degree === 0).map(({ id }) => id),
3738
+ hubs: degrees.filter(({ degree }) => degree > 0 && degree === maximum),
3739
+ exact: true,
3740
+ provenance: { algorithm: "component-degree", edgeFamily: "all" }
3741
+ };
3742
+ }
3743
+ function compareRelationshipSnapshots(before, after) {
3744
+ const earlier = new Map(before.edges.map((edge) => [relationshipEdgeKey(edge), edge]));
3745
+ const later = new Map(after.edges.map((edge) => [relationshipEdgeKey(edge), edge]));
3746
+ return {
3747
+ fromVersion: before.version,
3748
+ toVersion: after.version,
3749
+ added: [...later].filter(([key]) => !earlier.has(key)).map(([, edge]) => edge),
3750
+ removed: [...earlier].filter(([key]) => !later.has(key)).map(([, edge]) => edge),
3751
+ unchangedCount: [...earlier.keys()].filter((key) => later.has(key)).length,
3752
+ exact: true
3753
+ };
3754
+ }
3755
+
3756
+ // dist/sdk/graph/traversal.js
3757
+ !(function() {
3758
+ try {
3759
+ var e = "undefined" != typeof window ? window : "undefined" != typeof global ? global : "undefined" != typeof globalThis ? globalThis : "undefined" != typeof self ? self : {}, n = new e.Error().stack;
3760
+ n && (e._sentryDebugIds = e._sentryDebugIds || {}, e._sentryDebugIds[n] = "ed9f0831-6011-5ee2-abd6-72375eac0a3a");
3761
+ } catch (e2) {
3762
+ }
3763
+ })();
3764
+ var DEFAULT_MAX_PATHS = 5;
3765
+ var DEFAULT_MAX_VISITED_PATHS = 1e4;
3766
+ var DEFAULT_PATH_MAX_DEPTH = 8;
3767
+ function assertPathBound(name, value) {
3768
+ if (!Number.isFinite(value) || !Number.isInteger(value) || value < 0)
3769
+ throw new TypeError(`Invalid path ${name} bound: ${String(value)}`);
3770
+ }
3771
+ function hierarchyParentEndpoint(edge, definition) {
3772
+ return definition.hierarchyDirection === "target_parent" ? edge.target : edge.source;
3773
+ }
3774
+ function orderingPredecessorEndpoint(edge, definition) {
3775
+ return (definition.precedence ?? "source_before_target") === "target_before_source" ? edge.target : edge.source;
3776
+ }
3777
+ function resolveFamilyKinds(graph, kinds, family) {
3778
+ if (kinds === void 0)
3779
+ return void 0;
3780
+ const registry = graph.registry();
3781
+ const resolved = /* @__PURE__ */ new Set();
3782
+ for (const kind of kinds) {
3783
+ const definition = registry.require(kind);
3784
+ if (!definition[family])
3785
+ throw new TypeError(`Relationship kind ${definition.kind} is not a ${family} kind`);
3786
+ resolved.add(definition.kind);
3787
+ }
3788
+ return resolved;
3789
+ }
3790
+ function expandSemanticNeighbors(graph, nodeId, familyKinds, family, matches) {
3791
+ const registry = graph.registry();
3792
+ const rows = graph.neighborEdges(nodeId, {
3793
+ direction: "both",
3794
+ ...familyKinds === void 0 ? {} : { kinds: [...familyKinds] }
3795
+ });
3796
+ const neighbors = [];
3797
+ const seen = /* @__PURE__ */ new Set();
3798
+ for (const row of rows.value) {
3799
+ const definition = registry.require(row.edge.kind);
3800
+ if (!definition[family])
3801
+ continue;
3802
+ if (!matches(row, definition, nodeId))
3803
+ continue;
3804
+ if (seen.has(row.id))
3805
+ continue;
3806
+ seen.add(row.id);
3807
+ neighbors.push(row.id);
3808
+ }
3809
+ return { neighbors, inspectedEdges: rows.meta.inspectedEdges };
3810
+ }
3811
+ function appendSemanticExpansion(expansion, currentDepth, maxDepth, limit, after, state) {
3812
+ if (currentDepth >= maxDepth) {
3813
+ if (expansion.neighbors.some((neighbor) => !state.seen.has(neighbor)))
3814
+ state.truncated = true;
3815
+ return false;
3816
+ }
3817
+ for (const neighbor of expansion.neighbors) {
3818
+ if (state.seen.has(neighbor))
3819
+ continue;
3820
+ state.seen.add(neighbor);
3821
+ state.queue.push({ id: neighbor, depth: currentDepth + 1 });
3822
+ if (!state.resumed) {
3823
+ if (neighbor === after)
3824
+ state.resumed = true;
3825
+ continue;
3826
+ }
3827
+ if (state.value.length >= limit) {
3828
+ state.truncated = true;
3829
+ return true;
3830
+ }
3831
+ state.value.push(neighbor);
3832
+ }
3833
+ return false;
3834
+ }
3835
+ function boundedSemanticWalk(graph, start, options, family, matches) {
3836
+ if (!graph.hasNode(start))
3837
+ throw new TypeError(`Relationship node not found: ${start}`);
3838
+ const familyKinds = resolveFamilyKinds(graph, options.kinds, family);
3839
+ const limit = options.limit ?? Number.POSITIVE_INFINITY;
3840
+ const maxDepth = options.maxDepth ?? Number.POSITIVE_INFINITY;
3841
+ const after = options.after;
3842
+ const state = {
3843
+ seen: /* @__PURE__ */ new Set([start]),
3844
+ value: [],
3845
+ queue: [{ id: start, depth: 0 }],
3846
+ resumed: after === void 0,
3847
+ truncated: false
3848
+ };
3849
+ let visitedNodes = 0;
3850
+ let inspectedEdges = 0;
3851
+ for (let index = 0; index < state.queue.length; index += 1) {
3852
+ options.signal?.throwIfAborted();
3853
+ const current = state.queue[index];
3854
+ visitedNodes += 1;
3855
+ const expansion = expandSemanticNeighbors(graph, current.id, familyKinds, family, matches);
3856
+ inspectedEdges += expansion.inspectedEdges;
3857
+ if (appendSemanticExpansion(expansion, current.depth, maxDepth, limit, after, state))
3858
+ break;
3859
+ }
3860
+ if (!state.resumed)
3861
+ throw new TypeError(`Traversal cursor not found in sequence: ${after}`);
3862
+ return {
3863
+ value: state.value,
3864
+ meta: {
3865
+ visitedNodes,
3866
+ inspectedEdges,
3867
+ truncated: state.truncated,
3868
+ nextCursor: state.value.at(-1)
3869
+ }
3870
+ };
3871
+ }
3872
+ function assertPathEndpoint(graph, id) {
3873
+ if (!graph.hasNode(id))
3874
+ throw new TypeError(`Relationship node not found: ${id}`);
3875
+ }
3876
+ function readPathContinuations(graph, partial, options, direction, state) {
3877
+ const rows = graph.neighborEdges(partial.nodes.at(-1), {
3878
+ direction,
3879
+ ...options.kinds === void 0 ? {} : { kinds: options.kinds }
3880
+ });
3881
+ state.inspectedEdges += rows.meta.inspectedEdges;
3882
+ return rows.value.filter((row) => !partial.nodeSet.has(row.id));
3883
+ }
3884
+ function expandPartialPath(graph, partial, target, options, direction, probeLimit, state) {
3885
+ for (const row of readPathContinuations(graph, partial, options, direction, state)) {
3886
+ const nodes = [...partial.nodes, row.id];
3887
+ const nodeSet = new Set(partial.nodeSet).add(row.id);
3888
+ const edges = [...partial.edges, row.edge];
3889
+ if (row.id === target) {
3890
+ state.value.push({ nodes, edges, length: edges.length });
3891
+ if (state.value.length >= probeLimit)
3892
+ return true;
3893
+ } else {
3894
+ state.queue.push({ nodes, nodeSet, edges });
3895
+ }
3896
+ }
3897
+ return false;
3898
+ }
3899
+ function hierarchyAncestors(graph, id, options = {}) {
3900
+ return boundedSemanticWalk(graph, id, options, "hierarchy", (row, definition) => hierarchyParentEndpoint(row.edge, definition) === row.id);
3901
+ }
3902
+ function hierarchyDescendants(graph, id, options = {}) {
3903
+ return boundedSemanticWalk(graph, id, options, "hierarchy", (row, definition, nodeId) => hierarchyParentEndpoint(row.edge, definition) === nodeId);
3904
+ }
3905
+ function orderingPredecessors(graph, id, options = {}) {
3906
+ return boundedSemanticWalk(graph, id, options, "ordering", (row, definition) => orderingPredecessorEndpoint(row.edge, definition) === row.id);
3907
+ }
3908
+ function orderingSuccessors(graph, id, options = {}) {
3909
+ return boundedSemanticWalk(graph, id, options, "ordering", (row, definition, nodeId) => orderingPredecessorEndpoint(row.edge, definition) === nodeId);
3910
+ }
3911
+ function enumerateNonZeroRelationshipPaths(graph, source, target, options, maxPaths, maxVisitedPaths, maxDepth, direction) {
3912
+ const state = {
3913
+ value: [],
3914
+ queue: [{ nodes: [source], nodeSet: /* @__PURE__ */ new Set([source]), edges: [] }],
3915
+ inspectedEdges: 0
3916
+ };
3917
+ let visitedNodes = 0;
3918
+ let truncated = false;
3919
+ const probeLimit = maxPaths + 1;
3920
+ for (let index = 0; index < state.queue.length; index += 1) {
3921
+ options.signal?.throwIfAborted();
3922
+ if (state.value.length >= probeLimit || visitedNodes >= maxVisitedPaths) {
3923
+ truncated = true;
3924
+ break;
3925
+ }
3926
+ const partial = state.queue[index];
3927
+ visitedNodes += 1;
3928
+ if (partial.edges.length >= maxDepth) {
3929
+ if (readPathContinuations(graph, partial, options, direction, state).length > 0)
3930
+ truncated = true;
3931
+ continue;
3932
+ }
3933
+ if (expandPartialPath(graph, partial, target, options, direction, probeLimit, state)) {
3934
+ truncated = true;
3935
+ break;
3936
+ }
3937
+ }
3938
+ return {
3939
+ value: state.value.slice(0, maxPaths),
3940
+ meta: { visitedNodes, inspectedEdges: state.inspectedEdges, truncated }
3941
+ };
3942
+ }
3943
+ function enumerateRelationshipPaths(graph, source, target, options = {}) {
3944
+ assertPathEndpoint(graph, source);
3945
+ assertPathEndpoint(graph, target);
3946
+ const maxPaths = options.maxPaths ?? DEFAULT_MAX_PATHS;
3947
+ const maxVisitedPaths = options.maxVisitedPaths ?? DEFAULT_MAX_VISITED_PATHS;
3948
+ const maxDepth = options.maxDepth ?? DEFAULT_PATH_MAX_DEPTH;
3949
+ assertPathBound("maxPaths", maxPaths);
3950
+ assertPathBound("maxVisitedPaths", maxVisitedPaths);
3951
+ assertPathBound("maxDepth", maxDepth);
3952
+ const direction = options.direction ?? "outgoing";
3953
+ options.signal?.throwIfAborted();
3954
+ for (const kind of options.kinds ?? [])
3955
+ graph.registry().require(kind);
3956
+ if (source === target) {
3957
+ if (maxPaths === 0) {
3958
+ return {
3959
+ value: [],
3960
+ meta: { visitedNodes: 1, inspectedEdges: 0, truncated: true }
3961
+ };
3962
+ }
3963
+ return {
3964
+ value: [{ nodes: [source], edges: [], length: 0 }],
3965
+ meta: { visitedNodes: 1, inspectedEdges: 0, truncated: false }
3966
+ };
3967
+ }
3968
+ return enumerateNonZeroRelationshipPaths(graph, source, target, options, maxPaths, maxVisitedPaths, maxDepth, direction);
3969
+ }
3970
+
3971
+ // dist/sdk/graph/analytics.js
3972
+ !(function() {
3973
+ try {
3974
+ var e = "undefined" != typeof window ? window : "undefined" != typeof global ? global : "undefined" != typeof globalThis ? globalThis : "undefined" != typeof self ? self : {}, n = new e.Error().stack;
3975
+ n && (e._sentryDebugIds = e._sentryDebugIds || {}, e._sentryDebugIds[n] = "19fa7ddd-c396-5fd4-a720-522218a7b11a");
3976
+ } catch (e2) {
3977
+ }
3978
+ })();
3979
+ var DEFAULT_MAX_ITERATIONS = 16;
3980
+ var DEFAULT_MIN_COMMUNITY_SIZE = 2;
3981
+ var DEFAULT_REDUNDANCY_MAX_DEPTH = 8;
3982
+ function assertPositiveBound(name, value) {
3983
+ if (!Number.isInteger(value) || value < 1)
3984
+ throw new TypeError(`Invalid ${name} bound: ${String(value)}`);
3985
+ }
3986
+ function buildUndirectedAdjacency(graph, kinds) {
3987
+ const registry = graph.registry();
3988
+ const wanted = kinds === void 0 ? void 0 : new Set(kinds.map((kind) => registry.require(kind).kind));
3989
+ const adjacency = /* @__PURE__ */ new Map();
3990
+ for (const edge of graph.edges()) {
3991
+ if (edge.source === edge.target)
3992
+ continue;
3993
+ if (wanted !== void 0) {
3994
+ const definition = registry.require(edge.kind);
3995
+ const matches = wanted.has(definition.kind) || definition.inverse !== void 0 && wanted.has(definition.inverse);
3996
+ if (!matches)
3997
+ continue;
3998
+ }
3999
+ appendAdjacency(adjacency, edge.source, edge.target);
4000
+ appendAdjacency(adjacency, edge.target, edge.source);
4001
+ }
4002
+ for (const neighbors of adjacency.values())
4003
+ neighbors.sort();
4004
+ return adjacency;
4005
+ }
4006
+ function appendAdjacency(adjacency, from, to) {
4007
+ const neighbors = adjacency.get(from);
4008
+ if (neighbors === void 0)
4009
+ adjacency.set(from, [to]);
4010
+ else
4011
+ neighbors.push(to);
4012
+ }
4013
+ function dominantNeighborLabel(neighbors, labels) {
4014
+ const counts = /* @__PURE__ */ new Map();
4015
+ for (const neighbor of neighbors) {
4016
+ const label = labels.get(neighbor);
4017
+ counts.set(label, (counts.get(label) ?? 0) + 1);
4018
+ }
4019
+ let best;
4020
+ let bestCount = 0;
4021
+ for (const [label, count] of counts) {
4022
+ if (count > bestCount || count === bestCount && label < best) {
4023
+ best = label;
4024
+ bestCount = count;
4025
+ }
4026
+ }
4027
+ return best;
4028
+ }
4029
+ function collectCommunities(labels, minSize) {
4030
+ const groups = /* @__PURE__ */ new Map();
4031
+ for (const [id, label] of labels) {
4032
+ const members = groups.get(label);
4033
+ if (members === void 0)
4034
+ groups.set(label, [id]);
4035
+ else
4036
+ members.push(id);
4037
+ }
4038
+ const communities = [];
4039
+ for (const members of groups.values()) {
4040
+ if (members.length < minSize)
4041
+ continue;
4042
+ members.sort();
4043
+ communities.push({
4044
+ representative: members[0],
4045
+ size: members.length,
4046
+ members
4047
+ });
4048
+ }
4049
+ return communities.sort((left, right) => right.size - left.size || left.representative.localeCompare(right.representative));
4050
+ }
4051
+ function detectRelationshipCommunities(graph, options = {}) {
4052
+ const maxIterations = options.maxIterations ?? DEFAULT_MAX_ITERATIONS;
4053
+ const minSize = options.minSize ?? DEFAULT_MIN_COMMUNITY_SIZE;
4054
+ assertPositiveBound("maxIterations", maxIterations);
4055
+ assertPositiveBound("minSize", minSize);
4056
+ const adjacency = buildUndirectedAdjacency(graph, options.kinds);
4057
+ const nodes = graph.nodes();
4058
+ const labels = new Map(nodes.map((id) => [id, id]));
4059
+ let iterations = 0;
4060
+ let converged = false;
4061
+ let visitedNodes = 0;
4062
+ let inspectedEdges = 0;
4063
+ while (iterations < maxIterations && !converged) {
4064
+ options.signal?.throwIfAborted();
4065
+ iterations += 1;
4066
+ converged = true;
4067
+ for (const id of nodes) {
4068
+ visitedNodes += 1;
4069
+ const neighbors = adjacency.get(id);
4070
+ if (neighbors === void 0)
4071
+ continue;
4072
+ inspectedEdges += neighbors.length;
4073
+ const dominant = dominantNeighborLabel(neighbors, labels);
4074
+ if (dominant !== labels.get(id)) {
4075
+ labels.set(id, dominant);
4076
+ converged = false;
4077
+ }
4078
+ }
4079
+ }
4080
+ return {
4081
+ value: {
4082
+ communities: collectCommunities(labels, minSize),
4083
+ iterations,
4084
+ converged
4085
+ },
4086
+ meta: { visitedNodes, inspectedEdges, truncated: !converged }
4087
+ };
4088
+ }
4089
+ function isTransitiveKind(definition) {
4090
+ return definition.direction === "directed" && (definition.ordering || definition.hierarchy);
4091
+ }
4092
+ function transitiveFamilyKey(definition) {
4093
+ return definition.inverse !== void 0 && definition.inverse < definition.kind ? definition.inverse : definition.kind;
4094
+ }
4095
+ function orientTransitiveEdge(edge, definition) {
4096
+ const head = definition.hierarchy ? hierarchyParentEndpoint(edge, definition) : edge.source === orderingPredecessorEndpoint(edge, definition) ? edge.target : edge.source;
4097
+ return head === edge.target ? { from: edge.source, to: edge.target } : { from: edge.target, to: edge.source };
4098
+ }
4099
+ function resolveRedundancyFamilies(graph, kinds) {
4100
+ if (kinds === void 0)
4101
+ return void 0;
4102
+ const registry = graph.registry();
4103
+ const families = /* @__PURE__ */ new Set();
4104
+ for (const kind of kinds) {
4105
+ const definition = registry.require(kind);
4106
+ if (!isTransitiveKind(definition))
4107
+ throw new TypeError(`Relationship kind ${definition.kind} is not a directed ordering or hierarchy kind`);
4108
+ families.add(transitiveFamilyKey(definition));
4109
+ }
4110
+ return families;
4111
+ }
4112
+ function collectTransitiveFamilies(graph, wanted) {
4113
+ const registry = graph.registry();
4114
+ const families = /* @__PURE__ */ new Map();
4115
+ for (const edge of graph.edges()) {
4116
+ const definition = registry.require(edge.kind);
4117
+ if (!isTransitiveKind(definition))
4118
+ continue;
4119
+ const key = transitiveFamilyKey(definition);
4120
+ if (wanted !== void 0 && !wanted.has(key))
4121
+ continue;
4122
+ const oriented = orientTransitiveEdge(edge, definition);
4123
+ if (oriented.from === oriented.to)
4124
+ continue;
4125
+ let family = families.get(key);
4126
+ if (family === void 0) {
4127
+ family = { adjacency: /* @__PURE__ */ new Map(), records: [] };
4128
+ families.set(key, family);
4129
+ }
4130
+ const targets = family.adjacency.get(oriented.from);
4131
+ if (targets === void 0)
4132
+ family.adjacency.set(oriented.from, /* @__PURE__ */ new Set([oriented.to]));
4133
+ else
4134
+ targets.add(oriented.to);
4135
+ family.records.push({ ...oriented, edge });
4136
+ }
4137
+ return families;
4138
+ }
4139
+ function sortedFamilyAdjacency(family) {
4140
+ const sorted = /* @__PURE__ */ new Map();
4141
+ for (const [from, targets] of family.adjacency)
4142
+ sorted.set(from, [...targets].sort());
4143
+ return sorted;
4144
+ }
4145
+ function reconstructWitness(parents, from, tail, head) {
4146
+ const witness = [head];
4147
+ for (let node = tail; node !== from; node = parents.get(node))
4148
+ witness.push(node);
4149
+ witness.push(from);
4150
+ return witness.reverse();
4151
+ }
4152
+ function expandWitnessFrontier(adjacency, record, current, parents, queue, cost) {
4153
+ for (const next of adjacency.get(current.id) ?? []) {
4154
+ cost.inspectedEdges += 1;
4155
+ if (current.depth === 0 && next === record.to)
4156
+ continue;
4157
+ if (parents.has(next))
4158
+ continue;
4159
+ parents.set(next, current.id);
4160
+ if (next === record.to)
4161
+ return reconstructWitness(parents, record.from, current.id, next);
4162
+ queue.push({ id: next, depth: current.depth + 1 });
4163
+ }
4164
+ return void 0;
4165
+ }
4166
+ function findWitnessPath(adjacency, record, maxDepth, cost) {
4167
+ const parents = /* @__PURE__ */ new Map([[record.from, record.from]]);
4168
+ const queue = [{ id: record.from, depth: 0 }];
4169
+ for (let index = 0; index < queue.length; index += 1) {
4170
+ const current = queue[index];
4171
+ cost.visitedNodes += 1;
4172
+ if (current.depth >= maxDepth)
4173
+ continue;
4174
+ const witness = expandWitnessFrontier(adjacency, record, current, parents, queue, cost);
4175
+ if (witness !== void 0)
4176
+ return witness;
4177
+ }
4178
+ return void 0;
4179
+ }
4180
+ function findRedundantRelationshipEdges(graph, options = {}) {
4181
+ const maxDepth = options.maxDepth ?? DEFAULT_REDUNDANCY_MAX_DEPTH;
4182
+ assertPositiveBound("maxDepth", maxDepth);
4183
+ if (options.limit !== void 0)
4184
+ assertPositiveBound("limit", options.limit);
4185
+ const limit = options.limit ?? Number.POSITIVE_INFINITY;
4186
+ const wanted = resolveRedundancyFamilies(graph, options.kinds);
4187
+ const families = collectTransitiveFamilies(graph, wanted);
4188
+ const value = [];
4189
+ const cost = { visitedNodes: 0, inspectedEdges: 0 };
4190
+ let truncated = false;
4191
+ scan: for (const key of [...families.keys()].sort()) {
4192
+ const family = families.get(key);
4193
+ const adjacency = sortedFamilyAdjacency(family);
4194
+ for (const record of family.records) {
4195
+ options.signal?.throwIfAborted();
4196
+ const witness = findWitnessPath(adjacency, record, maxDepth, cost);
4197
+ if (witness === void 0)
4198
+ continue;
4199
+ if (value.length >= limit) {
4200
+ truncated = true;
4201
+ break scan;
4202
+ }
4203
+ value.push({ edge: record.edge, witness });
4204
+ }
4205
+ }
4206
+ return {
4207
+ value,
4208
+ meta: {
4209
+ visitedNodes: cost.visitedNodes,
4210
+ inspectedEdges: cost.inspectedEdges,
4211
+ truncated
4212
+ }
4213
+ };
4214
+ }
4215
+ function expandReachableNode(id, depth, rows, maxDepth, state) {
4216
+ const nextSet = /* @__PURE__ */ new Set();
4217
+ const nexts = [];
4218
+ for (const row of rows) {
4219
+ if (row.id === id || nextSet.has(row.id))
4220
+ continue;
4221
+ if (!state.seen.has(row.id)) {
4222
+ if (depth >= maxDepth) {
4223
+ state.truncated = true;
4224
+ continue;
4225
+ }
4226
+ state.seen.add(row.id);
4227
+ state.queue.push({ id: row.id, depth: depth + 1 });
4228
+ }
4229
+ nextSet.add(row.id);
4230
+ nexts.push(row.id);
4231
+ let incoming = state.predecessors.get(row.id);
4232
+ if (incoming === void 0) {
4233
+ incoming = /* @__PURE__ */ new Set();
4234
+ state.predecessors.set(row.id, incoming);
4235
+ }
4236
+ incoming.add(id);
4237
+ }
4238
+ return nexts;
4239
+ }
4240
+ function indexReachableSubgraph(graph, root, options) {
4241
+ const direction = options.direction ?? "outgoing";
4242
+ const maxDepth = options.maxDepth ?? Number.POSITIVE_INFINITY;
4243
+ const order = [];
4244
+ const successors = /* @__PURE__ */ new Map();
4245
+ const state = {
4246
+ seen: /* @__PURE__ */ new Set([root]),
4247
+ queue: [{ id: root, depth: 0 }],
4248
+ predecessors: /* @__PURE__ */ new Map(),
4249
+ truncated: false
4250
+ };
4251
+ let inspectedEdges = 0;
4252
+ for (let index = 0; index < state.queue.length; index += 1) {
4253
+ options.signal?.throwIfAborted();
4254
+ const { id, depth } = state.queue[index];
4255
+ order.push(id);
4256
+ const rows = graph.neighborEdges(id, {
4257
+ direction,
4258
+ ...options.kinds === void 0 ? {} : { kinds: options.kinds }
4259
+ });
4260
+ inspectedEdges += rows.meta.inspectedEdges;
4261
+ successors.set(id, expandReachableNode(id, depth, rows.value, maxDepth, state));
4262
+ }
4263
+ return {
4264
+ order,
4265
+ successors,
4266
+ predecessors: state.predecessors,
4267
+ inspectedEdges,
4268
+ truncated: state.truncated
4269
+ };
4270
+ }
4271
+ function reversePostorder(subgraph, root) {
4272
+ const postorder = [];
4273
+ const visited = /* @__PURE__ */ new Set([root]);
4274
+ const stack = [{ id: root, index: 0 }];
4275
+ while (stack.length > 0) {
4276
+ const frame = stack.at(-1);
4277
+ const nexts = subgraph.successors.get(frame.id);
4278
+ if (frame.index < nexts.length) {
4279
+ const next = nexts[frame.index];
4280
+ frame.index += 1;
4281
+ if (!visited.has(next)) {
4282
+ visited.add(next);
4283
+ stack.push({ id: next, index: 0 });
4284
+ }
4285
+ } else {
4286
+ postorder.push(frame.id);
4287
+ stack.pop();
4288
+ }
4289
+ }
4290
+ return postorder.reverse();
4291
+ }
4292
+ function intersectDominators(left, right, idom, ordinal) {
4293
+ let first = left;
4294
+ let second = right;
4295
+ while (first !== second) {
4296
+ while (ordinal.get(first) > ordinal.get(second))
4297
+ first = idom.get(first);
4298
+ while (ordinal.get(second) > ordinal.get(first))
4299
+ second = idom.get(second);
4300
+ }
4301
+ return first;
4302
+ }
4303
+ function dominatorCandidate(predecessors, idom, ordinal) {
4304
+ let candidate;
4305
+ for (const pred of [...predecessors].sort()) {
4306
+ if (!idom.has(pred))
4307
+ continue;
4308
+ candidate = candidate === void 0 ? pred : intersectDominators(candidate, pred, idom, ordinal);
4309
+ }
4310
+ return candidate;
4311
+ }
4312
+ function solveImmediateDominators(subgraph, root, order, ordinal, signal) {
4313
+ const idom = /* @__PURE__ */ new Map([[root, root]]);
4314
+ let changed = true;
4315
+ while (changed) {
4316
+ changed = false;
4317
+ for (const id of order) {
4318
+ signal?.throwIfAborted();
4319
+ if (id === root)
4320
+ continue;
4321
+ const candidate = dominatorCandidate(subgraph.predecessors.get(id), idom, ordinal);
4322
+ if (candidate !== void 0 && idom.get(id) !== candidate) {
4323
+ idom.set(id, candidate);
4324
+ changed = true;
4325
+ }
4326
+ }
4327
+ }
4328
+ return idom;
4329
+ }
4330
+ function computeRelationshipDominators(graph, root, options = {}) {
4331
+ if (!graph.hasNode(root))
4332
+ throw new TypeError(`Relationship node not found: ${root}`);
4333
+ if (options.maxDepth !== void 0 && (!Number.isInteger(options.maxDepth) || options.maxDepth < 0))
4334
+ throw new TypeError(`Invalid maxDepth bound: ${String(options.maxDepth)}`);
4335
+ const subgraph = indexReachableSubgraph(graph, root, options);
4336
+ const order = reversePostorder(subgraph, root);
4337
+ const ordinal = new Map(order.map((id, index) => [id, index]));
4338
+ const idom = solveImmediateDominators(subgraph, root, order, ordinal, options.signal);
4339
+ const subtreeSizes = new Map(order.map((id) => [id, 1]));
4340
+ for (let index = order.length - 1; index >= 0; index -= 1) {
4341
+ const id = order[index];
4342
+ if (id === root)
4343
+ continue;
4344
+ const parent = idom.get(id);
4345
+ subtreeSizes.set(parent, subtreeSizes.get(parent) + subtreeSizes.get(id));
4346
+ }
4347
+ const rows = order.filter((id) => id !== root).map((id) => ({
4348
+ id,
4349
+ idom: idom.get(id),
4350
+ dominatedCount: subtreeSizes.get(id) - 1
4351
+ })).sort((left, right) => right.dominatedCount - left.dominatedCount || left.id.localeCompare(right.id));
4352
+ return {
4353
+ value: { root, reachableCount: subgraph.order.length, rows },
4354
+ meta: {
4355
+ visitedNodes: subgraph.order.length,
4356
+ inspectedEdges: subgraph.inspectedEdges,
4357
+ truncated: subgraph.truncated
4358
+ }
4359
+ };
4360
+ }
4361
+
4362
+ // dist/sdk/graph/governance.js
4363
+ !(function() {
4364
+ try {
4365
+ var e = "undefined" != typeof window ? window : "undefined" != typeof global ? global : "undefined" != typeof globalThis ? globalThis : "undefined" != typeof self ? self : {}, n = new e.Error().stack;
4366
+ n && (e._sentryDebugIds = e._sentryDebugIds || {}, e._sentryDebugIds[n] = "a78eee2f-0423-565f-91b6-88d0ab46d529");
4367
+ } catch (e2) {
4368
+ }
4369
+ })();
4370
+ var DEFAULT_MAX_SAMPLE_SIZE = 25;
4371
+ var SEVERITY_RANK = {
4372
+ error: 0,
4373
+ warning: 1,
4374
+ info: 2
4375
+ };
4376
+ function buildFinding(code, severity, policy, describe, subjects, maxSampleSize, remediation) {
4377
+ const sorted = [...subjects].sort((left, right) => left.localeCompare(right));
4378
+ return {
4379
+ code,
4380
+ severity,
4381
+ policy,
4382
+ message: describe(sorted.length),
4383
+ count: sorted.length,
4384
+ sample: sorted.slice(0, maxSampleSize),
4385
+ sample_truncated: sorted.length > maxSampleSize,
4386
+ remediation
4387
+ };
4388
+ }
4389
+ function buildOrderingAdjacency(assembly) {
4390
+ const registry = assembly.graph.registry();
4391
+ const successors = /* @__PURE__ */ new Map();
4392
+ for (const edge of assembly.graph.edges()) {
4393
+ const definition = registry.require(edge.kind);
4394
+ if (!definition.ordering)
4395
+ continue;
4396
+ const [predecessor, successor] = (definition.precedence ?? "source_before_target") === "target_before_source" ? [edge.target, edge.source] : [edge.source, edge.target];
4397
+ const adjacent = successors.get(predecessor);
4398
+ if (adjacent)
4399
+ adjacent.push(successor);
4400
+ else
4401
+ successors.set(predecessor, [successor]);
4402
+ }
4403
+ for (const adjacent of successors.values())
4404
+ adjacent.sort((left, right) => left.localeCompare(right));
4405
+ return successors;
4406
+ }
4407
+ function registerTarjanNode(node, state) {
4408
+ state.indexes.set(node, state.nextIndex);
4409
+ state.lowLinks.set(node, state.nextIndex);
4410
+ state.nextIndex += 1;
4411
+ state.stack.push(node);
4412
+ state.onStack.add(node);
4413
+ }
4414
+ function visitNextTarjanNeighbor(frame, frames, successors, state) {
4415
+ const neighbors = successors.get(frame.node) ?? [];
4416
+ if (frame.neighborIndex >= neighbors.length)
4417
+ return false;
4418
+ const neighbor = neighbors[frame.neighborIndex];
4419
+ frame.neighborIndex += 1;
4420
+ if (!state.indexes.has(neighbor)) {
4421
+ registerTarjanNode(neighbor, state);
4422
+ frames.push({ node: neighbor, neighborIndex: 0 });
4423
+ } else if (state.onStack.has(neighbor)) {
4424
+ state.lowLinks.set(frame.node, Math.min(state.lowLinks.get(frame.node), state.indexes.get(neighbor)));
4425
+ }
4426
+ return true;
4427
+ }
4428
+ function completeTarjanFrame(frame, frames, successors, state) {
4429
+ frames.pop();
4430
+ const parent = frames.at(-1);
4431
+ if (parent)
4432
+ state.lowLinks.set(parent.node, Math.min(state.lowLinks.get(parent.node), state.lowLinks.get(frame.node)));
4433
+ if (state.lowLinks.get(frame.node) !== state.indexes.get(frame.node))
4434
+ return;
4435
+ const component = [];
4436
+ while (true) {
4437
+ const member = state.stack.pop();
4438
+ state.onStack.delete(member);
4439
+ component.push(member);
4440
+ if (member === frame.node)
4441
+ break;
4442
+ }
4443
+ if (component.length > 1 || component.length === 1 && successors.get(component[0])?.includes(component[0]))
4444
+ state.components.push(component.sort((left, right) => left.localeCompare(right)));
4445
+ }
4446
+ function collectOrderingCycles(successors) {
4447
+ const state = {
4448
+ indexes: /* @__PURE__ */ new Map(),
4449
+ lowLinks: /* @__PURE__ */ new Map(),
4450
+ onStack: /* @__PURE__ */ new Set(),
4451
+ stack: [],
4452
+ components: [],
4453
+ nextIndex: 0
4454
+ };
4455
+ const roots = [...successors.keys()].sort((left, right) => left.localeCompare(right));
4456
+ for (const root of roots) {
4457
+ if (state.indexes.has(root))
4458
+ continue;
4459
+ const frames = [{ node: root, neighborIndex: 0 }];
4460
+ registerTarjanNode(root, state);
4461
+ while (frames.length > 0) {
4462
+ const frame = frames.at(-1);
4463
+ if (visitNextTarjanNeighbor(frame, frames, successors, state))
4464
+ continue;
4465
+ completeTarjanFrame(frame, frames, successors, state);
4466
+ }
4467
+ }
4468
+ return state.components.sort((left, right) => left[0].localeCompare(right[0]));
4469
+ }
4470
+ function formatDanglingReference(reference) {
4471
+ return `${reference.holder_id} -> ${reference.target_id} (${reference.kind})`;
4472
+ }
4473
+ function appendFinding(findings, subjects, maxSampleSize, code, severity, policy, describe, remediation) {
4474
+ if (subjects.length === 0)
4475
+ return;
4476
+ findings.push(buildFinding(code, severity, policy, describe, subjects, maxSampleSize, remediation));
4477
+ }
4478
+ function collectIntegrityFindings(assembly, isTerminal, maxSampleSize) {
4479
+ const findings = [];
4480
+ const references = [
4481
+ ...assembly.dangling.active,
4482
+ ...assembly.dangling.legacy_terminal
4483
+ ].filter((reference) => !reference.no_active_blocker_sentinel);
4484
+ appendFinding(findings, references.filter((reference) => !isTerminal(reference.holder_status)).map(formatDanglingReference), maxSampleSize, "missing_reference_active", "error", "Active items must not reference absent targets; missing prerequisites distort scheduling.", (count) => `${count} active dangling reference(s) to absent items`, "Restore or re-create the referenced item, or remove/retype the reference on the holder.");
4485
+ appendFinding(findings, references.filter((reference) => isTerminal(reference.holder_status)).map(formatDanglingReference), maxSampleSize, "missing_reference_terminal", "info", "Terminal items may retain historical references, but absent targets remain unexplainable context.", (count) => `${count} terminal dangling reference(s) to absent items`, "Leave as history debt or clean up in a dedicated changelog-safe closed-item batch.");
4486
+ appendFinding(findings, assembly.dangling.no_active_blocker_sentinels.map(formatDanglingReference), maxSampleSize, "legacy_no_blocker_sentinel", "info", "The pre-structured-dependency no-active-blocker sentinel is retired; real edges carry blocker state.", (count) => `${count} legacy no-active-blocker sentinel reference(s)`, "Delete the sentinel reference; blocker state is derived from blocked_by edges.");
4487
+ return findings;
4488
+ }
4489
+ function isActiveAuditMember(member, nodeStates) {
4490
+ const state = nodeStates.get(member);
4491
+ if (!state)
4492
+ return true;
4493
+ return !state.terminal;
4494
+ }
4495
+ function collectOrderingFindings(assembly, nodeStates, isBlocked, maxSampleSize) {
4496
+ const findings = [];
4497
+ const orderingAdjacency = buildOrderingAdjacency(assembly);
4498
+ for (const cycle of collectOrderingCycles(orderingAdjacency)) {
4499
+ const active = cycle.some((member) => isActiveAuditMember(member, nodeStates));
4500
+ findings.push(active ? buildFinding("ordering_cycle", "error", "Order-bearing relationship kinds must stay acyclic; a cycle makes every member unschedulable.", (count) => `execution-order cycle across ${count} item(s)`, cycle, maxSampleSize, "Remove or retype one ordering edge inside the cycle, or split the work so precedence is linear.") : buildFinding("legacy_ordering_cycle", "info", "Ordering cycles between exclusively terminal items are historical contradictions with no scheduling effect.", (count) => `terminal-only execution-order cycle across ${count} item(s)`, cycle, maxSampleSize, "Leave as history debt, or clean up in a dedicated changelog-safe closed-item batch; never repair closed items ad hoc."));
4501
+ }
4502
+ const predecessorsByNode = /* @__PURE__ */ new Map();
4503
+ for (const [predecessor, adjacent] of orderingAdjacency)
4504
+ for (const successor of adjacent) {
4505
+ const predecessors = predecessorsByNode.get(successor);
4506
+ if (predecessors)
4507
+ predecessors.push(predecessor);
4508
+ else
4509
+ predecessorsByNode.set(successor, [predecessor]);
4510
+ }
4511
+ const staleLifecycleBlocks = [...nodeStates.values()].filter((state) => !state.missing && !state.terminal && isBlocked(state.status) && !(predecessorsByNode.get(state.id) ?? []).some((predecessor) => {
4512
+ const predecessorState = nodeStates.get(predecessor);
4513
+ return predecessorState === void 0 || !predecessorState.terminal;
4514
+ })).map((state) => state.id);
4515
+ appendFinding(findings, staleLifecycleBlocks, maxSampleSize, "stale_lifecycle_block", "warning", "A blocked lifecycle status must be backed by at least one open ordering predecessor.", (count) => `${count} status-blocked item(s) with no open blocker edge`, "Re-open the missing prerequisite as an edge, or move the item back to an active status.");
4516
+ return findings;
4517
+ }
4518
+ function formatDuplicateEdgeGroup(group) {
4519
+ const kinds = group.edges.map((edge) => edge.kind).sort((left, right) => left.localeCompare(right));
4520
+ return `${group.from} -> ${group.to} (${kinds.join(" + ")})`;
4521
+ }
4522
+ function collectDuplicateRelationshipEdgeGroups(assembly) {
4523
+ const registry = assembly.graph.registry();
4524
+ const groups = /* @__PURE__ */ new Map();
4525
+ for (const edge of assembly.graph.edges()) {
4526
+ const definition = registry.require(edge.kind);
4527
+ if (!isTransitiveKind(definition))
4528
+ continue;
4529
+ const oriented = orientTransitiveEdge(edge, definition);
4530
+ if (oriented.from === oriented.to)
4531
+ continue;
4532
+ const key = `${transitiveFamilyKey(definition)}::${oriented.from}::${oriented.to}`;
4533
+ const group = groups.get(key);
4534
+ if (group)
4535
+ group.edges.push(edge);
4536
+ else
4537
+ groups.set(key, { ...oriented, edges: [edge] });
4538
+ }
4539
+ const duplicated = [...groups.values()].filter((group) => group.edges.length >= 2);
4540
+ for (const group of duplicated)
4541
+ group.edges.sort((left, right) => left.kind.localeCompare(right.kind));
4542
+ return duplicated.sort((left, right) => left.from.localeCompare(right.from) || left.to.localeCompare(right.to));
4543
+ }
4544
+ function collectDuplicateEdgeFindings(assembly, nodeStates, maxSampleSize) {
4545
+ const active = [];
4546
+ const legacy = [];
4547
+ for (const group of collectDuplicateRelationshipEdgeGroups(assembly)) {
4548
+ const subjects = isActiveAuditMember(group.from, nodeStates) || isActiveAuditMember(group.to, nodeStates) ? active : legacy;
4549
+ subjects.push(formatDuplicateEdgeGroup(group));
4550
+ }
4551
+ const findings = [];
4552
+ appendFinding(findings, active, maxSampleSize, "duplicate_edge", "info", "One semantic relationship should be stored once; parallel same-family spellings (reciprocal inverse pairs included) add no information and skew degree metrics.", (count) => `${count} duplicated relationship(s) between active endpoints`, "Remove all but one stored spelling of the relationship; keep the canonical direction the holder declared first.");
4553
+ appendFinding(findings, legacy, maxSampleSize, "legacy_duplicate_edge", "info", "Duplicated spellings between exclusively terminal items are historical noise with no scheduling effect.", (count) => `${count} duplicated relationship(s) between terminal endpoints`, "Leave as history debt or clean up in a dedicated changelog-safe closed-item batch.");
4554
+ return findings;
4555
+ }
4556
+ function collectCoverageReport(assembly, nodeStates, exemptIsolates, maxSampleSize, edgesByKind) {
4557
+ let activeNodes = 0;
4558
+ let missingNodes = 0;
4559
+ let isolatedActiveNodes = 0;
4560
+ let degreeLeqOneActive = 0;
4561
+ const isolates = [];
4562
+ const sparse = [];
4563
+ for (const id of assembly.graph.nodes()) {
4564
+ const state = nodeStates.get(id);
4565
+ if (!state)
4566
+ continue;
4567
+ if (state.missing) {
4568
+ missingNodes += 1;
4569
+ continue;
4570
+ }
4571
+ if (state.terminal)
4572
+ continue;
4573
+ activeNodes += 1;
4574
+ const degree = assembly.graph.incidentEdges(id).length;
4575
+ if (degree > 1)
4576
+ continue;
4577
+ degreeLeqOneActive += 1;
4578
+ if (degree === 0)
4579
+ isolatedActiveNodes += 1;
4580
+ if (exemptIsolates.has(id.toLowerCase()))
4581
+ continue;
4582
+ if (degree === 0)
4583
+ isolates.push(id);
4584
+ else
4585
+ sparse.push(id);
4586
+ }
4587
+ const findings = [];
4588
+ appendFinding(findings, isolates, maxSampleSize, "isolated_active_node", "warning", "Active work should be reachable from the graph unless explicitly declared a valid isolate.", (count) => `${count} active item(s) with no relationships`, "Link the item to its parent, prerequisite, or origin \u2014 or register it as an exempt isolate.");
4589
+ appendFinding(findings, sparse, maxSampleSize, "sparse_active_node", "info", "Active items with a single edge often miss an honest semantic partner; sparse is not automatically defective.", (count) => `${count} active item(s) with exactly one relationship`, "Investigate for an honest second edge (story->task, defect family, cross-epic complement); do not fabricate one.");
4590
+ return {
4591
+ findings,
4592
+ profile: {
4593
+ nodes: assembly.graph.nodes().length,
4594
+ edges: assembly.graph.edges().length,
4595
+ edges_by_kind: Object.fromEntries(Object.entries(edgesByKind).sort(([left], [right]) => left.localeCompare(right))),
4596
+ active_nodes: activeNodes,
4597
+ missing_nodes: missingNodes,
4598
+ isolated_active_nodes: isolatedActiveNodes,
4599
+ degree_leq_one_active_nodes: degreeLeqOneActive
4600
+ }
4601
+ };
4602
+ }
4603
+ function auditWorkspaceRelationshipGraph(assembly, options = {}) {
4604
+ const isTerminal = options.isTerminal ?? ((status) => status === "closed" || status === "canceled");
4605
+ const isBlocked = options.isBlocked ?? ((status) => status === "blocked");
4606
+ const maxSampleSize = options.maxSampleSize ?? DEFAULT_MAX_SAMPLE_SIZE;
4607
+ if (!Number.isInteger(maxSampleSize) || maxSampleSize < 1)
4608
+ throw new TypeError(`Invalid audit sample bound: ${String(options.maxSampleSize)}`);
4609
+ const exemptIsolates = new Set((options.exemptIsolates ?? []).filter((id) => typeof id === "string").map((id) => id.trim().toLowerCase()));
4610
+ const nodeStates = new Map(assembly.details.map((detail) => [
4611
+ detail.id,
4612
+ {
4613
+ id: detail.id,
4614
+ status: detail.status,
4615
+ missing: assembly.missingIdSet.has(detail.id.toLowerCase()),
4616
+ terminal: isTerminal(detail.status)
4617
+ }
4618
+ ]));
4619
+ options.signal?.throwIfAborted();
4620
+ const edgesByKind = {};
4621
+ for (const edge of assembly.graph.edges())
4622
+ edgesByKind[edge.kind] = (edgesByKind[edge.kind] ?? 0) + 1;
4623
+ const findings = collectIntegrityFindings(assembly, isTerminal, maxSampleSize);
4624
+ options.signal?.throwIfAborted();
4625
+ findings.push(...collectOrderingFindings(assembly, nodeStates, isBlocked, maxSampleSize));
4626
+ options.signal?.throwIfAborted();
4627
+ findings.push(...collectDuplicateEdgeFindings(assembly, nodeStates, maxSampleSize));
4628
+ options.signal?.throwIfAborted();
4629
+ const coverage = collectCoverageReport(assembly, nodeStates, exemptIsolates, maxSampleSize, edgesByKind);
4630
+ findings.push(...coverage.findings);
4631
+ findings.sort((left, right) => SEVERITY_RANK[left.severity] - SEVERITY_RANK[right.severity] || left.code.localeCompare(right.code) || left.sample[0].localeCompare(right.sample[0]));
4632
+ return {
4633
+ findings,
4634
+ profile: coverage.profile
4635
+ };
4636
+ }
4637
+
4638
+ // dist/sdk/graph/remediation.js
4639
+ !(function() {
4640
+ try {
4641
+ var e = "undefined" != typeof window ? window : "undefined" != typeof global ? global : "undefined" != typeof globalThis ? globalThis : "undefined" != typeof self ? self : {}, n = new e.Error().stack;
4642
+ n && (e._sentryDebugIds = e._sentryDebugIds || {}, e._sentryDebugIds[n] = "662a9796-dbb3-5fd5-bc23-22dba9adde9e");
4643
+ } catch (e2) {
4644
+ }
4645
+ })();
4646
+ var FINDING_STEP_TEMPLATES = {
4647
+ missing_reference_active: {
4648
+ op: "investigate",
4649
+ confidence: "medium",
4650
+ rationale: "Restore or re-create the referenced item, or remove/retype the reference on the active holder; the correct fix depends on why the target is absent."
4651
+ },
4652
+ missing_reference_terminal: {
4653
+ op: "waive",
4654
+ confidence: "high",
4655
+ rationale: "Terminal-holder reference to an absent item is historical debt; waive it or clean it up only in a dedicated changelog-safe closed-item batch."
4656
+ },
4657
+ legacy_no_blocker_sentinel: {
4658
+ op: "remove",
4659
+ confidence: "high",
4660
+ rationale: "The pre-structured-dependency no-active-blocker sentinel is retired and carries no information; blocker state derives from blocked_by edges."
4661
+ },
4662
+ ordering_cycle: {
4663
+ op: "investigate",
4664
+ confidence: "low",
4665
+ rationale: "Every cycle member is unschedulable until one ordering edge is removed or retyped; the planner never chooses which edge to cut."
4666
+ },
4667
+ legacy_ordering_cycle: {
4668
+ op: "waive",
4669
+ confidence: "high",
4670
+ rationale: "Terminal-only ordering cycles have no scheduling effect; repairing them would mutate closed history (changelog drag)."
4671
+ },
4672
+ // duplicate_edge findings are expanded into per-stored-edge remove steps by
4673
+ // the planner itself (see stepsFromDuplicateGroup); this template documents
4674
+ // the family for exhaustiveness and backs any future sample-only fallback.
4675
+ duplicate_edge: {
4676
+ op: "remove",
4677
+ confidence: "high",
4678
+ rationale: "Parallel same-family spellings state one relationship twice; remove all but one stored spelling, keeping the holder's canonical direction."
4679
+ },
4680
+ legacy_duplicate_edge: {
4681
+ op: "waive",
4682
+ confidence: "high",
4683
+ rationale: "Duplicated spellings between terminal items are historical noise; waive or batch changelog-safe cleanup."
4684
+ },
4685
+ stale_lifecycle_block: {
4686
+ op: "investigate",
4687
+ confidence: "medium",
4688
+ rationale: "Re-open the missing prerequisite as an ordering edge, or move the item back to an active status; only the holder's owner knows which is true."
4689
+ },
4690
+ isolated_active_node: {
4691
+ op: "investigate",
4692
+ confidence: "medium",
4693
+ rationale: "Link the item to its parent, prerequisite, or origin \u2014 or register it as an explicitly exempt isolate; the audit never fabricates an edge."
4694
+ },
4695
+ sparse_active_node: {
4696
+ op: "investigate",
4697
+ confidence: "low",
4698
+ rationale: "Investigate for an honest second edge (story-to-task, defect family, cross-epic complement); sparse is not automatically defective."
4699
+ }
4700
+ };
4701
+ function formatStoredEdge(edge) {
4702
+ return `${edge.source} -${edge.kind}-> ${edge.target}`;
4703
+ }
4704
+ function stepsFromDuplicateGroup(group) {
4705
+ const [keeper, ...extras] = group.edges;
4706
+ return extras.map((edge) => ({
4707
+ op: "remove",
4708
+ code: "duplicate_edge",
4709
+ subject: formatStoredEdge(edge),
4710
+ rationale: "This stored spelling restates the kept canonical edge of the same semantic family; removing it leaves the relationship stated exactly once.",
4711
+ evidence: [
4712
+ `keep: ${formatStoredEdge(keeper)}`,
4713
+ `group: ${formatDuplicateEdgeGroup(group)}`
4714
+ ],
4715
+ confidence: "high"
4716
+ }));
4717
+ }
4718
+ function stepsFromFinding(finding, duplicateGroups) {
4719
+ if (finding.code === "duplicate_edge") {
4720
+ return finding.sample.flatMap((subject) => stepsFromDuplicateGroup(duplicateGroups.get(subject)));
4721
+ }
4722
+ const template = FINDING_STEP_TEMPLATES[finding.code];
4723
+ return finding.sample.map((subject) => ({
4724
+ op: template.op,
4725
+ code: finding.code,
4726
+ subject,
4727
+ rationale: template.rationale,
4728
+ evidence: [finding.policy],
4729
+ confidence: template.confidence
4730
+ }));
4731
+ }
4732
+ function planRelationshipRemediation(assembly, options = {}) {
4733
+ const { redundancyLimit, ...auditOptions } = options;
4734
+ const report = auditWorkspaceRelationshipGraph(assembly, auditOptions);
4735
+ const duplicateGroups = new Map(collectDuplicateRelationshipEdgeGroups(assembly).map((group) => [
4736
+ formatDuplicateEdgeGroup(group),
4737
+ group
4738
+ ]));
4739
+ const steps = report.findings.flatMap((finding) => stepsFromFinding(finding, duplicateGroups));
4740
+ let truncated = report.findings.some((finding) => finding.sample_truncated);
4741
+ options.signal?.throwIfAborted();
4742
+ const redundancy = findRedundantRelationshipEdges(assembly.graph, {
4743
+ limit: redundancyLimit ?? options.maxSampleSize ?? 25,
4744
+ ...options.signal === void 0 ? {} : { signal: options.signal }
4745
+ });
4746
+ for (const row of redundancy.value) {
4747
+ steps.push({
4748
+ op: "remove",
4749
+ code: "redundant_edge",
4750
+ subject: `${row.edge.source} -> ${row.edge.target} (${row.edge.kind})`,
4751
+ rationale: "The stored edge is implied by a longer same-family witness path; shortcut edges are sometimes deliberate emphasis, so confirm intent before removing.",
4752
+ evidence: [`witness: ${row.witness.join(" -> ")}`],
4753
+ confidence: "medium"
4754
+ });
4755
+ }
4756
+ truncated = truncated || redundancy.meta.truncated;
4757
+ return {
4758
+ steps,
4759
+ report,
4760
+ truncated,
4761
+ cost: {
4762
+ visitedNodes: redundancy.meta.visitedNodes,
4763
+ inspectedEdges: redundancy.meta.inspectedEdges
4764
+ }
4765
+ };
4766
+ }
4767
+
4768
+ // dist/sdk/graph/run.js
4769
+ !(function() {
4770
+ try {
4771
+ var e = "undefined" != typeof window ? window : "undefined" != typeof global ? global : "undefined" != typeof globalThis ? globalThis : "undefined" != typeof self ? self : {}, n = new e.Error().stack;
4772
+ n && (e._sentryDebugIds = e._sentryDebugIds || {}, e._sentryDebugIds[n] = "3d4c5f7b-bcd4-569b-8bea-b06cc9f115e5");
4773
+ } catch (e2) {
4774
+ }
4775
+ })();
4776
+ var ROOTED_SUBCOMMANDS = /* @__PURE__ */ new Set([
4777
+ "ancestors",
4778
+ "descendants",
4779
+ "predecessors",
4780
+ "successors",
4781
+ "paths",
4782
+ "impact",
4783
+ "dominators"
4784
+ ]);
4785
+ var DEFAULT_SAMPLE_LIMIT = 10;
4786
+ function normalizeIdList(raw) {
4787
+ if (raw === void 0)
4788
+ return [];
4789
+ return (Array.isArray(raw) ? raw : [raw]).flatMap((value) => value.split(",")).map((value) => value.trim()).filter((value) => value.length > 0);
4790
+ }
4791
+ function parseGraphSubcommand(raw, id, target) {
4792
+ const candidate = raw.trim().toLowerCase();
4793
+ if (!GRAPH_SUBCOMMAND_VALUES.includes(candidate)) {
4794
+ throw new PmCliError(`Invalid graph subcommand "${raw}". Use one of: ${GRAPH_SUBCOMMAND_VALUES.join(", ")}.`, EXIT_CODE.USAGE);
4795
+ }
4796
+ const subcommand = candidate;
4797
+ if (ROOTED_SUBCOMMANDS.has(subcommand) && !id?.trim()) {
4798
+ throw new PmCliError(`graph ${subcommand} requires an item id.`, EXIT_CODE.USAGE);
4799
+ }
4800
+ if (subcommand === "paths" && !target?.trim()) {
4801
+ throw new PmCliError("graph paths requires a source and a target item id.", EXIT_CODE.USAGE);
4802
+ }
4803
+ return subcommand;
4804
+ }
4805
+ function rethrowGraphUsage(error) {
4806
+ if (error instanceof TypeError)
4807
+ throw new PmCliError(error.message, EXIT_CODE.USAGE);
4808
+ throw error;
4809
+ }
4810
+ function projectQueryMeta(meta) {
4811
+ return {
4812
+ truncated: meta.truncated,
4813
+ cost: {
4814
+ visited_nodes: meta.visitedNodes,
4815
+ inspected_edges: meta.inspectedEdges
4816
+ }
4817
+ };
4818
+ }
4819
+ function canonicalizeGraphId(assembly, raw) {
4820
+ const wanted = raw.trim().toLowerCase();
4821
+ for (const detail of assembly.details) {
4822
+ if (detail.id.trim().toLowerCase() === wanted && !assembly.missingIdSet.has(detail.id.toLowerCase())) {
4823
+ return detail.id;
4824
+ }
4825
+ }
4826
+ throw new PmCliError(`Item ${raw} not found`, EXIT_CODE.NOT_FOUND);
4827
+ }
4828
+ function runGraphTraversal(subcommand, root, invocation) {
4829
+ const walk = {
4830
+ ancestors: hierarchyAncestors,
4831
+ descendants: hierarchyDescendants,
4832
+ predecessors: orderingPredecessors,
4833
+ successors: orderingSuccessors
4834
+ }[subcommand];
4835
+ let result;
4836
+ try {
4837
+ result = walk(invocation.assembly.graph, root, {
4838
+ ...invocation.kinds === void 0 ? {} : { kinds: invocation.kinds },
4839
+ ...invocation.maxDepth === void 0 ? {} : { maxDepth: invocation.maxDepth },
4840
+ ...invocation.limit === void 0 ? {} : { limit: invocation.limit },
4841
+ ...invocation.after === void 0 ? {} : { after: invocation.after }
4842
+ });
4843
+ } catch (error) {
4844
+ rethrowGraphUsage(error);
4845
+ }
4846
+ const meta = projectQueryMeta(result.meta);
4847
+ return {
4848
+ subcommand,
4849
+ root,
4850
+ count: result.value.length,
4851
+ ...meta,
4852
+ ...result.meta.nextCursor === void 0 ? {} : { next_cursor: result.meta.nextCursor },
4853
+ ...invocation.summary ? {} : { ids: result.value }
4854
+ };
4855
+ }
4856
+ function runGraphPaths(root, target, invocation) {
4857
+ const result = enumerateRelationshipPaths(invocation.assembly.graph, root, target, {
4858
+ direction: invocation.direction,
4859
+ ...invocation.kinds === void 0 ? {} : { kinds: invocation.kinds },
4860
+ ...invocation.maxDepth === void 0 ? {} : { maxDepth: invocation.maxDepth },
4861
+ ...invocation.maxPaths === void 0 ? {} : { maxPaths: invocation.maxPaths }
4862
+ });
4863
+ return {
4864
+ subcommand: "paths",
4865
+ root,
4866
+ target,
4867
+ direction: invocation.direction,
4868
+ count: result.value.length,
4869
+ ...projectQueryMeta(result.meta),
4870
+ ...invocation.summary ? {} : {
4871
+ paths: result.value.map((path3) => ({
4872
+ nodes: path3.nodes,
4873
+ kinds: path3.edges.map((edge) => edge.kind),
4874
+ length: path3.length
4875
+ }))
4876
+ }
4877
+ };
4878
+ }
4879
+ function runGraphImpact(root, invocation) {
4880
+ const analysis = analyzeGraphImpact(invocation.assembly.graph, root, {
4881
+ direction: invocation.direction,
4882
+ ...invocation.kinds === void 0 ? {} : { kinds: invocation.kinds },
4883
+ ...invocation.maxDepth === void 0 ? {} : { maxDepth: invocation.maxDepth },
4884
+ ...invocation.limit === void 0 ? {} : { limit: invocation.limit }
4885
+ });
4886
+ return {
4887
+ subcommand: "impact",
4888
+ root,
4889
+ direction: invocation.direction,
4890
+ count: analysis.affected.length,
4891
+ truncated: analysis.truncated,
4892
+ cost: {
4893
+ visited_nodes: analysis.cost.visitedNodes,
4894
+ inspected_edges: analysis.cost.inspectedEdges
4895
+ },
4896
+ ...invocation.summary ? {} : { affected: analysis.affected }
4897
+ };
4898
+ }
4899
+ function runGraphAnalyze(invocation) {
4900
+ const graph = invocation.assembly.graph;
4901
+ const sampleLimit = invocation.limit ?? DEFAULT_SAMPLE_LIMIT;
4902
+ const execution = analyzeRelationshipExecution(graph, {
4903
+ registry: graph.registry()
4904
+ });
4905
+ const knowledge = analyzeKnowledgeGraph(graph);
4906
+ return {
4907
+ subcommand: "analyze",
4908
+ node_count: graph.nodes().length,
4909
+ edge_count: graph.edges().length,
4910
+ sample_limit: sampleLimit,
4911
+ execution: {
4912
+ acyclic: execution.acyclic,
4913
+ ordered_node_count: execution.order.length,
4914
+ layer_count: execution.layers.length,
4915
+ frontier_count: execution.frontier.length,
4916
+ critical_path_length: execution.criticalPathLength,
4917
+ cycle_count: execution.cycles.length,
4918
+ ...invocation.summary ? {} : {
4919
+ frontier: execution.frontier.slice(0, sampleLimit),
4920
+ critical_path: execution.criticalPath.slice(0, sampleLimit),
4921
+ cycles: execution.cycles.slice(0, sampleLimit)
4922
+ }
4923
+ },
4924
+ knowledge: {
4925
+ component_count: knowledge.components.length,
4926
+ largest_component_size: knowledge.components[0]?.length ?? 0,
4927
+ orphan_count: knowledge.orphans.length,
4928
+ ...invocation.summary ? {} : {
4929
+ orphans: knowledge.orphans.slice(0, sampleLimit),
4930
+ hubs: knowledge.hubs.slice(0, sampleLimit)
4931
+ }
4932
+ }
4933
+ };
4934
+ }
4935
+ function runGraphAudit(invocation, isTerminal) {
4936
+ const report = auditWorkspaceRelationshipGraph(invocation.assembly, {
4937
+ isTerminal,
4938
+ ...invocation.sample === void 0 ? {} : { maxSampleSize: invocation.sample },
4939
+ ...invocation.exemptIsolates.length === 0 ? {} : { exemptIsolates: invocation.exemptIsolates }
4940
+ });
4941
+ const bySeverity = {};
4942
+ const byCode = {};
4943
+ for (const finding of report.findings) {
4944
+ bySeverity[finding.severity] = (bySeverity[finding.severity] ?? 0) + 1;
4945
+ byCode[finding.code] = (byCode[finding.code] ?? 0) + finding.count;
4946
+ }
4947
+ return {
4948
+ subcommand: "audit",
4949
+ finding_count: report.findings.length,
4950
+ findings_by_severity: bySeverity,
4951
+ findings_by_code: byCode,
4952
+ profile: report.profile,
4953
+ ...invocation.summary ? {} : { findings: report.findings }
4954
+ };
4955
+ }
4956
+ function runGraphCommunities(invocation) {
4957
+ const sampleLimit = invocation.limit ?? DEFAULT_SAMPLE_LIMIT;
4958
+ const result = detectRelationshipCommunities(invocation.assembly.graph, {
4959
+ ...invocation.kinds === void 0 ? {} : { kinds: invocation.kinds }
4960
+ });
4961
+ const analysis = result.value;
4962
+ return {
4963
+ subcommand: "communities",
4964
+ community_count: analysis.communities.length,
4965
+ largest_community_size: analysis.communities[0]?.size ?? 0,
4966
+ iterations: analysis.iterations,
4967
+ converged: analysis.converged,
4968
+ truncated: !analysis.converged || analysis.communities.length > sampleLimit,
4969
+ cost: {
4970
+ visited_nodes: result.meta.visitedNodes,
4971
+ inspected_edges: result.meta.inspectedEdges
4972
+ },
4973
+ ...invocation.summary ? {} : {
4974
+ communities: analysis.communities.slice(0, sampleLimit).map((community) => ({
4975
+ representative: community.representative,
4976
+ size: community.size,
4977
+ members: community.members.slice(0, sampleLimit)
4978
+ }))
4979
+ }
4980
+ };
4981
+ }
4982
+ function runGraphRedundancy(invocation) {
4983
+ let result;
4984
+ try {
4985
+ result = findRedundantRelationshipEdges(invocation.assembly.graph, {
4986
+ ...invocation.kinds === void 0 ? {} : { kinds: invocation.kinds },
4987
+ ...invocation.maxDepth === void 0 ? {} : { maxDepth: invocation.maxDepth },
4988
+ ...invocation.limit === void 0 ? {} : { limit: invocation.limit }
4989
+ });
4990
+ } catch (error) {
4991
+ rethrowGraphUsage(error);
4992
+ }
4993
+ return {
4994
+ subcommand: "redundancy",
4995
+ redundant_count: result.value.length,
4996
+ ...projectQueryMeta(result.meta),
4997
+ ...invocation.summary ? {} : {
4998
+ redundant: result.value.map((row) => ({
4999
+ source: row.edge.source,
5000
+ target: row.edge.target,
5001
+ kind: row.edge.kind,
5002
+ witness: row.witness
5003
+ }))
5004
+ }
5005
+ };
5006
+ }
5007
+ function runGraphDominators(root, invocation) {
5008
+ const limit = invocation.limit ?? DEFAULT_SAMPLE_LIMIT;
5009
+ const result = computeRelationshipDominators(invocation.assembly.graph, root, {
5010
+ direction: invocation.direction,
5011
+ ...invocation.kinds === void 0 ? {} : { kinds: invocation.kinds },
5012
+ ...invocation.maxDepth === void 0 ? {} : { maxDepth: invocation.maxDepth }
5013
+ });
5014
+ const bottlenecks = result.value.rows.filter((row) => row.dominatedCount > 0);
5015
+ return {
5016
+ subcommand: "dominators",
5017
+ root,
5018
+ direction: invocation.direction,
5019
+ reachable_count: result.value.reachableCount,
5020
+ bottleneck_count: bottlenecks.length,
5021
+ truncated: result.meta.truncated || bottlenecks.length > limit,
5022
+ cost: {
5023
+ visited_nodes: result.meta.visitedNodes,
5024
+ inspected_edges: result.meta.inspectedEdges
5025
+ },
5026
+ ...invocation.summary ? {} : {
5027
+ bottlenecks: bottlenecks.slice(0, limit).map((row) => ({
5028
+ id: row.id,
5029
+ idom: row.idom,
5030
+ dominated_count: row.dominatedCount
5031
+ }))
5032
+ }
5033
+ };
5034
+ }
5035
+ function runGraphPlan(invocation, isTerminal) {
5036
+ const limit = invocation.limit ?? DEFAULT_SAMPLE_LIMIT;
5037
+ const plan = planRelationshipRemediation(invocation.assembly, {
5038
+ isTerminal,
5039
+ redundancyLimit: limit,
5040
+ ...invocation.sample === void 0 ? {} : { maxSampleSize: invocation.sample },
5041
+ ...invocation.exemptIsolates.length === 0 ? {} : { exemptIsolates: invocation.exemptIsolates }
5042
+ });
5043
+ const byOp = {};
5044
+ const byCode = {};
5045
+ for (const step of plan.steps) {
5046
+ byOp[step.op] = (byOp[step.op] ?? 0) + 1;
5047
+ byCode[step.code] = (byCode[step.code] ?? 0) + 1;
5048
+ }
5049
+ return {
5050
+ subcommand: "plan",
5051
+ step_count: plan.steps.length,
5052
+ steps_by_op: byOp,
5053
+ steps_by_code: byCode,
5054
+ finding_count: plan.report.findings.length,
5055
+ truncated: plan.truncated || plan.steps.length > limit,
5056
+ cost: {
5057
+ visited_nodes: plan.cost.visitedNodes,
5058
+ inspected_edges: plan.cost.inspectedEdges
5059
+ },
5060
+ ...invocation.summary ? {} : { steps: plan.steps.slice(0, limit) }
5061
+ };
5062
+ }
5063
+ function buildGraphQueryKey(subcommand, root, pathsTarget, invocation) {
5064
+ return JSON.stringify({
5065
+ subcommand,
5066
+ root: root ?? null,
5067
+ target: pathsTarget ?? null,
5068
+ kinds: invocation.kinds ?? null,
5069
+ maxDepth: invocation.maxDepth ?? null,
5070
+ limit: invocation.limit ?? null,
5071
+ after: invocation.after ?? null,
5072
+ direction: invocation.direction,
5073
+ maxPaths: invocation.maxPaths ?? null,
5074
+ sample: invocation.sample ?? null,
5075
+ // The audit consumes exemptions as a case-insensitive set, so the key
5076
+ // must not distinguish logically identical spellings or orderings.
5077
+ exemptIsolates: [
5078
+ ...new Set(invocation.exemptIsolates.map((id) => id.toLowerCase()))
5079
+ ].sort(),
5080
+ summary: invocation.summary
5081
+ });
5082
+ }
5083
+ function executeGraphSubcommand(subcommand, root, pathsTarget, invocation, isTerminal) {
5084
+ if (subcommand === "analyze")
5085
+ return runGraphAnalyze(invocation);
5086
+ if (subcommand === "audit")
5087
+ return runGraphAudit(invocation, isTerminal);
5088
+ if (subcommand === "plan")
5089
+ return runGraphPlan(invocation, isTerminal);
5090
+ if (subcommand === "communities")
5091
+ return runGraphCommunities(invocation);
5092
+ if (subcommand === "redundancy")
5093
+ return runGraphRedundancy(invocation);
5094
+ if (subcommand === "dominators")
5095
+ return runGraphDominators(root, invocation);
5096
+ if (subcommand === "paths")
5097
+ return runGraphPaths(root, pathsTarget, invocation);
5098
+ if (subcommand === "impact")
5099
+ return runGraphImpact(root, invocation);
5100
+ return runGraphTraversal(subcommand, root, invocation);
5101
+ }
5102
+ async function runGraph(subcommandRaw, id, target, options, global2) {
5103
+ const subcommand = parseGraphSubcommand(subcommandRaw, id, target);
5104
+ const pmRoot = resolvePmRoot(process.cwd(), global2.path);
5105
+ if (!await pathExists(getSettingsPath(pmRoot))) {
5106
+ throw new PmCliError(`Tracker is not initialized at ${pmRoot}. Run pm init first.`, EXIT_CODE.NOT_FOUND);
5107
+ }
5108
+ const settings = await readSettings(pmRoot);
5109
+ const typeRegistry = resolveItemTypeRegistry(settings, getActiveExtensionRegistrations());
5110
+ const items = await listAllItemMetadataLight(pmRoot, settings.item_format, typeRegistry.type_to_folder, void 0, settings.schema);
5111
+ const statusRegistry = resolveRuntimeStatusRegistry(settings.schema);
5112
+ const isTerminal = (status) => isTerminalStatus(status, statusRegistry);
5113
+ const kinds = parseKinds(options.kind);
5114
+ const lookup = workspaceGraphCache().lookup(pmRoot, computeWorkspaceGraphFingerprint(items, isTerminal), () => assembleWorkspaceRelationshipGraph(items, isTerminal));
5115
+ const invocation = {
5116
+ assembly: lookup.assembly,
5117
+ ...kinds === void 0 ? {} : { kinds },
5118
+ maxDepth: parseMaxDepth(options.maxDepth),
5119
+ limit: parsePositiveInteger(options.limit, "limit"),
5120
+ after: options.after?.trim() || void 0,
5121
+ direction: parseDirection(options.direction),
5122
+ maxPaths: parsePositiveInteger(options.maxPaths, "max-paths"),
5123
+ sample: parsePositiveInteger(options.sample, "sample"),
5124
+ exemptIsolates: normalizeIdList(options.exemptIsolate),
5125
+ summary: options.summary === true
5126
+ };
5127
+ const root = ROOTED_SUBCOMMANDS.has(subcommand) ? canonicalizeGraphId(invocation.assembly, id) : void 0;
5128
+ const pathsTarget = subcommand === "paths" ? canonicalizeGraphId(invocation.assembly, target) : void 0;
5129
+ const memo = lookup.memoize(buildGraphQueryKey(subcommand, root, pathsTarget, invocation), () => executeGraphSubcommand(subcommand, root, pathsTarget, invocation, isTerminal));
5130
+ return {
5131
+ ...memo.value,
5132
+ cache: {
5133
+ fingerprint: lookup.fingerprint.slice(0, 12),
5134
+ assembly: lookup.assemblyReused ? "hit" : "miss",
5135
+ result: memo.reused ? "hit" : "miss"
5136
+ }
5137
+ };
5138
+ }
5139
+
5140
+ // dist/cli/commands/graph.js
5141
+ !(function() {
5142
+ try {
5143
+ var e = "undefined" != typeof window ? window : "undefined" != typeof global ? global : "undefined" != typeof globalThis ? globalThis : "undefined" != typeof self ? self : {}, n = new e.Error().stack;
5144
+ n && (e._sentryDebugIds = e._sentryDebugIds || {}, e._sentryDebugIds[n] = "d8b74ca9-e174-5143-91ab-32d40dfd3735");
5145
+ } catch (e2) {
5146
+ }
5147
+ })();
5148
+
5149
+ // dist/cli/commands/search.js
5150
+ !(function() {
5151
+ try {
5152
+ var e = "undefined" != typeof window ? window : "undefined" != typeof global ? global : "undefined" != typeof globalThis ? globalThis : "undefined" != typeof self ? self : {}, n = new e.Error().stack;
5153
+ n && (e._sentryDebugIds = e._sentryDebugIds || {}, e._sentryDebugIds[n] = "8fa83c44-d2f2-5f3b-8026-851048097d1f");
5154
+ } catch (e2) {
5155
+ }
5156
+ })();
5157
+
3427
5158
  export {
3428
5159
  runAggregate,
3429
5160
  runSearch,
5161
+ DEFAULT_EVAL_QUERIES_RELATIVE_PATH,
3430
5162
  runEval,
3431
5163
  MAX_CHILD_PROJECTION_ITEMS,
3432
5164
  DEFAULT_CHILD_SAMPLE_LIMIT,
3433
5165
  buildItemChildrenRollup,
3434
5166
  itemHasSchedule,
3435
5167
  buildItemSchedule,
3436
- runGet
5168
+ runGet,
5169
+ analyzeRelationshipExecution,
5170
+ analyzeGraphImpact,
5171
+ analyzeKnowledgeGraph,
5172
+ compareRelationshipSnapshots,
5173
+ hierarchyAncestors,
5174
+ hierarchyDescendants,
5175
+ orderingPredecessors,
5176
+ orderingSuccessors,
5177
+ enumerateRelationshipPaths,
5178
+ detectRelationshipCommunities,
5179
+ findRedundantRelationshipEdges,
5180
+ computeRelationshipDominators,
5181
+ formatDuplicateEdgeGroup,
5182
+ collectDuplicateRelationshipEdgeGroups,
5183
+ auditWorkspaceRelationshipGraph,
5184
+ planRelationshipRemediation,
5185
+ parseGraphSubcommand,
5186
+ runGraph
3437
5187
  };
3438
- //# sourceMappingURL=chunk-HYB5AZ63.js.map
5188
+ //# sourceMappingURL=chunk-GKPCTQYG.js.map