@herbertgao/pi-extensions 2026.11.6 → 2026.11.8

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 (419) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/README.md +9 -9
  3. package/THIRD_PARTY_NOTICES.md +2 -2
  4. package/node_modules/@herbertgao/pi-impeccable/CHANGELOG.md +6 -0
  5. package/node_modules/@herbertgao/pi-impeccable/README.md +2 -2
  6. package/node_modules/@herbertgao/pi-impeccable/package.json +4 -4
  7. package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/SKILL.md +1 -1
  8. package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/scripts/VERSION +1 -1
  9. package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/scripts/engine-checksums.txt +5 -5
  10. package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/scripts/live-browser.js +71 -56
  11. package/node_modules/@herbertgao/pi-subagents/CHANGELOG.md +6 -0
  12. package/node_modules/@herbertgao/pi-subagents/README.md +2 -2
  13. package/node_modules/@herbertgao/pi-subagents/package.json +4 -4
  14. package/node_modules/@herbertgao/pi-subagents/src/ui/conversation-viewer.ts +10 -6
  15. package/node_modules/@herbertgao/pi-subagents/src/ui/viewer-keys.ts +47 -4
  16. package/node_modules/@narumitw/pi-btw/CHANGELOG.md +12 -0
  17. package/node_modules/@narumitw/pi-btw/dist/chunks/{main-tree-picker-WHRN26NJ.ts → main-tree-picker-3PXJARQW.ts} +59 -53
  18. package/node_modules/@narumitw/pi-btw/dist/chunks/main-tree-picker-3PXJARQW.ts.map +7 -0
  19. package/node_modules/@narumitw/pi-btw/dist/index.ts +1 -1
  20. package/node_modules/@narumitw/pi-btw/docs/main-tree-snapshots.md +39 -0
  21. package/node_modules/@narumitw/pi-btw/docs/workflows.md +1 -0
  22. package/node_modules/@narumitw/pi-btw/package.json +1 -1
  23. package/node_modules/@narumitw/pi-btw/src/main-tree-picker.ts +73 -63
  24. package/node_modules/@pi-plugins/fast-mode/dist/index.d.mts +1 -4
  25. package/node_modules/@pi-plugins/fast-mode/dist/index.d.mts.map +1 -1
  26. package/node_modules/@pi-plugins/fast-mode/dist/index.mjs +5620 -2946
  27. package/node_modules/@pi-plugins/fast-mode/dist/index.mjs.map +1 -1
  28. package/node_modules/@pi-plugins/fast-mode/package.json +11 -11
  29. package/node_modules/pi-commandcode-provider/CHANGELOG.md +5 -0
  30. package/node_modules/pi-commandcode-provider/README.md +1 -1
  31. package/node_modules/pi-commandcode-provider/package.json +1 -1
  32. package/node_modules/pi-commandcode-provider/src/commandcode-catalog.ts +5 -4
  33. package/node_modules/pi-commandcode-provider/src/pricing.ts +8 -2
  34. package/node_modules/pi-lens/CHANGELOG-USER.md +12 -12
  35. package/node_modules/pi-lens/CHANGELOG.md +212 -0
  36. package/node_modules/pi-lens/README.md +1 -0
  37. package/node_modules/pi-lens/dist/{chunk-W4CUK5G6.js → chunk-2HWVG3IM.js} +2 -2
  38. package/node_modules/pi-lens/dist/{chunk-B2YUE6YD.js → chunk-3EIZMRXI.js} +11 -11
  39. package/node_modules/pi-lens/dist/{chunk-Y3EHLUPL.js → chunk-3MHY4BQY.js} +4 -4
  40. package/node_modules/pi-lens/dist/{chunk-IDCTDKIA.js → chunk-3PMLYGJN.js} +6 -6
  41. package/node_modules/pi-lens/dist/{chunk-VPFRU5IG.js → chunk-3QMLB4TI.js} +3 -3
  42. package/node_modules/pi-lens/dist/{chunk-NL5LSKVD.js → chunk-3R3Z54J7.js} +10 -4
  43. package/node_modules/pi-lens/dist/chunk-3VWEZ6H2.js +72 -0
  44. package/node_modules/pi-lens/dist/{chunk-YT2VR4SL.js → chunk-5EEWCJG7.js} +7 -7
  45. package/node_modules/pi-lens/dist/{chunk-4NCDHTFI.js → chunk-5FDUKJZO.js} +10 -10
  46. package/node_modules/pi-lens/dist/{chunk-QUQY3IME.js → chunk-5KLRCUDT.js} +9 -8
  47. package/node_modules/pi-lens/dist/{chunk-FOEPIX76.js → chunk-6EIV3H7O.js} +158 -61
  48. package/node_modules/pi-lens/dist/{chunk-GMC4ZGYR.js → chunk-6EXGCXM5.js} +5 -5
  49. package/node_modules/pi-lens/dist/{chunk-CTB5BAJI.js → chunk-6GWCYEP7.js} +17 -16
  50. package/node_modules/pi-lens/dist/{chunk-NBM7PNBP.js → chunk-6JLNZ6DP.js} +37 -26
  51. package/node_modules/pi-lens/dist/{chunk-ACRJ2GZ5.js → chunk-7424ANRU.js} +2 -2
  52. package/node_modules/pi-lens/dist/{chunk-TJQSYX3J.js → chunk-75TVYCQW.js} +6 -6
  53. package/node_modules/pi-lens/dist/{chunk-J6BR5XN2.js → chunk-7BEADGAZ.js} +3 -3
  54. package/node_modules/pi-lens/dist/chunk-7KWI5UHL.js +28 -0
  55. package/node_modules/pi-lens/dist/{chunk-GUGKKGG7.js → chunk-7M64NTAK.js} +3 -3
  56. package/node_modules/pi-lens/dist/{chunk-SKVNHCT5.js → chunk-7T64QA5D.js} +48 -43
  57. package/node_modules/pi-lens/dist/{chunk-YQA34KAF.js → chunk-7ZVEFWOE.js} +11 -11
  58. package/node_modules/pi-lens/dist/{chunk-SJQUWQR6.js → chunk-AAIVSSUU.js} +2 -2
  59. package/node_modules/pi-lens/dist/{chunk-6I44EDNQ.js → chunk-AD7JDEI6.js} +17 -15
  60. package/node_modules/pi-lens/dist/{chunk-3FRI5H4T.js → chunk-AGEQRJ5A.js} +24 -10
  61. package/node_modules/pi-lens/dist/{chunk-NPNFGYLV.js → chunk-AVBEPUCD.js} +19 -2
  62. package/node_modules/pi-lens/dist/{chunk-OTSTS7L2.js → chunk-AYDE7RFV.js} +34 -3
  63. package/node_modules/pi-lens/dist/{chunk-UOO4D2TK.js → chunk-AZXTLZHE.js} +34 -35
  64. package/node_modules/pi-lens/dist/{chunk-AWQWXSW4.js → chunk-B4FAFEBP.js} +7 -2
  65. package/node_modules/pi-lens/dist/{chunk-S3WFVG5P.js → chunk-BEIPWPVR.js} +137 -126
  66. package/node_modules/pi-lens/dist/{chunk-CZAWWXP6.js → chunk-BMMRLJA4.js} +7 -5
  67. package/node_modules/pi-lens/dist/{chunk-QWTHFFU6.js → chunk-C6V2DSZZ.js} +12 -12
  68. package/node_modules/pi-lens/dist/chunk-CIA7X2PZ.js +26 -0
  69. package/node_modules/pi-lens/dist/{chunk-ZD4KVFXI.js → chunk-D2ZYRI7M.js} +172 -3
  70. package/node_modules/pi-lens/dist/{chunk-F6FT6BVQ.js → chunk-D6ANA6YU.js} +34 -35
  71. package/node_modules/pi-lens/dist/{chunk-HILZE4BQ.js → chunk-D7OEGXDX.js} +396 -306
  72. package/node_modules/pi-lens/dist/{chunk-FCQSZQAT.js → chunk-DFAY7JUN.js} +14 -5
  73. package/node_modules/pi-lens/dist/{chunk-DOUAWKLO.js → chunk-DIIDMDZU.js} +12 -12
  74. package/node_modules/pi-lens/dist/{chunk-6MDM5MQT.js → chunk-DZSQXG66.js} +394 -162
  75. package/node_modules/pi-lens/dist/{chunk-QGITU23N.js → chunk-E3PNZDPH.js} +1 -1
  76. package/node_modules/pi-lens/dist/{chunk-QSCZAP24.js → chunk-E5SSUV2A.js} +4 -4
  77. package/node_modules/pi-lens/dist/{chunk-H65TYP6V.js → chunk-ET3DSSFZ.js} +37 -21
  78. package/node_modules/pi-lens/dist/chunk-F7AMFFVK.js +22 -0
  79. package/node_modules/pi-lens/dist/{chunk-4ITEFRDH.js → chunk-FDLGJFAE.js} +37 -145
  80. package/node_modules/pi-lens/dist/{chunk-XAFZJEXY.js → chunk-FVQKX5KI.js} +23 -23
  81. package/node_modules/pi-lens/dist/{chunk-CYUJB552.js → chunk-G3LR6V6N.js} +18 -12
  82. package/node_modules/pi-lens/dist/{chunk-ZOPXB2KK.js → chunk-GHATCG2A.js} +111 -107
  83. package/node_modules/pi-lens/dist/{chunk-XVB3Q2PG.js → chunk-HGEE5LDW.js} +3 -2
  84. package/node_modules/pi-lens/dist/{chunk-UNBRHPHJ.js → chunk-HJWF7CGW.js} +17 -15
  85. package/node_modules/pi-lens/dist/chunk-HRQTYU2T.js +355 -0
  86. package/node_modules/pi-lens/dist/{chunk-QUPYLQA4.js → chunk-HSTN27NR.js} +14 -9
  87. package/node_modules/pi-lens/dist/{chunk-YF4G5NN5.js → chunk-HWMNTQBJ.js} +2 -2
  88. package/node_modules/pi-lens/dist/{chunk-K6WIBVMK.js → chunk-HYDJUVOE.js} +8 -9
  89. package/node_modules/pi-lens/dist/{chunk-OPFNQBS5.js → chunk-HYR25MV3.js} +21 -25
  90. package/node_modules/pi-lens/dist/{chunk-MAD4QJTP.js → chunk-IC4L65U7.js} +21 -17
  91. package/node_modules/pi-lens/dist/{chunk-I32RSMH6.js → chunk-ILC2B7IJ.js} +11 -10
  92. package/node_modules/pi-lens/dist/{chunk-BGLS5SDN.js → chunk-IT7MFVGP.js} +2 -2
  93. package/node_modules/pi-lens/dist/{chunk-KDCIG23C.js → chunk-IZ36G463.js} +13 -9
  94. package/node_modules/pi-lens/dist/{chunk-ALIZWXHZ.js → chunk-JKAVKTMY.js} +9 -9
  95. package/node_modules/pi-lens/dist/{chunk-3HM4BUHR.js → chunk-JLMS7EMD.js} +16 -15
  96. package/node_modules/pi-lens/dist/{chunk-HSYFLOZY.js → chunk-JRSS6KM4.js} +3 -3
  97. package/node_modules/pi-lens/dist/{chunk-VCRVNLE7.js → chunk-K2GV34T2.js} +9 -1
  98. package/node_modules/pi-lens/dist/{chunk-KJ3AHOCK.js → chunk-K2LD6YNH.js} +10 -10
  99. package/node_modules/pi-lens/dist/chunk-KUDUKKQE.js +89 -0
  100. package/node_modules/pi-lens/dist/{chunk-7JX3RNG4.js → chunk-KXDQD34C.js} +1 -1
  101. package/node_modules/pi-lens/dist/{chunk-VGTBLTPN.js → chunk-LD7SXICE.js} +18 -66
  102. package/node_modules/pi-lens/dist/{chunk-UY745U35.js → chunk-ME6MF2N2.js} +1 -1
  103. package/node_modules/pi-lens/dist/{chunk-QHOTTC4A.js → chunk-MOEWCPMC.js} +2 -2
  104. package/node_modules/pi-lens/dist/{chunk-JZQGRARR.js → chunk-MV6ST2KT.js} +15 -12
  105. package/node_modules/pi-lens/dist/{chunk-QL37SGTS.js → chunk-NCDH2JB7.js} +18 -18
  106. package/node_modules/pi-lens/dist/{chunk-AON2QIJF.js → chunk-NRVWLTOY.js} +20 -17
  107. package/node_modules/pi-lens/dist/chunk-NZINZCHB.js +108 -0
  108. package/node_modules/pi-lens/dist/{chunk-A5TEJZGJ.js → chunk-O6LCSHHI.js} +1 -1
  109. package/node_modules/pi-lens/dist/{chunk-PTSA6QKL.js → chunk-OEPWTSUG.js} +8 -8
  110. package/node_modules/pi-lens/dist/{chunk-QMV2APEH.js → chunk-OF2YGDUE.js} +36 -36
  111. package/node_modules/pi-lens/dist/{chunk-GTTMQ6XB.js → chunk-OHEUOWYT.js} +1 -1
  112. package/node_modules/pi-lens/dist/{chunk-GVWIU7M7.js → chunk-ORYQGVC3.js} +41 -4
  113. package/node_modules/pi-lens/dist/{chunk-KSTQ4VXT.js → chunk-OVPR3GQ6.js} +10 -13
  114. package/node_modules/pi-lens/dist/{chunk-MN635QYA.js → chunk-OYXD2MOM.js} +3 -3
  115. package/node_modules/pi-lens/dist/{chunk-TN5CWX5D.js → chunk-PCREZ4HJ.js} +34 -35
  116. package/node_modules/pi-lens/dist/{chunk-SG2JQ2YP.js → chunk-PK3GDU4M.js} +1 -1
  117. package/node_modules/pi-lens/dist/{chunk-NE4EFHJX.js → chunk-PPYUBO6Y.js} +2 -2
  118. package/node_modules/pi-lens/dist/{chunk-DVRJBQOJ.js → chunk-PTJXMYRY.js} +19 -20
  119. package/node_modules/pi-lens/dist/{chunk-TYHOEX4V.js → chunk-PXGVB2CY.js} +36 -39
  120. package/node_modules/pi-lens/dist/{chunk-LT62P654.js → chunk-QJ4T73J5.js} +1 -1
  121. package/node_modules/pi-lens/dist/{chunk-2LVJQU3I.js → chunk-QY6J2FTK.js} +33 -29
  122. package/node_modules/pi-lens/dist/{chunk-ZZDVGCGG.js → chunk-R67WQ5RY.js} +9 -9
  123. package/node_modules/pi-lens/dist/{chunk-Q2VCKC3X.js → chunk-S6ZQFPOX.js} +11 -8
  124. package/node_modules/pi-lens/dist/{chunk-KFRDFAOE.js → chunk-SF7KSXB5.js} +7 -7
  125. package/node_modules/pi-lens/dist/{chunk-CZCAZVTD.js → chunk-SRXYSLMW.js} +2 -2
  126. package/node_modules/pi-lens/dist/{chunk-WS3UFJOU.js → chunk-SUIZOCSY.js} +3 -2
  127. package/node_modules/pi-lens/dist/{chunk-NUSXS6YB.js → chunk-T5EGSBM2.js} +4 -4
  128. package/node_modules/pi-lens/dist/{chunk-V7F7JHS5.js → chunk-T6PPK3T6.js} +563 -554
  129. package/node_modules/pi-lens/dist/chunk-TM3A3K7T.js +28 -0
  130. package/node_modules/pi-lens/dist/{chunk-RQRKIRFY.js → chunk-TOOXNL6M.js} +8 -8
  131. package/node_modules/pi-lens/dist/chunk-TS5EIWEF.js +25 -0
  132. package/node_modules/pi-lens/dist/chunk-VD7MQFEV.js +56 -0
  133. package/node_modules/pi-lens/dist/{chunk-2ADRLTM2.js → chunk-VU2PRGRI.js} +6 -35
  134. package/node_modules/pi-lens/dist/chunk-W6VLB6LL.js +145 -0
  135. package/node_modules/pi-lens/dist/{chunk-CB7PEVOJ.js → chunk-WLD6BGON.js} +176 -60
  136. package/node_modules/pi-lens/dist/{chunk-C6AODRNU.js → chunk-WTSQKJAR.js} +11 -10
  137. package/node_modules/pi-lens/dist/{chunk-46TQJSUE.js → chunk-X33QECRJ.js} +2 -2
  138. package/node_modules/pi-lens/dist/{chunk-B6HXETWY.js → chunk-Y7XMKBFP.js} +28 -26
  139. package/node_modules/pi-lens/dist/{chunk-TLWFZ66Y.js → chunk-YLHJWAQS.js} +4 -4
  140. package/node_modules/pi-lens/dist/{chunk-BRESRQBE.js → chunk-YLW26OHX.js} +8 -8
  141. package/node_modules/pi-lens/dist/{chunk-IL6PIV33.js → chunk-YTXFNCVN.js} +2 -2
  142. package/node_modules/pi-lens/dist/chunk-YULIERZW.js +27 -0
  143. package/node_modules/pi-lens/dist/chunk-Z2W5YJBW.js +25 -0
  144. package/node_modules/pi-lens/dist/{chunk-XPGH5O74.js → chunk-Z6WTLVUL.js} +30 -39
  145. package/node_modules/pi-lens/dist/{chunk-W7TY6HYX.js → chunk-ZRQMENT4.js} +5 -27
  146. package/node_modules/pi-lens/dist/{chunk-E4VXKTBR.js → chunk-ZWZD4TJ5.js} +163 -173
  147. package/node_modules/pi-lens/dist/index.js +6405 -4497
  148. package/node_modules/pi-lens/dist/mcp/analyze-cli.js +17 -13
  149. package/node_modules/pi-lens/dist/mcp/cli.js +42 -43
  150. package/node_modules/pi-lens/dist/mcp/server.js +1520 -608
  151. package/node_modules/pi-lens/dist/mcp/worker.js +62 -61
  152. package/node_modules/pi-lens/dist/probes/installer.js +19 -18
  153. package/node_modules/pi-lens/docs/agent-guide.md +3 -1
  154. package/node_modules/pi-lens/docs/agent-tools.md +57 -13
  155. package/node_modules/pi-lens/docs/alignment-families.md +5 -1
  156. package/node_modules/pi-lens/docs/ci.md +120 -0
  157. package/node_modules/pi-lens/docs/configuration.md +24 -6
  158. package/node_modules/pi-lens/docs/custom-rules.md +1 -0
  159. package/node_modules/pi-lens/docs/defect-shapes.md +107 -71
  160. package/node_modules/pi-lens/docs/durable-store-audit-1202.md +1 -1
  161. package/node_modules/pi-lens/docs/engineering-principles.md +46 -12
  162. package/node_modules/pi-lens/docs/environment-variables.md +25 -2
  163. package/node_modules/pi-lens/docs/features.md +1 -1
  164. package/node_modules/pi-lens/docs/globalconfig.md +8 -1
  165. package/node_modules/pi-lens/docs/invariants/dispatch-runners.md +13 -0
  166. package/node_modules/pi-lens/docs/invariants/lsp-trust-exec.md +7 -0
  167. package/node_modules/pi-lens/docs/language-coverage.md +1 -1
  168. package/node_modules/pi-lens/docs/lsp-capability-matrix.md +15 -16
  169. package/node_modules/pi-lens/docs/lsp-idle-eviction.md +1 -1
  170. package/node_modules/pi-lens/docs/mcp.md +2 -1
  171. package/node_modules/pi-lens/docs/module-report-read-symbol.md +2 -2
  172. package/node_modules/pi-lens/docs/pi-lens-fixer.md +3 -2
  173. package/node_modules/pi-lens/docs/pi-lens-merge-policy.md +1 -0
  174. package/node_modules/pi-lens/docs/pi-lens-monitor.md +4 -1
  175. package/node_modules/pi-lens/docs/pi-lens-release.md +19 -0
  176. package/node_modules/pi-lens/docs/pi-lens-reviewer.md +8 -2
  177. package/node_modules/pi-lens/docs/public-api-stability.md +41 -6
  178. package/node_modules/pi-lens/docs/rfcs/5138-query-surface.md +121 -0
  179. package/node_modules/pi-lens/docs/servercapabilities.md +1 -1
  180. package/node_modules/pi-lens/docs/settings.md +9 -0
  181. package/node_modules/pi-lens/docs/usage.md +1 -1
  182. package/node_modules/pi-lens/docs/word-index.md +9 -10
  183. package/node_modules/pi-lens/package.json +3 -3
  184. package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/README.md +2 -0
  185. package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/c/security/dont-call-system-c.yml +2 -1
  186. package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/c/security/file-access-before-action-c.yml +2 -1
  187. package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/c/security/file-stat-before-action-c.yml +2 -1
  188. package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/c/security/insecure-hash-c.yml +2 -1
  189. package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/c/security/libxml2-audit-parser-c.yml +2 -1
  190. package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/c/security/null-library-function-c.yml +2 -1
  191. package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/c/security/sizeof-this-c.yml +2 -1
  192. package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/c/security/small-key-size-c.yml +2 -1
  193. package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/c/security/world-writable-file-c.yml +2 -1
  194. package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/cpp/security/dont-call-system-cpp.yml +2 -1
  195. package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/cpp/security/file-access-before-action-cpp.yml +2 -1
  196. package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/cpp/security/file-stat-before-action-cpp.yml +2 -1
  197. package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/cpp/security/fix-format-security-error-cpp.yml +2 -1
  198. package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/cpp/security/insecure-hash-cpp.yml +2 -1
  199. package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/cpp/security/libxml2-audit-parser-cpp.yml +2 -1
  200. package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/cpp/security/missing-nul-cpp-string-memcpy-cpp.yml +2 -1
  201. package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/cpp/security/null-library-function-cpp.yml +2 -1
  202. package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/cpp/security/return-c-str-cpp.yml +2 -1
  203. package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/cpp/security/sizeof-this-cpp.yml +2 -1
  204. package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/cpp/security/small-key-size-cpp.yml +2 -1
  205. package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/cpp/security/std-return-data-cpp.yml +2 -1
  206. package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/cpp/security/std-vector-invalidation-cpp.yml +2 -1
  207. package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/cpp/security/string-view-temporary-string-cpp.yml +2 -1
  208. package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/cpp/security/world-writable-file-cpp.yml +2 -1
  209. package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/csharp/security/httponly-false-csharp.yml +2 -1
  210. package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/csharp/security/insecure-binaryformatter-deserialization-csharp.yml +2 -1
  211. package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/csharp/security/jwt-decode-without-verify-csharp.yml +2 -1
  212. package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/csharp/security/jwt-hardcoded-secret-csharp.yml +2 -1
  213. package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/csharp/security/jwt-tokenvalidationparameters-no-expiry-validation-csharp.yml +2 -1
  214. package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/csharp/security/networkcredential-hardcoded-secret-python.yml +2 -1
  215. package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/csharp/security/npgsqlconnectionstringbuilder-hardcoded-secret-csharp.yml +2 -1
  216. package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/csharp/security/oracleconnectionstringbuilder-hardcoded-secret-csharp.yml +2 -1
  217. package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/csharp/security/sqlconnectionstringbuilder-hardcoded-secret-csharp.yml +2 -1
  218. package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/csharp/security/stacktrace-disclosure-csharp.yml +2 -1
  219. package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/csharp/security/use-ecb-mode-csharp.yml +2 -1
  220. package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/go/security/avoid-bind-to-all-interfaces-go.yml +2 -1
  221. package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/go/security/gorilla-cookie-store-hardcoded-session-key-go.yml +2 -1
  222. package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/go/security/gorilla-csrf-hardcoded-auth-key-go.yml +2 -1
  223. package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/go/security/grpc-client-insecure-connection-go.yml +2 -1
  224. package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/go/security/jwt-go-none-algorithm-go.yml +2 -1
  225. package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/go/security/missing-ssl-minversion-go.yml +2 -1
  226. package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/go/security/openai-empty-secret-go.yml +2 -1
  227. package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/go/security/openai-hardcoded-secret-go.yml +2 -1
  228. package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/go/security/ssl-v3-is-insecure-go.yml +2 -1
  229. package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/go/security/tls-with-insecure-cipher-go.yml +2 -1
  230. package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/go/security/use-of-weak-rsa-key-go.yml +2 -1
  231. package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/html/security/plaintext-http-link-html.yml +2 -1
  232. package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/java/security/cbc-padding-oracle-java.yml +2 -1
  233. package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/java/security/cookie-httponly-false-java.yml +2 -1
  234. package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/java/security/cookie-missing-httponly-java.yml +2 -1
  235. package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/java/security/cookie-missing-samesite-java.yml +2 -1
  236. package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/java/security/cookie-missing-secure-flag-java.yml +2 -1
  237. package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/java/security/cookie-secure-flag-false-java.yml +2 -1
  238. package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/java/security/datanucleus-hardcoded-connection-password-java.yml +2 -1
  239. package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/java/security/des-is-deprecated-java.yml +2 -1
  240. package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/java/security/desede-is-deprecated-java.yml +2 -1
  241. package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/java/security/documentbuilderfactory-disallow-doctype-decl-false-java.yml +2 -1
  242. package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/java/security/documentbuilderfactory-external-general-entities-true-java.yml +2 -1
  243. package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/java/security/documentbuilderfactory-external-parameter-entities-true-java.yml +2 -1
  244. package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/java/security/drivermanager-hardcoded-secret-java.yml +2 -1
  245. package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/java/security/ecb-cipher-java.yml +2 -1
  246. package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/java/security/hardcoded-connection-password-java.yml +2 -1
  247. package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/java/security/hardcoded-secret-in-credentials-java.yml +2 -1
  248. package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/java/security/java-jwt-hardcoded-secret-java.yml +2 -1
  249. package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/java/security/jedis-jedisclientconfig-hardcoded-password-java.yml +2 -1
  250. package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/java/security/jedis-jedisfactory-hardcoded-password-java.yml +2 -1
  251. package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/java/security/missing-httponly-java.yml +2 -1
  252. package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/java/security/missing-secure-java.yml +2 -1
  253. package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/java/security/no-null-cipher-java.yml +2 -1
  254. package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/java/security/passwordauthentication-hardcoded-password-java.yml +2 -1
  255. package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/java/security/rsa-no-padding-java.yml +2 -1
  256. package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/java/security/simple-command-injection-direct-input-java.yml +2 -1
  257. package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/java/security/system-setproperty-hardcoded-secret-java.yml +2 -1
  258. package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/java/security/unencrypted-socket-java.yml +2 -1
  259. package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/java/security/use-of-aes-ecb-java.yml +2 -1
  260. package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/java/security/use-of-blowfish-java.yml +2 -1
  261. package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/java/security/use-of-default-aes-java.yml +2 -1
  262. package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/java/security/use-of-md5-digest-utils-java.yml +2 -1
  263. package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/java/security/use-of-md5-java.yml +2 -1
  264. package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/java/security/use-of-rc2-java.yml +2 -1
  265. package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/java/security/use-of-rc4-java.yml +2 -1
  266. package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/java/security/use-of-sha1-java.yml +2 -1
  267. package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/java/security/weak-ssl-context-java.yml +2 -1
  268. package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/javascript/security/detect-angular-sce-disabled-javascript.yml +2 -1
  269. package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/javascript/security/express-jwt-hardcoded-secret-javascript.yml +2 -1
  270. package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/javascript/security/express-session-hardcoded-secret-javascript.yml +2 -1
  271. package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/javascript/security/jwt-simple-noverify-javascript.yml +2 -1
  272. package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/javascript/security/node-rsa-weak-key-javascript.yml +2 -1
  273. package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/javascript/security/node-sequelize-empty-password-argument-javascript.yml +2 -1
  274. package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/javascript/security/node-sequelize-hardcoded-secret-argument-javascript.yml +2 -1
  275. package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/kotlin/security/des-is-deprecated-kotlin.yml +2 -1
  276. package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/kotlin/security/desede-is-deprecated-kotlin.yml +2 -1
  277. package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/kotlin/security/jwt-hardcode-kotlin.yml +2 -1
  278. package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/kotlin/security/rsa-no-padding-kotlin.yml +2 -1
  279. package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/kotlin/security/system-setproperty-hardcoded-secret-kotlin.yml +2 -1
  280. package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/php/security/openssl-cbc-static-iv-php.yml +2 -1
  281. package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/php/security/search-active-debug-php.yml +2 -1
  282. package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/python/security/avoid-mktemp-python.yml +2 -1
  283. package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/python/security/avoid_app_run_with_bad_host-python.yml +2 -1
  284. package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/python/security/debug-enabled-python.yml +2 -1
  285. package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/python/security/hashids-with-django-secret-python.yml +2 -1
  286. package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/python/security/hashids-with-flask-secret-python.yml +2 -1
  287. package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/python/security/insecure-cipher-algorithm-rc4-python.yml +2 -1
  288. package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/python/security/jwt-python-hardcoded-secret-python.yml +2 -1
  289. package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/python/security/openai-hardcoded-secret-python.yml +2 -1
  290. package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/python/security/python-cassandra-empty-password-python.yml +2 -1
  291. package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/python/security/python-cassandra-hardcoded-secret-python.yml +2 -1
  292. package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/python/security/python-couchbase-empty-password-python.yml +2 -1
  293. package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/python/security/python-couchbase-hardcoded-secret-python.yml +2 -1
  294. package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/python/security/python-elasticsearch-hardcoded-bearer-auth-python.yml +2 -1
  295. package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/python/security/python-ldap3-empty-password-python.yml +2 -1
  296. package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/python/security/python-ldap3-hardcoded-secret-python.yml +2 -1
  297. package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/python/security/python-mariadb-empty-password-python.yml +2 -1
  298. package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/python/security/python-mariadb-hardcoded-secret-python.yml +2 -1
  299. package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/python/security/python-mysql-empty-password-python.yml +2 -1
  300. package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/python/security/python-mysql-hardcoded-secret-python.yml +2 -1
  301. package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/python/security/python-mysqlclient-empty-password-python.yml +2 -1
  302. package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/python/security/python-mysqlclient-hardcoded-secret-python.yml +2 -1
  303. package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/python/security/python-neo4j-empty-password-python.yml +2 -1
  304. package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/python/security/python-neo4j-hardcoded-secret-python.yml +2 -1
  305. package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/python/security/python-peewee-mysql-empty-password-python.yml +2 -1
  306. package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/python/security/python-peewee-mysql-hardcoded-secret-python.yml +2 -1
  307. package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/python/security/python-peewee-pg-empty-password-python.yml +2 -1
  308. package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/python/security/python-peewee-pg-hardcoded-secret-python.yml +2 -1
  309. package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/python/security/python-pg8000-empty-password-python.yml +2 -1
  310. package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/python/security/python-pg8000-hardcoded-secret-python.yml +2 -1
  311. package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/python/security/python-psycopg2-empty-password-python.yml +2 -1
  312. package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/python/security/python-psycopg2-hardcoded-secret-python.yml +2 -1
  313. package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/python/security/python-pyjwt-hardcoded-secret-python.yml +2 -1
  314. package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/python/security/python-pymongo-empty-password-python.yml +2 -1
  315. package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/python/security/python-pymongo-hardcoded-secret-python.yml +2 -1
  316. package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/python/security/python-pymssql-empty-password-python.yml +2 -1
  317. package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/python/security/python-pymssql-hardcoded-secret-python.yml +2 -1
  318. package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/python/security/python-pymysql-empty-password-python.yml +2 -1
  319. package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/python/security/python-pymysql-hardcoded-secret-python.yml +2 -1
  320. package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/python/security/python-redis-empty-password-python.yml +2 -1
  321. package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/python/security/python-redis-hardcoded-secret-python.yml +2 -1
  322. package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/python/security/python-requests-empty-password-python.yml +2 -1
  323. package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/python/security/python-requests-hardcoded-secret-python.yml +2 -1
  324. package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/python/security/python-requests-oauth-hardcoded-secret-python.yml +2 -1
  325. package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/python/security/python-tormysql-empty-password-python.yml +2 -1
  326. package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/python/security/python-tormysql-hardcoded-secret-python.yml +2 -1
  327. package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/python/security/python-urllib3-hardcoded-secret-python.yml +2 -1
  328. package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/python/security/python-webrepl-empty-password-python.yml +2 -1
  329. package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/python/security/python-webrepl-hardcoded-secret-python.yml +2 -1
  330. package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/ruby/security/force-ssl-false-ruby.yml +2 -1
  331. package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/ruby/security/hardcoded-http-auth-in-controller-ruby.yml +2 -1
  332. package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/ruby/security/hardcoded-secret-rsa-passphrase-ruby.yml +2 -1
  333. package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/ruby/security/insufficient-rsa-key-size-ruby.yml +2 -1
  334. package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/ruby/security/ruby-aws-sdk-hardcoded-secret-ruby.yml +2 -1
  335. package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/ruby/security/ruby-cassandra-empty-password-ruby.yml +2 -1
  336. package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/ruby/security/ruby-cassandra-hardcoded-secret-ruby.yml +2 -1
  337. package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/ruby/security/ruby-excon-hardcoded-secret-ruby.yml +2 -1
  338. package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/ruby/security/ruby-faraday-hardcoded-secret-ruby.yml +2 -1
  339. package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/ruby/security/ruby-mongo-empty-password-ruby.yml +2 -1
  340. package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/ruby/security/ruby-mongo-hardcoded-secret-ruby.yml +2 -1
  341. package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/ruby/security/ruby-mysql2-empty-password-ruby.yml +2 -1
  342. package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/ruby/security/ruby-mysql2-hardcoded-secret-ruby.yml +2 -1
  343. package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/ruby/security/ruby-octokit-hardcoded-secret-ruby.yml +2 -1
  344. package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/ruby/security/ruby-pg-empty-password-ruby.yml +2 -1
  345. package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/ruby/security/ruby-pg-hardcoded-secret-ruby.yml +2 -1
  346. package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/ruby/security/ruby-redis-empty-password-ruby.yml +2 -1
  347. package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/ruby/security/ruby-redis-hardcoded-secret-ruby.yml +2 -1
  348. package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/rust/security/empty-password-rust.yml +2 -1
  349. package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/rust/security/hardcoded-password-rust.yml +2 -1
  350. package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/rust/security/postgres-empty-password-rust.yml +2 -1
  351. package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/rust/security/reqwest-accept-invalid-rust.yml +2 -1
  352. package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/rust/security/secrets-reqwest-hardcoded-auth-rust.yml +2 -1
  353. package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/rust/security/ssl-verify-none-rust.yml +2 -1
  354. package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/rust/security/tokio-postgres-empty-password-rust.yml +2 -1
  355. package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/rust/security/tokio-postgres-hardcoded-password-rust.yml +2 -1
  356. package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/scala/security/jwt-scala-hardcode-scala.yml +2 -1
  357. package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/scala/security/scala-jwt-hardcoded-secret-scala.yml +2 -1
  358. package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/swift/security/aes-hardcoded-secret-swift.yml +2 -1
  359. package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/swift/security/blowfish-hardcoded-secret-swift.yml +2 -1
  360. package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/swift/security/chacha20-hardcoded-secret-swift.yml +2 -1
  361. package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/swift/security/insecure-biometrics-swift.yml +2 -1
  362. package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/swift/security/rabbit-hardcoded-secret-swift.yml +2 -1
  363. package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/typescript/security/detect-angular-sce-disabled-typescript.yml +2 -1
  364. package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/typescript/security/express-session-hardcoded-secret-typescript.yml +2 -1
  365. package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/typescript/security/jwt-simple-noverify-typescript.yml +2 -1
  366. package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/typescript/security/node-rsa-weak-key-typescript.yml +2 -1
  367. package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/typescript/security/node-sequelize-empty-password-argument-typescript.yml +2 -1
  368. package/node_modules/pi-lens/rules/ast-grep-rules/coderabbit/rules/typescript/security/node-sequelize-hardcoded-secret-argument-typescript.yml +2 -1
  369. package/node_modules/pi-lens/rules/ast-grep-rules/rule-schema.json +1 -1
  370. package/node_modules/pi-lens/rules/ast-grep-rules/rules/c-no-malloc-free.yml +13 -12
  371. package/node_modules/pi-lens/rules/ast-grep-rules/rules/cpp-no-malloc-free.yml +11 -10
  372. package/node_modules/pi-lens/rules/ast-grep-rules/rules/cpp-no-printf.yml +10 -9
  373. package/node_modules/pi-lens/rules/ast-grep-rules/rules/go-defer-func-call-antipattern.yml +14 -13
  374. package/node_modules/pi-lens/rules/ast-grep-rules/rules/go-no-fmt-println.yml +14 -13
  375. package/node_modules/pi-lens/rules/ast-grep-rules/rules/go-no-panic-in-lib.yml +20 -19
  376. package/node_modules/pi-lens/rules/ast-grep-rules/rules/go-no-underscore-func-name.yml +14 -13
  377. package/node_modules/pi-lens/rules/ast-grep-rules/rules/go-prefer-errors-is.yml +14 -13
  378. package/node_modules/pi-lens/rules/ast-grep-rules/rules/go-prefer-string-builder.yml +19 -18
  379. package/node_modules/pi-lens/rules/ast-grep-rules/rules/go-test-functions.yml +14 -13
  380. package/node_modules/pi-lens/rules/ast-grep-rules/rules/hyphenated-svg-attribute.yml +10 -9
  381. package/node_modules/pi-lens/rules/ast-grep-rules/rules/kotlin-no-lateinit.yml +12 -11
  382. package/node_modules/pi-lens/rules/ast-grep-rules/rules/kotlin-no-nullable-boolean.yml +11 -10
  383. package/node_modules/pi-lens/rules/ast-grep-rules/rules/kotlin-no-println.yml +15 -14
  384. package/node_modules/pi-lens/rules/ast-grep-rules/rules/kotlin-no-unnecessary-let.yml +10 -9
  385. package/node_modules/pi-lens/rules/ast-grep-rules/rules/kotlin-no-unsafe-cast.yml +10 -9
  386. package/node_modules/pi-lens/rules/ast-grep-rules/rules/kotlin-no-var.yml +11 -10
  387. package/node_modules/pi-lens/rules/ast-grep-rules/rules/kotlin-prefer-data-class.yml +10 -9
  388. package/node_modules/pi-lens/rules/ast-grep-rules/rules/kotlin-prefer-is-empty.yml +10 -9
  389. package/node_modules/pi-lens/rules/ast-grep-rules/rules/no-aws-access-key-literal.yml +1 -1
  390. package/node_modules/pi-lens/rules/ast-grep-rules/rules/no-compile-call.yml +13 -12
  391. package/node_modules/pi-lens/rules/ast-grep-rules/rules/no-flask-secret-key-literal.yml +1 -1
  392. package/node_modules/pi-lens/rules/ast-grep-rules/rules/no-hardcoded-password.yml +1 -1
  393. package/node_modules/pi-lens/rules/ast-grep-rules/rules/no-marshal-load.yml +12 -11
  394. package/node_modules/pi-lens/rules/ast-grep-rules/rules/no-python-sql-string-concat.yml +12 -11
  395. package/node_modules/pi-lens/rules/ast-grep-rules/rules/no-requests-verify-false.yml +13 -12
  396. package/node_modules/pi-lens/rules/ast-grep-rules/rules/no-secret-in-env-var-name.yml +1 -1
  397. package/node_modules/pi-lens/rules/ast-grep-rules/rules/python-optional-type.yml +9 -8
  398. package/node_modules/pi-lens/rules/ast-grep-rules/rules/reducible-list-comprehension.yml +8 -7
  399. package/node_modules/pi-lens/rules/ast-grep-rules/rules/ruby-detect-path-traversal.yml +14 -13
  400. package/node_modules/pi-lens/rules/ast-grep-rules/rules/ruby-symbol-to-proc-candidate.yml +8 -7
  401. package/node_modules/pi-lens/rules/ast-grep-rules/rules/rust-no-chars-enumerate.yml +9 -8
  402. package/node_modules/pi-lens/rules/ast-grep-rules/rules-disabled/gorm-unbounded-preload.yml +7 -6
  403. package/node_modules/pi-lens/rules/ast-grep-rules/rules-disabled/shadow-err-variable.yml +6 -5
  404. package/node_modules/pi-lens/scripts/analyze-pi-lens-logs.mjs +262 -3
  405. package/node_modules/pi-lens/scripts/lib/latency-log-phases.mjs +125 -0
  406. package/package.json +8 -8
  407. package/node_modules/@narumitw/pi-btw/dist/chunks/main-tree-picker-WHRN26NJ.ts.map +0 -7
  408. package/node_modules/pi-lens/dist/chunk-3QWVOBZJ.js +0 -73
  409. package/node_modules/pi-lens/dist/chunk-7WJ55KBN.js +0 -162
  410. package/node_modules/pi-lens/dist/chunk-BDR5MEZY.js +0 -25
  411. package/node_modules/pi-lens/dist/chunk-CKEQFGLT.js +0 -32
  412. package/node_modules/pi-lens/dist/chunk-DBS736MA.js +0 -57
  413. package/node_modules/pi-lens/dist/chunk-I74RQGKA.js +0 -88
  414. package/node_modules/pi-lens/dist/chunk-IK4YS3KC.js +0 -25
  415. package/node_modules/pi-lens/dist/chunk-JKOZ2Z4U.js +0 -20
  416. package/node_modules/pi-lens/dist/chunk-TQHOKMVZ.js +0 -28
  417. package/node_modules/pi-lens/dist/chunk-VS2L7QDI.js +0 -25
  418. package/node_modules/pi-lens/dist/chunk-WAA63ZJV.js +0 -140
  419. package/node_modules/pi-lens/dist/chunk-ZPFLHB3R.js +0 -28
@@ -7,18 +7,18 @@ import {
7
7
  deadCodeIssues,
8
8
  formatDeadCodeDelta,
9
9
  stableFindingKey
10
- } from "../chunk-ALIZWXHZ.js";
10
+ } from "../chunk-JKAVKTMY.js";
11
11
  import {
12
12
  clearFormatterCache
13
- } from "../chunk-UOO4D2TK.js";
13
+ } from "../chunk-AZXTLZHE.js";
14
14
  import {
15
15
  findNearestProjectRoot,
16
16
  isStartupScanVerdictFresh,
17
17
  resolveStartupScanContext
18
- } from "../chunk-Q2VCKC3X.js";
18
+ } from "../chunk-S6ZQFPOX.js";
19
19
  import {
20
20
  loadCallGraph
21
- } from "../chunk-J6BR5XN2.js";
21
+ } from "../chunk-7BEADGAZ.js";
22
22
  import {
23
23
  isHardFailureSummary
24
24
  } from "../chunk-7U2IDNXN.js";
@@ -28,15 +28,15 @@ import {
28
28
  isCompletedPassResult,
29
29
  isExcludedTestTarget,
30
30
  isRunnerErrorResult
31
- } from "../chunk-DOUAWKLO.js";
31
+ } from "../chunk-DIIDMDZU.js";
32
32
  import {
33
33
  GovulncheckClient
34
- } from "../chunk-PTSA6QKL.js";
34
+ } from "../chunk-OEPWTSUG.js";
35
35
  import {
36
36
  GitleaksClient,
37
37
  classifyAndFilterFindings
38
- } from "../chunk-CYUJB552.js";
39
- import "../chunk-GVWIU7M7.js";
38
+ } from "../chunk-G3LR6V6N.js";
39
+ import "../chunk-ORYQGVC3.js";
40
40
  import {
41
41
  resetManagedToolRefreshSession
42
42
  } from "../chunk-UXVNL3D7.js";
@@ -55,7 +55,7 @@ import {
55
55
  peekTurnEndFindings,
56
56
  snapshotAdvisoryProvenance,
57
57
  validateAdvisoryProvenance
58
- } from "../chunk-CZAWWXP6.js";
58
+ } from "../chunk-BMMRLJA4.js";
59
59
  import {
60
60
  CacheManager,
61
61
  DEFAULT_MAX_AGE_MS,
@@ -85,6 +85,7 @@ import {
85
85
  evaluateAstGrepRules,
86
86
  evaluateRules,
87
87
  filterFindingsByDisposition,
88
+ findingClassKey,
88
89
  forgetCascadePendingNeighbor,
89
90
  formatCacheAgeLabel,
90
91
  formatCascadeNeighborDiagnostics,
@@ -106,7 +107,6 @@ import {
106
107
  owedByContentOnly,
107
108
  peekOutstandingCascadeTouches,
108
109
  pendingRunnerFindingsSize,
109
- readFileContent,
110
110
  recordDeliveredCascadeNeighbor,
111
111
  renderCascadeResult,
112
112
  requeueRunnerFindings,
@@ -117,49 +117,48 @@ import {
117
117
  resetPsScriptAnalyzerAvailability,
118
118
  runProviders,
119
119
  stampLineHashes
120
- } from "../chunk-V7F7JHS5.js";
120
+ } from "../chunk-T6PPK3T6.js";
121
121
  import {
122
122
  resetLazyInstallAttempts
123
- } from "../chunk-GMC4ZGYR.js";
123
+ } from "../chunk-6EXGCXM5.js";
124
124
  import {
125
125
  isTestRoleCollateral
126
- } from "../chunk-UY745U35.js";
127
- import "../chunk-HSYFLOZY.js";
126
+ } from "../chunk-ME6MF2N2.js";
127
+ import "../chunk-JRSS6KM4.js";
128
128
  import {
129
129
  resetGoAvailability
130
- } from "../chunk-QHOTTC4A.js";
130
+ } from "../chunk-MOEWCPMC.js";
131
131
  import {
132
132
  TrivyClient,
133
133
  trivyEvidenceFiles
134
- } from "../chunk-OPFNQBS5.js";
135
- import "../chunk-SJQUWQR6.js";
136
- import "../chunk-VGTBLTPN.js";
137
- import {
138
- findingsResult,
139
- hasUsableResult,
140
- reachedNoVerdict
141
- } from "../chunk-4ITEFRDH.js";
134
+ } from "../chunk-HYR25MV3.js";
135
+ import "../chunk-AAIVSSUU.js";
136
+ import "../chunk-LD7SXICE.js";
137
+ import "../chunk-NZINZCHB.js";
138
+ import "../chunk-FDLGJFAE.js";
142
139
  import {
143
140
  resetRustAvailability
144
- } from "../chunk-W4CUK5G6.js";
145
- import "../chunk-QSCZAP24.js";
146
- import "../chunk-KDCIG23C.js";
141
+ } from "../chunk-2HWVG3IM.js";
142
+ import "../chunk-E5SSUV2A.js";
143
+ import "../chunk-IZ36G463.js";
147
144
  import {
148
145
  resetDispatchAvailabilityState,
149
146
  resolveManagedToolClient
150
- } from "../chunk-S3WFVG5P.js";
151
- import "../chunk-HILZE4BQ.js";
152
- import "../chunk-Y3EHLUPL.js";
153
- import "../chunk-2ADRLTM2.js";
154
- import "../chunk-ZD4KVFXI.js";
155
- import "../chunk-GTTMQ6XB.js";
147
+ } from "../chunk-BEIPWPVR.js";
148
+ import {
149
+ readFileContent
150
+ } from "../chunk-D7OEGXDX.js";
151
+ import "../chunk-3MHY4BQY.js";
152
+ import "../chunk-VU2PRGRI.js";
153
+ import "../chunk-D2ZYRI7M.js";
154
+ import "../chunk-OHEUOWYT.js";
156
155
  import {
157
156
  SYMBOL_KIND_NAMES,
158
157
  captureReviewGraphStructuralIr,
159
158
  formatReviewGraphRevisionDriftNote,
160
159
  publishReviewGraphFileIr,
161
160
  reviewGraphIrContentHash
162
- } from "../chunk-2LVJQU3I.js";
161
+ } from "../chunk-QY6J2FTK.js";
163
162
  import {
164
163
  buildSymbolId
165
164
  } from "../chunk-3MED75HT.js";
@@ -179,11 +178,15 @@ import {
179
178
  applyDispositions,
180
179
  applyDispositionsMultiFile,
181
180
  applyWeakDispositions,
181
+ applyWeakDispositionsMultiFile,
182
182
  applyWorkspaceEdit,
183
183
  armDeferredLspWork,
184
184
  attemptTsserverSyncDiagnostics,
185
+ auxiliaryNotRunSentences,
186
+ auxiliaryServersNotRun,
185
187
  beginScope,
186
188
  buildProbeScopeKey,
189
+ cachedAnchorMarks,
187
190
  canRearmPendingAuxiliary,
188
191
  captureRenameExpectedContent,
189
192
  classifyDiagnosticTier,
@@ -202,7 +205,6 @@ import {
202
205
  drainPendingAuxiliaryCoverage,
203
206
  drainRenderedDependencyDriftFilePaths,
204
207
  dropExcludedServers,
205
- enabledOptInAuxiliaryLspServerIds,
206
208
  findAuxiliaryProfileForSource,
207
209
  getActiveSessionId,
208
210
  getDisposition,
@@ -245,6 +247,7 @@ import {
245
247
  reconcileStaleWidgetFiles,
246
248
  recordLspMutationOutcome,
247
249
  recordRunner,
250
+ refuseOutOfRootWrites,
248
251
  registerDeferredLspWork,
249
252
  resetDeferredDispositions,
250
253
  resetLSPService,
@@ -269,8 +272,9 @@ import {
269
272
  tryWarmAttachedDiagnostics,
270
273
  warmAnswerBinding,
271
274
  widgetDiagnosticUri,
272
- writeOrderToken
273
- } from "../chunk-6MDM5MQT.js";
275
+ writeOrderToken,
276
+ writeSourceFile
277
+ } from "../chunk-DZSQXG66.js";
274
278
  import {
275
279
  ANY_POSITION,
276
280
  foldedFindingIdentity,
@@ -280,7 +284,7 @@ import {
280
284
  resetMutationAttribution,
281
285
  retainRecordedFindings,
282
286
  stableFindingId
283
- } from "../chunk-FCQSZQAT.js";
287
+ } from "../chunk-DFAY7JUN.js";
284
288
  import {
285
289
  mapWithConcurrency
286
290
  } from "../chunk-XIMYZ3JA.js";
@@ -306,8 +310,8 @@ import {
306
310
  resetLSPCaseSensitivityState,
307
311
  resolveLspCwdForFile,
308
312
  shouldInitializeSessionRoot
309
- } from "../chunk-XPGH5O74.js";
310
- import "../chunk-NE4EFHJX.js";
313
+ } from "../chunk-Z6WTLVUL.js";
314
+ import "../chunk-PPYUBO6Y.js";
311
315
  import {
312
316
  PROJECT_VENV_DIR_NAMES,
313
317
  PYTHON_DECLARATION_CONCURRENCY,
@@ -319,10 +323,10 @@ import {
319
323
  partitionOutrankedPythonCompileVerdicts,
320
324
  recordPythonCompileVerdictDrop,
321
325
  resetBoundedTelemetry
322
- } from "../chunk-YT2VR4SL.js";
326
+ } from "../chunk-5EEWCJG7.js";
323
327
  import {
324
328
  scannerReportParentDir
325
- } from "../chunk-LT62P654.js";
329
+ } from "../chunk-QJ4T73J5.js";
326
330
  import {
327
331
  PROJECT_SNAPSHOT_VERSION,
328
332
  getProjectSnapshotLegacyPath,
@@ -337,13 +341,13 @@ import {
337
341
  readJsonCache,
338
342
  readProjectSnapshotMeta,
339
343
  saveRuntimeProjectSnapshot
340
- } from "../chunk-BRESRQBE.js";
344
+ } from "../chunk-YLW26OHX.js";
341
345
  import {
342
346
  SWEEP_IDLE_SAFETY_MARGIN_MS,
343
347
  getFullScanWallClockMs,
344
348
  isWorkspaceSweepActive,
345
349
  runWhenWorkspaceSweepIdle
346
- } from "../chunk-XVB3Q2PG.js";
350
+ } from "../chunk-HGEE5LDW.js";
347
351
  import "../chunk-5W3R6LFT.js";
348
352
  import {
349
353
  DEPENDENCY_DRIFT_MAX_DELIVERIES,
@@ -355,10 +359,10 @@ import {
355
359
  resolveImportToFiles,
356
360
  sweepInlineBlockerFreshness,
357
361
  symbolExtractionGrammar
358
- } from "../chunk-QL37SGTS.js";
359
- import "../chunk-K6WIBVMK.js";
360
- import "../chunk-ACRJ2GZ5.js";
361
- import "../chunk-WS3UFJOU.js";
362
+ } from "../chunk-NCDH2JB7.js";
363
+ import "../chunk-HYDJUVOE.js";
364
+ import "../chunk-7424ANRU.js";
365
+ import "../chunk-SUIZOCSY.js";
362
366
  import {
363
367
  EXT_TO_LANG,
364
368
  classifyTreeSitterWasmError,
@@ -371,37 +375,42 @@ import {
371
375
  queryLoader,
372
376
  reportBundledResourceDirHealth,
373
377
  resolveTreeSitterLanguage
374
- } from "../chunk-CTB5BAJI.js";
378
+ } from "../chunk-6GWCYEP7.js";
375
379
  import "../chunk-Z54ZSOBZ.js";
376
380
  import {
377
381
  getUserRuleRoot
378
- } from "../chunk-GUGKKGG7.js";
382
+ } from "../chunk-7M64NTAK.js";
379
383
  import {
380
384
  dump,
381
385
  resolvePackagePath
382
- } from "../chunk-QGITU23N.js";
383
- import {
384
- SCAN_LANGUAGE_PRIORITY,
385
- extensionsForLanguage,
386
- extensionsForLanguageToken,
387
- resolveFilenameLanguage,
388
- resolveLanguage
389
- } from "../chunk-OTSTS7L2.js";
386
+ } from "../chunk-E3PNZDPH.js";
390
387
  import "../chunk-6HWVI6MI.js";
391
- import "../chunk-SG2JQ2YP.js";
392
- import {
393
- HOOK_WALL_BUDGET_MS
394
- } from "../chunk-CKEQFGLT.js";
388
+ import "../chunk-PK3GDU4M.js";
395
389
  import {
396
390
  centralityFromReverseDeps,
397
391
  getWordIndexBuildStatus,
392
+ isEmptyWordIndexQuery,
398
393
  logWordIndex,
394
+ parseWordIndexQuery,
399
395
  searchWordIndex,
400
396
  triggerBackgroundWordIndexBuild
401
- } from "../chunk-NBM7PNBP.js";
397
+ } from "../chunk-6JLNZ6DP.js";
402
398
  import {
403
399
  getProjectDiagnosticsScannerMaxFiles
404
- } from "../chunk-BGLS5SDN.js";
400
+ } from "../chunk-IT7MFVGP.js";
401
+ import {
402
+ SCAN_LANGUAGE_PRIORITY,
403
+ extensionsForLanguage,
404
+ resolveLanguage,
405
+ resolveLanguageScope
406
+ } from "../chunk-AYDE7RFV.js";
407
+ import {
408
+ NO_SERVER_REASON,
409
+ findingsResult,
410
+ hasUsableResult,
411
+ reachedNoVerdict,
412
+ verdictUncheckedReason
413
+ } from "../chunk-W6VLB6LL.js";
405
414
  import {
406
415
  WARM_TURN_END_SCHEMA_VERSION,
407
416
  createWarmIpcLineReader,
@@ -409,40 +418,32 @@ import {
409
418
  ipcPathForCwd,
410
419
  readTurnEndStatus,
411
420
  unlinkStaleUnixSocket
412
- } from "../chunk-YF4G5NN5.js";
421
+ } from "../chunk-HWMNTQBJ.js";
413
422
  import {
414
- hashContentBytes,
415
423
  resolveRunnerPath,
416
424
  toRunnerDisplayPath
417
- } from "../chunk-W7TY6HYX.js";
418
- import {
419
- bounded,
420
- combineAbortSignals,
421
- untilAborted,
422
- withBudget,
423
- withDeadline
424
- } from "../chunk-WAA63ZJV.js";
425
+ } from "../chunk-ZRQMENT4.js";
425
426
  import "../chunk-2BEMIWEW.js";
426
427
  import "../chunk-IJYGIDF4.js";
427
428
  import {
428
429
  commitDurableStore,
429
430
  resetResolvedPathCache,
430
431
  resetZizmorTokenAvailability
431
- } from "../chunk-AON2QIJF.js";
432
+ } from "../chunk-NRVWLTOY.js";
432
433
  import {
433
434
  resolveToolCwd
434
- } from "../chunk-TLWFZ66Y.js";
435
+ } from "../chunk-YLHJWAQS.js";
435
436
  import {
436
437
  _resetPackageManagerCache,
437
438
  findGlobalBinary,
438
439
  pmBinary,
439
440
  resolveNodePackageManager,
440
441
  runScriptArgs
441
- } from "../chunk-KSTQ4VXT.js";
442
+ } from "../chunk-OVPR3GQ6.js";
442
443
  import {
443
444
  getIsolatedNpxSpawnOptions,
444
445
  probeToolAsync
445
- } from "../chunk-VPFRU5IG.js";
446
+ } from "../chunk-3QMLB4TI.js";
446
447
  import "../chunk-UYXV5NIS.js";
447
448
  import {
448
449
  classifyProbeFailure,
@@ -451,20 +452,24 @@ import {
451
452
  logAvailabilityDecision,
452
453
  resetInstallRetryLatches,
453
454
  startHostStallSampler
454
- } from "../chunk-NPNFGYLV.js";
455
+ } from "../chunk-AVBEPUCD.js";
455
456
  import {
456
457
  canRunStartupHeavyScans,
457
458
  detectProjectLanguageProfile,
458
459
  getDefaultStartupTools
459
- } from "../chunk-TJQSYX3J.js";
460
- import "../chunk-7JX3RNG4.js";
460
+ } from "../chunk-75TVYCQW.js";
461
+ import "../chunk-KXDQD34C.js";
461
462
  import {
463
+ DEFAULT_MAX_SCAN_ENTRIES,
462
464
  collectSourceFilesWithBudgetAsync,
463
465
  getSlowFsVerdict,
464
466
  isSlowFs,
465
467
  slowFsDegradationNotice
466
- } from "../chunk-IDCTDKIA.js";
467
- import "../chunk-IL6PIV33.js";
468
+ } from "../chunk-3PMLYGJN.js";
469
+ import {
470
+ shouldRecurseIntoDir,
471
+ walkTreeStackAsync
472
+ } from "../chunk-YTXFNCVN.js";
468
473
  import {
469
474
  displayProjectDataPath,
470
475
  drainProjectDataDirMigrations,
@@ -494,19 +499,18 @@ import {
494
499
  sweepDeadEphemeralDataDirs,
495
500
  updateHeartbeat,
496
501
  withGenerationLockSync
497
- } from "../chunk-H65TYP6V.js";
502
+ } from "../chunk-ET3DSSFZ.js";
498
503
  import {
499
504
  createSingleFlight
500
- } from "../chunk-AWQWXSW4.js";
505
+ } from "../chunk-B4FAFEBP.js";
501
506
  import {
502
507
  createDeadline,
503
508
  yieldIfOverBudget
504
509
  } from "../chunk-QYF5S6P6.js";
505
510
  import {
506
- SPECIAL_FILENAMES,
507
511
  detectFileKind,
508
512
  isJstsFactFile
509
- } from "../chunk-CZCAZVTD.js";
513
+ } from "../chunk-SRXYSLMW.js";
510
514
  import {
511
515
  PathKeyedMap,
512
516
  compareKeys,
@@ -517,22 +521,32 @@ import {
517
521
  provenanceView,
518
522
  resolvePiLensConfig,
519
523
  summarizeConfigResolution
520
- } from "../chunk-FOEPIX76.js";
524
+ } from "../chunk-6EIV3H7O.js";
521
525
  import {
522
526
  LSP_NAMESPACE_KEY,
523
527
  getPiLensGlobalConfigPath,
524
528
  resetWorkspaceTopology
525
- } from "../chunk-NL5LSKVD.js";
529
+ } from "../chunk-3R3Z54J7.js";
530
+ import {
531
+ hashContentBytes,
532
+ hashFileBytes
533
+ } from "../chunk-CIA7X2PZ.js";
526
534
  import {
527
535
  DEFAULT_MAX_OUTPUT_BYTES,
536
+ HOOK_WALL_BUDGET_MS,
537
+ bounded,
538
+ combineAbortSignals,
528
539
  createBoundedOutputSink,
529
540
  getProjectTrustState,
530
541
  isToolInstallAllowedByTrust,
531
542
  projectTrustDenialReason,
532
543
  setProjectTrustState,
533
544
  truncatedByOutputCap,
545
+ untilAborted,
546
+ withBudget,
547
+ withDeadline,
534
548
  writeFileAtomic
535
- } from "../chunk-7WJ55KBN.js";
549
+ } from "../chunk-HRQTYU2T.js";
536
550
  import {
537
551
  LENS_TOOL_NAMES,
538
552
  TOOL_REGISTRY,
@@ -551,7 +565,7 @@ import {
551
565
  resolveLensToolName,
552
566
  toolRegistryEntryForMcp,
553
567
  translateGuidanceToolNames
554
- } from "../chunk-3FRI5H4T.js";
568
+ } from "../chunk-AGEQRJ5A.js";
555
569
  import {
556
570
  freshnessFromMtime
557
571
  } from "../chunk-S26LC76R.js";
@@ -563,13 +577,14 @@ import {
563
577
  getProcessSingleton,
564
578
  isTestMode,
565
579
  logLatency,
580
+ nonNegativeIntEnv,
566
581
  runLogCleanup,
567
582
  setTurnContextSession
568
- } from "../chunk-VCRVNLE7.js";
583
+ } from "../chunk-K2GV34T2.js";
569
584
  import "../chunk-LJDODBBZ.js";
570
585
  import {
571
586
  FactStore
572
- } from "../chunk-A5TEJZGJ.js";
587
+ } from "../chunk-O6LCSHHI.js";
573
588
  import {
574
589
  BoundedFifoMap,
575
590
  BoundedLruCache,
@@ -591,13 +606,13 @@ import {
591
606
  uriToDiskPath,
592
607
  uriToPath,
593
608
  walkUpDirs
594
- } from "../chunk-CB7PEVOJ.js";
609
+ } from "../chunk-WLD6BGON.js";
595
610
  import "../chunk-NXL4FFQQ.js";
596
611
 
597
612
  // dist/mcp/server.js
598
- import * as fs24 from "node:fs";
613
+ import * as fs25 from "node:fs";
599
614
  import * as net from "node:net";
600
- import * as path40 from "node:path";
615
+ import * as path43 from "node:path";
601
616
  import { fileURLToPath as fileURLToPath3 } from "node:url";
602
617
 
603
618
  // dist/tools/render-compact.js
@@ -853,7 +868,7 @@ var RESET_FG = "\x1B[39m\x1B[22m";
853
868
  function fullTextOf(result) {
854
869
  return (result.content ?? []).filter((c) => c.type === "text" && typeof c.text === "string").map((c) => c.text).join("\n");
855
870
  }
856
- function selectCompactText(result, args, expanded, summarize) {
871
+ function selectCompactText(result, args, expanded, summarize2) {
857
872
  const text = fullTextOf(result);
858
873
  if (expanded) {
859
874
  return {
@@ -864,7 +879,7 @@ function selectCompactText(result, args, expanded, summarize) {
864
879
  const lineCount3 = text ? text.split("\n").length : 0;
865
880
  let summary;
866
881
  try {
867
- summary = summarize({
882
+ summary = summarize2({
868
883
  details: result.details,
869
884
  args,
870
885
  isError: result.isError === true,
@@ -883,14 +898,20 @@ function paintCompact(style, text, theme) {
883
898
  const color = style === "error" ? "error" : "toolOutput";
884
899
  return theme.fg(color, text);
885
900
  }
886
- function compactRenderResult(summarize) {
901
+ function compactRenderResult(summarize2) {
887
902
  return (result, options, theme, context) => {
888
903
  const component = context.lastComponent instanceof Text ? context.lastComponent : new Text("", 0, 0);
889
- const { text, style } = selectCompactText(result, context.args ?? {}, options.expanded === true, summarize);
904
+ const { text, style } = selectCompactText(result, context.args ?? {}, options.expanded === true, summarize2);
890
905
  component.setText(paintCompact(style, text, theme));
891
906
  return component;
892
907
  };
893
908
  }
909
+ function baseName(p) {
910
+ if (typeof p !== "string" || p.length === 0)
911
+ return "";
912
+ const parts = p.split(/[\\/]/);
913
+ return parts[parts.length - 1] || p;
914
+ }
894
915
 
895
916
  // dist/clients/ast-grep-client.js
896
917
  import * as fs4 from "node:fs";
@@ -1532,6 +1553,7 @@ Original error: ${stderr}`;
1532
1553
  timeout: DEFAULT_EXEC_TIMEOUT_MS,
1533
1554
  deadlineAt: options.deadlineAt,
1534
1555
  signal: options.signal,
1556
+ ignoreAmbientSignal: options.ignoreAmbientSignal,
1535
1557
  maxOutputBytes: MAX_SG_OUTPUT_BYTES
1536
1558
  });
1537
1559
  const empty = () => ({
@@ -1549,6 +1571,7 @@ Original error: ${stderr}`;
1549
1571
  if (spawnFailure) {
1550
1572
  return {
1551
1573
  ...empty(),
1574
+ failure: spawnFailure,
1552
1575
  error: spawnFailure === "unavailable" ? "ast-grep CLI not found. Install: npm i -D @ast-grep/cli" : result.error?.message || "ast-grep CLI failed to start"
1553
1576
  };
1554
1577
  }
@@ -1719,12 +1742,23 @@ Original error: ${stderr}`;
1719
1742
  if (!applyFixes) {
1720
1743
  const result = await this.spawnResolved(command, scanArgs, spawnOptions);
1721
1744
  const scan2 = this.interpretScanResult(result, ["scan"]);
1722
- return scan2.failure || scan2.error ? { matches: [], error: scan2.error } : { matches: scan2.matches };
1745
+ return scan2.failure || scan2.error ? {
1746
+ matches: [],
1747
+ error: scan2.error,
1748
+ ...scan2.failure === "aborted" ? { aborted: true } : {}
1749
+ } : { matches: scan2.matches };
1723
1750
  }
1724
1751
  const jsonResult = await this.spawnResolved(command, scanArgs, spawnOptions);
1725
1752
  const scan = this.interpretScanResult(jsonResult, ["scan"]);
1726
1753
  if (scan.failure || scan.error) {
1727
- return { matches: [], error: scan.error };
1754
+ return {
1755
+ matches: [],
1756
+ error: scan.error,
1757
+ ...scan.failure === "aborted" ? { aborted: true } : {}
1758
+ };
1759
+ }
1760
+ if (options.signal?.aborted) {
1761
+ return { matches: [], error: "operation aborted", aborted: true };
1728
1762
  }
1729
1763
  const applyResult = await this.spawnResolved(command, [
1730
1764
  "scan",
@@ -1733,10 +1767,11 @@ Original error: ${stderr}`;
1733
1767
  "--update-all",
1734
1768
  ...sgExcludeArgsForProject(dir),
1735
1769
  dir
1736
- ], spawnOptions);
1770
+ ], { ...spawnOptions, signal: void 0, ignoreAmbientSignal: true });
1737
1771
  if (applyResult.error || applyResult.failure || applyResult.status !== 0) {
1738
1772
  return {
1739
1773
  matches: [],
1774
+ writeStarted: true,
1740
1775
  error: applyResult.error?.message || `ast-grep apply failed with exit code ${applyResult.status}`
1741
1776
  };
1742
1777
  }
@@ -1799,6 +1834,9 @@ function reportAstGrepRulesHealth(bundledRuleDir) {
1799
1834
  });
1800
1835
  reportBundledResourceDirHealth("ast-grep-rules-dir-missing", bundledRuleDir, health, "ast-grep rule descriptions");
1801
1836
  }
1837
+ function matchedFilePath(file) {
1838
+ return normalizeFilePath(path4.resolve(process.cwd(), file));
1839
+ }
1802
1840
  function recordAstGrepApply(matches, { lineage, toolCallId, sessionId } = {}) {
1803
1841
  const bridge = getMutationBridge();
1804
1842
  if (!bridge || matches.length === 0)
@@ -1815,7 +1853,7 @@ function recordAstGrepApply(matches, { lineage, toolCallId, sessionId } = {}) {
1815
1853
  }
1816
1854
  const accepted = [];
1817
1855
  for (const [filePath, editRanges] of rangesByFile) {
1818
- const resolved = normalizeFilePath(path4.resolve(process.cwd(), filePath));
1856
+ const resolved = matchedFilePath(filePath);
1819
1857
  const recorded = bridge.recordMutation({
1820
1858
  filePath: resolved,
1821
1859
  kind: "edit",
@@ -1838,6 +1876,42 @@ function recordAstGrepApply(matches, { lineage, toolCallId, sessionId } = {}) {
1838
1876
  }
1839
1877
  return accepted;
1840
1878
  }
1879
+ function missingRootRefusal(options) {
1880
+ return options?.sessionRoot === void 0 ? "ast_grep_replace refused: no session root to check the write against" : void 0;
1881
+ }
1882
+ function outsideRootsText(refused) {
1883
+ return `ast_grep_replace refused: ${refused.join(", ")} ${refused.length === 1 ? "is" : "are"} outside the session's writable roots (a preview with apply: false is still allowed)`;
1884
+ }
1885
+ async function applyRewrite(matches, options, write) {
1886
+ const files = [
1887
+ ...new Set(matches.map((match) => matchedFilePath(match.file)))
1888
+ ];
1889
+ const hashOf = (file) => {
1890
+ try {
1891
+ return hashFileBytes(file);
1892
+ } catch {
1893
+ return void 0;
1894
+ }
1895
+ };
1896
+ const refused = refuseOutOfRootWrites(files, options?.sessionRoot ?? "", "ast_grep_replace");
1897
+ if (refused.length > 0)
1898
+ return { refused };
1899
+ const before = /* @__PURE__ */ new Map();
1900
+ let appliedFiles = [];
1901
+ const result = await writeSourceFile({
1902
+ filePaths: files,
1903
+ record: (exit) => {
1904
+ const clean = exit.ok && exit.value.error === void 0;
1905
+ const changed = clean ? files : files.filter((file) => hashOf(file) !== before.get(file));
1906
+ appliedFiles = recordAstGrepApply(matches.filter((match) => changed.includes(matchedFilePath(match.file))), options);
1907
+ }
1908
+ }, async () => {
1909
+ for (const file of files)
1910
+ before.set(file, hashOf(file));
1911
+ return write();
1912
+ });
1913
+ return { result, appliedFiles };
1914
+ }
1841
1915
  function extractDebugAst(raw) {
1842
1916
  const lines = raw.split(/\r?\n/);
1843
1917
  const start = lines.findIndex((line) => /^Debug (?:A|C)ST:/.test(line.trim()));
@@ -1986,8 +2060,21 @@ var AstGrepClient = class {
1986
2060
  */
1987
2061
  async replaceWithRule(ruleYaml, paths, apply, options) {
1988
2062
  const allMatches = [];
1989
- const recordWritten = () => apply ? recordAstGrepApply(allMatches, options) : [];
2063
+ const sg = options?.signal ? { signal: options.signal } : {};
2064
+ if (apply) {
2065
+ const refusal = missingRootRefusal(options);
2066
+ if (refusal !== void 0) {
2067
+ return {
2068
+ matches: [],
2069
+ totalMatches: 0,
2070
+ applied: false,
2071
+ error: refusal
2072
+ };
2073
+ }
2074
+ }
2075
+ const appliedFiles = [];
1990
2076
  for (const scanPath of paths) {
2077
+ let previewed = [];
1991
2078
  if (apply) {
1992
2079
  const preCheck = await this.tempScanDetailed(scanPath, ruleYaml);
1993
2080
  if (preCheck.failure || preCheck.error) {
@@ -1996,7 +2083,8 @@ var AstGrepClient = class {
1996
2083
  totalMatches: allMatches.length,
1997
2084
  applied: false,
1998
2085
  error: preCheck.error ?? "ast-grep preview failed",
1999
- appliedFiles: recordWritten()
2086
+ ...preCheck.failure === "aborted" ? { aborted: true } : {},
2087
+ appliedFiles
2000
2088
  };
2001
2089
  }
2002
2090
  if (preCheck.matches.length === 0) {
@@ -2005,18 +2093,34 @@ var AstGrepClient = class {
2005
2093
  totalMatches: 0,
2006
2094
  applied: false,
2007
2095
  stalePreview: true,
2008
- appliedFiles: recordWritten()
2096
+ appliedFiles
2009
2097
  };
2010
2098
  }
2099
+ previewed = preCheck.matches;
2100
+ }
2101
+ const scan = () => this.runner.tempScanWithFixAsync(scanPath, "agent-rule", ruleYaml, apply, void 0, sg);
2102
+ const applied = apply ? await applyRewrite(previewed, options, scan) : null;
2103
+ if (applied !== null && "refused" in applied) {
2104
+ return {
2105
+ matches: allMatches,
2106
+ totalMatches: allMatches.length,
2107
+ applied: false,
2108
+ error: outsideRootsText(applied.refused),
2109
+ appliedFiles
2110
+ };
2011
2111
  }
2012
- const result = await this.runner.tempScanWithFixAsync(scanPath, "agent-rule", ruleYaml, apply);
2112
+ if (applied !== null)
2113
+ appliedFiles.push(...applied.appliedFiles);
2114
+ const result = applied === null ? await scan() : applied.result;
2013
2115
  if (result.error) {
2014
2116
  return {
2015
2117
  matches: allMatches,
2016
2118
  totalMatches: allMatches.length,
2017
2119
  applied: false,
2018
2120
  error: result.error,
2019
- appliedFiles: recordWritten()
2121
+ ...result.aborted ? { aborted: true } : {},
2122
+ ...result.writeStarted ? { writeStarted: true } : {},
2123
+ appliedFiles
2020
2124
  };
2021
2125
  }
2022
2126
  allMatches.push(...result.matches);
@@ -2025,7 +2129,7 @@ var AstGrepClient = class {
2025
2129
  matches: allMatches,
2026
2130
  totalMatches: allMatches.length,
2027
2131
  applied: apply,
2028
- appliedFiles: recordWritten()
2132
+ appliedFiles
2029
2133
  };
2030
2134
  }
2031
2135
  /**
@@ -2237,32 +2341,38 @@ var AstGrepClient = class {
2237
2341
  if (options?.strictness) {
2238
2342
  baseArgs.push("--strictness", options.strictness);
2239
2343
  }
2344
+ const signal = options?.signal;
2345
+ const sg = signal ? { signal } : {};
2240
2346
  if (!apply) {
2241
- const result = await this.runner.exec([
2242
- ...baseArgs,
2243
- "--json=compact",
2244
- ...paths
2245
- ]);
2347
+ const result = await this.runner.exec([...baseArgs, "--json=compact", ...paths], sg);
2246
2348
  return {
2247
2349
  matches: result.matches,
2248
2350
  totalMatches: result.totalMatches,
2249
2351
  truncated: result.truncated,
2250
2352
  applied: false,
2251
- error: result.error
2353
+ error: result.error,
2354
+ ...result.failure === "aborted" ? { aborted: true } : {}
2252
2355
  };
2253
2356
  }
2254
- const preCheck = await this.runner.exec([
2255
- ...baseArgs,
2256
- "--json=compact",
2257
- ...paths
2258
- ]);
2357
+ const refusal = missingRootRefusal(options);
2358
+ if (refusal !== void 0) {
2359
+ return {
2360
+ matches: [],
2361
+ totalMatches: 0,
2362
+ truncated: false,
2363
+ applied: false,
2364
+ error: refusal
2365
+ };
2366
+ }
2367
+ const preCheck = await this.runner.exec([...baseArgs, "--json=compact", ...paths], sg);
2259
2368
  if (preCheck.error) {
2260
2369
  return {
2261
2370
  matches: [],
2262
2371
  totalMatches: 0,
2263
2372
  truncated: false,
2264
2373
  applied: false,
2265
- error: preCheck.error
2374
+ error: preCheck.error,
2375
+ ...preCheck.failure === "aborted" ? { aborted: true } : {}
2266
2376
  };
2267
2377
  }
2268
2378
  if (preCheck.matches.length === 0) {
@@ -2274,21 +2384,40 @@ var AstGrepClient = class {
2274
2384
  stalePreview: true
2275
2385
  };
2276
2386
  }
2277
- const applyResult = await this.runner.exec([
2278
- ...baseArgs,
2279
- "--update-all",
2280
- ...paths
2281
- ]);
2282
- if (applyResult.error) {
2387
+ if (signal?.aborted) {
2388
+ return {
2389
+ matches: [],
2390
+ totalMatches: 0,
2391
+ truncated: false,
2392
+ applied: false,
2393
+ error: "operation aborted",
2394
+ aborted: true
2395
+ };
2396
+ }
2397
+ const applied = await applyRewrite(preCheck.matches, options, () => this.runner.exec([...baseArgs, "--update-all", ...paths], {
2398
+ ignoreAmbientSignal: true
2399
+ }));
2400
+ if ("refused" in applied) {
2401
+ return {
2402
+ matches: [],
2403
+ totalMatches: 0,
2404
+ truncated: false,
2405
+ applied: false,
2406
+ error: outsideRootsText(applied.refused)
2407
+ };
2408
+ }
2409
+ const { appliedFiles } = applied;
2410
+ if (applied.result.error) {
2283
2411
  return {
2284
2412
  matches: [],
2285
2413
  totalMatches: 0,
2286
2414
  truncated: false,
2287
2415
  applied: false,
2288
- error: applyResult.error
2416
+ error: applied.result.error,
2417
+ writeStarted: true,
2418
+ appliedFiles
2289
2419
  };
2290
2420
  }
2291
- const appliedFiles = recordAstGrepApply(preCheck.matches, options);
2292
2421
  return {
2293
2422
  matches: preCheck.matches,
2294
2423
  totalMatches: preCheck.totalMatches,
@@ -2716,7 +2845,7 @@ async function scanFileMajorRules(cwd, files, signal) {
2716
2845
  } finally {
2717
2846
  facts.dropFileFacts(filePath);
2718
2847
  }
2719
- await new Promise((resolve32) => setImmediate(resolve32));
2848
+ await new Promise((resolve34) => setImmediate(resolve34));
2720
2849
  }
2721
2850
  if (wasmAborted) {
2722
2851
  astGrep.length = 0;
@@ -2860,7 +2989,7 @@ function resolveRebuildScript(serverFilePath) {
2860
2989
  return toPosix(serverFilePath).includes("/dist/") ? "build:dist" : "build";
2861
2990
  }
2862
2991
  function analyzeFileFresh(workerPath, file, cwd, options = {}, timeoutMs = 12e4) {
2863
- return new Promise((resolve32) => {
2992
+ return new Promise((resolve34) => {
2864
2993
  const args = [workerPath, `--file=${file}`, `--cwd=${cwd}`];
2865
2994
  if (options.flags)
2866
2995
  args.push(`--flags=${JSON.stringify(options.flags)}`);
@@ -2870,7 +2999,7 @@ function analyzeFileFresh(workerPath, file, cwd, options = {}, timeoutMs = 12e4)
2870
2999
  stdio: ["ignore", "pipe", "pipe"]
2871
3000
  });
2872
3001
  } catch (err) {
2873
- resolve32({
3002
+ resolve34({
2874
3003
  error: `failed to fork worker: ${err instanceof Error ? err.message : String(err)}`
2875
3004
  });
2876
3005
  return;
@@ -2883,7 +3012,7 @@ function analyzeFileFresh(workerPath, file, cwd, options = {}, timeoutMs = 12e4)
2883
3012
  return;
2884
3013
  settled = true;
2885
3014
  clearTimeout(timer);
2886
- resolve32(outcome);
3015
+ resolve34(outcome);
2887
3016
  };
2888
3017
  const timer = setTimeout(() => {
2889
3018
  child.kill();
@@ -3048,28 +3177,28 @@ async function buildBootstrapClients() {
3048
3177
  }
3049
3178
  }
3050
3179
  const [ruffClient, biomeClient, knipClient, todoScanner, jscpdClient, depChecker, testRunnerClient, complexityClient, goClient, govulncheckClient, gitleaksClient, trivyClient, opengrepClient, rustClient, agentBehaviorClient2, deadCodeClients] = await Promise.all([
3051
- load("ruff", async () => new (await import("../chunk-F6FT6BVQ.js")).RuffClient()),
3052
- load("biome", async () => new (await import("../chunk-TN5CWX5D.js")).BiomeClient()),
3053
- load("knip", async () => new (await import("../chunk-QMV2APEH.js")).KnipClient()),
3054
- load("todo", async () => new (await import("../chunk-4NCDHTFI.js")).TodoScanner()),
3055
- load("jscpd", async () => new (await import("../chunk-E4VXKTBR.js")).JscpdClient()),
3056
- load("dependency-checker", async () => new (await import("../chunk-DBS736MA.js")).DependencyChecker()),
3057
- load("test-runner", async () => new (await import("../chunk-XAFZJEXY.js")).TestRunnerClient()),
3058
- load("complexity", async () => new (await import("../chunk-MAD4QJTP.js")).ComplexityClient()),
3180
+ load("ruff", async () => new (await import("../chunk-D6ANA6YU.js")).RuffClient()),
3181
+ load("biome", async () => new (await import("../chunk-PCREZ4HJ.js")).BiomeClient()),
3182
+ load("knip", async () => new (await import("../chunk-OF2YGDUE.js")).KnipClient()),
3183
+ load("todo", async () => new (await import("../chunk-5FDUKJZO.js")).TodoScanner()),
3184
+ load("jscpd", async () => new (await import("../chunk-ZWZD4TJ5.js")).JscpdClient()),
3185
+ load("dependency-checker", async () => new (await import("../chunk-VD7MQFEV.js")).DependencyChecker()),
3186
+ load("test-runner", async () => new (await import("../chunk-FVQKX5KI.js")).TestRunnerClient()),
3187
+ load("complexity", async () => new (await import("../chunk-IC4L65U7.js")).ComplexityClient()),
3059
3188
  // The process-wide singleton, NOT a fresh instance (#2455 fix round 4,
3060
3189
  // F2). `handleSessionStart` reads this object for its "Active tools"
3061
3190
  // line while `resetGoAvailability` re-arms the singleton's latch; a
3062
3191
  // second instance here meant the reset never reached the surface a
3063
3192
  // user actually sees.
3064
- load("go", async () => (await import("../chunk-IK4YS3KC.js")).goClient),
3065
- load("govulncheck", async () => new (await import("../chunk-BDR5MEZY.js")).GovulncheckClient()),
3066
- load("gitleaks", async () => new (await import("../chunk-6I44EDNQ.js")).GitleaksClient()),
3067
- load("trivy", async () => new (await import("../chunk-UNBRHPHJ.js")).TrivyClient()),
3068
- load("opengrep", async () => new (await import("../chunk-ZOPXB2KK.js")).OpengrepClient()),
3193
+ load("go", async () => (await import("../chunk-TS5EIWEF.js")).goClient),
3194
+ load("govulncheck", async () => new (await import("../chunk-YULIERZW.js")).GovulncheckClient()),
3195
+ load("gitleaks", async () => new (await import("../chunk-AD7JDEI6.js")).GitleaksClient()),
3196
+ load("trivy", async () => new (await import("../chunk-HJWF7CGW.js")).TrivyClient()),
3197
+ load("opengrep", async () => new (await import("../chunk-GHATCG2A.js")).OpengrepClient()),
3069
3198
  // The process-wide singleton, for the same reason as "go" above.
3070
- load("rust", async () => (await import("../chunk-VS2L7QDI.js")).rustClient),
3071
- load("agent-behavior", async () => (await import("../chunk-JKOZ2Z4U.js")).agentBehaviorClient),
3072
- loadList("dead-code", async () => (await import("../chunk-3HM4BUHR.js")).getDeadCodeClients())
3199
+ load("rust", async () => (await import("../chunk-Z2W5YJBW.js")).rustClient),
3200
+ load("agent-behavior", async () => (await import("../chunk-F7AMFFVK.js")).agentBehaviorClient),
3201
+ loadList("dead-code", async () => (await import("../chunk-JLMS7EMD.js")).getDeadCodeClients())
3073
3202
  ]);
3074
3203
  if (failures.length > 0)
3075
3204
  await logBootstrapFailures(failures);
@@ -3155,7 +3284,7 @@ function resetAnalyzerBootstrapSessionState() {
3155
3284
  }
3156
3285
 
3157
3286
  // dist/clients/formatters-lazy.js
3158
- var lazyFormatters = createLazyImport(() => import("../chunk-B6HXETWY.js"));
3287
+ var lazyFormatters = createLazyImport(() => import("../chunk-Y7XMKBFP.js"));
3159
3288
  function warmFormatters() {
3160
3289
  return lazyFormatters.get();
3161
3290
  }
@@ -3335,6 +3464,10 @@ function appendProjectChangesAllocated(cwd, buildAll) {
3335
3464
  append(false);
3336
3465
  }
3337
3466
 
3467
+ // dist/clients/metrics/complexity-baseline.js
3468
+ var MAX_BASELINE_FILES = 256;
3469
+ var MAX_BLOB_BYTES = 2 * 1024 * 1024;
3470
+
3338
3471
  // dist/clients/turn-summary.js
3339
3472
  var TurnSummaryCollector = class {
3340
3473
  filesByKey = /* @__PURE__ */ new Map();
@@ -3501,7 +3634,12 @@ var RuntimeCoordinator = class {
3501
3634
  diagnosticsSurfaced: 0,
3502
3635
  coldSnapshotTouches: 0
3503
3636
  };
3504
- _complexityBaselines = /* @__PURE__ */ new Set();
3637
+ /**
3638
+ * #5087: per-file complexity baselines, keyed by
3639
+ * `complexityBaselineKey`. Bounded (LRU), and every write goes through a
3640
+ * session handle captured before the write's first await (#4220).
3641
+ */
3642
+ _complexityBaselines = new BoundedLruCache(MAX_BASELINE_FILES);
3505
3643
  _fixedThisTurn = new PathKeyedMap(normalizeMapKey);
3506
3644
  _writtenThisTurn = new PathKeyedMap(normalizeMapKey);
3507
3645
  _autofixDemotedThisTurn = new PathKeyedMap(normalizeMapKey);
@@ -4377,8 +4515,8 @@ var RuntimeCoordinator = class {
4377
4515
  });
4378
4516
  return entry;
4379
4517
  });
4380
- const timeout = new Promise((resolve32) => {
4381
- setTimeout(resolve32, maxWaitMs).unref?.();
4518
+ const timeout = new Promise((resolve34) => {
4519
+ setTimeout(resolve34, maxWaitMs).unref?.();
4382
4520
  });
4383
4521
  await Promise.race([
4384
4522
  Promise.allSettled(tracked.map((t) => t.promise)),
@@ -4503,7 +4641,7 @@ var RuntimeCoordinator = class {
4503
4641
  const existing = this._pendingInlineBlockers.get(key);
4504
4642
  if (existing && !existing.diagnostics)
4505
4643
  return 0;
4506
- const identity = (d) => JSON.stringify([foldedFindingIdentity(d), d.line, d.column]);
4644
+ const identity = (d) => findingClassKey(d) ?? JSON.stringify([foldedFindingIdentity(d), d.line, d.column]);
4507
4645
  const known = new Set((existing?.diagnostics ?? []).map(identity));
4508
4646
  const added = blocking.flatMap((d) => known.has(identity(d)) ? [] : [d]);
4509
4647
  if (added.length === 0)
@@ -6201,8 +6339,8 @@ async function igniteDominantLanguageWarm(cwd, runtime, sessionGeneration, dbg)
6201
6339
  if (!runtime.isCurrentSession(sessionGeneration))
6202
6340
  return;
6203
6341
  const lspService = (await loadLspService()).getLSPService();
6204
- const { collectSourceFilesAsync } = await import("../chunk-KJ3AHOCK.js");
6205
- const { CODE_KINDS, detectFileKind: detectFileKind2 } = await import("../chunk-NUSXS6YB.js");
6342
+ const { collectSourceFilesAsync } = await import("../chunk-K2LD6YNH.js");
6343
+ const { CODE_KINDS, detectFileKind: detectFileKind2 } = await import("../chunk-T5EGSBM2.js");
6206
6344
  const files = await collectSourceFilesAsync(cwd, {
6207
6345
  inspectGeneratedHeaders: false
6208
6346
  });
@@ -6271,12 +6409,12 @@ function cancelScheduledManagedToolRefresh() {
6271
6409
  managedToolRefreshTimer = void 0;
6272
6410
  }
6273
6411
  function scheduleManagedToolRefresh(dbg, rulePack) {
6274
- const delayMs = Number(process.env.PI_LENS_TOOL_REFRESH_DELAY_MS ?? MANAGED_TOOL_REFRESH_DELAY_MS);
6412
+ const delayMs = nonNegativeIntEnv("PI_LENS_TOOL_REFRESH_DELAY_MS", MANAGED_TOOL_REFRESH_DELAY_MS);
6275
6413
  const timer = setTimeout(() => {
6276
6414
  managedToolRefreshTimer = void 0;
6277
6415
  void (async () => {
6278
6416
  try {
6279
- const refresh = await import("../chunk-TYHOEX4V.js");
6417
+ const refresh = await import("../chunk-PXGVB2CY.js");
6280
6418
  const outcome = await refresh.runManagedToolRefresh(void 0, {
6281
6419
  rulePack
6282
6420
  });
@@ -6326,7 +6464,7 @@ function scanOneTodoFile(scanner, filePath, items) {
6326
6464
  async function collectTodoBaselineItems(scanner, analysisRoot, stillCurrent) {
6327
6465
  const items = [];
6328
6466
  try {
6329
- const { getSourceFilesAsync } = await import("../chunk-B2YUE6YD.js");
6467
+ const { getSourceFilesAsync } = await import("../chunk-3EIZMRXI.js");
6330
6468
  const files = await getSourceFilesAsync(analysisRoot, true);
6331
6469
  if (!stillCurrent())
6332
6470
  return items;
@@ -6355,7 +6493,7 @@ async function buildOrRefreshWordIndex(args) {
6355
6493
  const snapshot = loadProjectSnapshot(snapshotRoot);
6356
6494
  const snapshotLoadMs = Date.now() - snapshotLoadStartMs;
6357
6495
  if (snapshot?.wordIndex) {
6358
- const { deserializeWordIndex, refreshWordIndexIncrementally, countWordIndexPostingEntries: countWordIndexPostingEntries2, estimateWordIndexResidentBytes: estimateWordIndexResidentBytes2, notifyWordIndexPublished: notifyWordIndexPublished2 } = await import("../chunk-QUPYLQA4.js");
6496
+ const { deserializeWordIndex, refreshWordIndexIncrementally, countWordIndexPostingEntries: countWordIndexPostingEntries2, estimateWordIndexResidentBytes: estimateWordIndexResidentBytes2, notifyWordIndexPublished: notifyWordIndexPublished2 } = await import("../chunk-HSTN27NR.js");
6359
6497
  const deserializeStartMs = Date.now();
6360
6498
  const index = deserializeWordIndex(snapshot.wordIndex);
6361
6499
  const deserializeMs = Date.now() - deserializeStartMs;
@@ -6428,7 +6566,7 @@ async function buildOrRefreshWordIndex(args) {
6428
6566
  }
6429
6567
  }
6430
6568
  }
6431
- const { buildWordIndexAsync, collectWordIndexDocs, countWordIndexPostingEntries, estimateWordIndexResidentBytes, notifyWordIndexPublished } = await import("../chunk-QUPYLQA4.js");
6569
+ const { buildWordIndexAsync, collectWordIndexDocs, countWordIndexPostingEntries, estimateWordIndexResidentBytes, notifyWordIndexPublished } = await import("../chunk-HSTN27NR.js");
6432
6570
  const docs = await collectWordIndexDocs(analysisRoot, () => runtime.isCurrentSession(sessionGeneration), rebuildPreflightFiles);
6433
6571
  if (!runtime.isCurrentSession(sessionGeneration))
6434
6572
  return;
@@ -6513,7 +6651,7 @@ function scheduleStartupScansWithClients(deps, runtime, sessionGeneration, analy
6513
6651
  const delay = STARTUP_TASK_DEFER_MS[name] ?? 0;
6514
6652
  dbg(`session_start task ${name}: scheduled deferMs=${delay}`);
6515
6653
  runtime.markStartupScanInFlight(name, sessionGeneration);
6516
- const completion = new Promise((resolve32) => {
6654
+ const completion = new Promise((resolve34) => {
6517
6655
  const fire = () => {
6518
6656
  const startedAt = Date.now();
6519
6657
  dbg(`session_start task ${name}: start queuedMs=${startedAt - queuedAt}`);
@@ -6525,7 +6663,7 @@ function scheduleStartupScansWithClients(deps, runtime, sessionGeneration, analy
6525
6663
  }).finally(() => {
6526
6664
  runtime.clearStartupScanInFlight(name, sessionGeneration);
6527
6665
  dbg(`session_start task ${name}: end`);
6528
- resolve32();
6666
+ resolve34();
6529
6667
  });
6530
6668
  };
6531
6669
  if (delay > 0) {
@@ -6807,9 +6945,9 @@ function scheduleStartupScansWithClients(deps, runtime, sessionGeneration, analy
6807
6945
  });
6808
6946
  let callGraphIdentity;
6809
6947
  const callGraphTask = runTask("call-graph", async () => {
6810
- const { FactStore: FactStore2 } = await import("../chunk-46TQJSUE.js");
6811
- const { buildOrUpdateGraph, extractSymbolsAndRefsFromGraph, getReviewGraphCacheIdentity } = await import("../chunk-SKVNHCT5.js");
6812
- const { buildCallGraph, saveCallGraph, loadCallGraph: loadCallGraph2 } = await import("../chunk-RQRKIRFY.js");
6948
+ const { FactStore: FactStore2 } = await import("../chunk-X33QECRJ.js");
6949
+ const { buildOrUpdateGraph, extractSymbolsAndRefsFromGraph, getReviewGraphCacheIdentity } = await import("../chunk-7T64QA5D.js");
6950
+ const { buildCallGraph, saveCallGraph, loadCallGraph: loadCallGraph2 } = await import("../chunk-TOOXNL6M.js");
6813
6951
  if (!runtime.isCurrentSession(sessionGeneration))
6814
6952
  return;
6815
6953
  const startMs = Date.now();
@@ -6850,7 +6988,7 @@ function scheduleStartupScansWithClients(deps, runtime, sessionGeneration, analy
6850
6988
  return;
6851
6989
  if (!runtime.callGraph)
6852
6990
  return;
6853
- const { buildCodebaseModel, saveCodebaseModel, DEFAULT_CODEBASE_MODEL_TOKEN_BUDGET } = await import("../chunk-YQA34KAF.js");
6991
+ const { buildCodebaseModel, saveCodebaseModel, DEFAULT_CODEBASE_MODEL_TOKEN_BUDGET } = await import("../chunk-7ZVEFWOE.js");
6854
6992
  if (!callGraphIdentity)
6855
6993
  return;
6856
6994
  const model = buildCodebaseModel(runtime.callGraph, analysisRoot, DEFAULT_CODEBASE_MODEL_TOKEN_BUDGET, callGraphIdentity);
@@ -7050,7 +7188,7 @@ async function handleSessionStart(deps) {
7050
7188
  let warmupOwnSnapshotRead;
7051
7189
  if (startupMode === "quick" && !isPrintMode() && process.env.PI_LENS_COLD_START_QUICK !== "0" && !processGlobals.__piLensWarmupScheduled) {
7052
7190
  processGlobals.__piLensWarmupScheduled = true;
7053
- const warmupDelayMs = Number(process.env.PI_LENS_WARMUP_DELAY_MS ?? 2e3);
7191
+ const warmupDelayMs = nonNegativeIntEnv("PI_LENS_WARMUP_DELAY_MS", 2e3);
7054
7192
  const warmupCwd = deps.ctxCwd ?? process.cwd();
7055
7193
  const warmupDbg = deps.dbg;
7056
7194
  const warmupTimer = setTimeout(() => {
@@ -7059,8 +7197,8 @@ async function handleSessionStart(deps) {
7059
7197
  try {
7060
7198
  warmupDbg("warmup: starting background warmup");
7061
7199
  const scanContextStartedAt = Date.now();
7062
- const startupScanModule = await import("../chunk-I32RSMH6.js");
7063
- const languageProfileModule = await import("../chunk-QWTHFFU6.js");
7200
+ const startupScanModule = await import("../chunk-ILC2B7IJ.js");
7201
+ const languageProfileModule = await import("../chunk-C6V2DSZZ.js");
7064
7202
  const warmupSnapshotRoot = resolveSnapshotRoot(warmupCwd);
7065
7203
  const cachedSnapshot = loadProjectSnapshot(warmupSnapshotRoot);
7066
7204
  warmupOwnSnapshotRead = cachedSnapshot ? {
@@ -7960,7 +8098,7 @@ async function buildActionableWarningsReport(args) {
7960
8098
  }
7961
8099
  };
7962
8100
  const deferredWork = (async () => {
7963
- await new Promise((resolve32) => setTimeout(resolve32, 0));
8101
+ await new Promise((resolve34) => setTimeout(resolve34, 0));
7964
8102
  const deferredRecords = [...carried];
7965
8103
  const deferredDeadline = Date.now() + ACTIONABLE_WARNINGS_DEFERRED_BUDGET_MS;
7966
8104
  deferredDeps.deadlineAt = deferredDeadline;
@@ -10301,7 +10439,7 @@ async function runTestTargetsBounded(args) {
10301
10439
  });
10302
10440
  void pool.catch(() => {
10303
10441
  });
10304
- await new Promise((resolve32) => {
10442
+ await new Promise((resolve34) => {
10305
10443
  let settled = false;
10306
10444
  const finish = (reason) => {
10307
10445
  if (settled)
@@ -10313,7 +10451,7 @@ async function runTestTargetsBounded(args) {
10313
10451
  batchAbort.abort();
10314
10452
  clearTimeout(timer);
10315
10453
  args.signal?.removeEventListener("abort", onAbort);
10316
- resolve32();
10454
+ resolve34();
10317
10455
  };
10318
10456
  const onAbort = () => finish("abort");
10319
10457
  const timer = setTimeout(() => finish("budget"), budgetMs);
@@ -11297,9 +11435,23 @@ ${testLines.join("\n")}`;
11297
11435
  }
11298
11436
  }
11299
11437
  });
11300
- const unresolvedNeighbors = pendingGate.live;
11438
+ const livePendingErrors = pendingGate.live.flatMap((entry) => entry.errors);
11439
+ const pendingSurvivors = new Set(filterFindingsByDisposition(livePendingErrors, cwd, (stored) => stored).kept);
11440
+ const unresolvedPending = [];
11441
+ const disposedEntries = [];
11442
+ let disposedPendingErrors = 0;
11443
+ for (const entry of pendingGate.live) {
11444
+ const errors = entry.errors.reduce((count, stored) => pendingSurvivors.has(stored) ? count + 1 : count, 0);
11445
+ disposedPendingErrors += entry.errors.length - errors;
11446
+ if (errors < entry.errors.length)
11447
+ disposedEntries.push(entry);
11448
+ if (errors > 0)
11449
+ unresolvedPending.push({ entry, errors });
11450
+ }
11451
+ const undisposedEntries = new Set(unresolvedPending.map((pending2) => pending2.entry));
11452
+ const unresolvedNeighbors = pendingGate.live.flatMap((entry) => undisposedEntries.has(entry) ? [entry] : []);
11301
11453
  const changedNeighbors = pendingGate.stale;
11302
- const gateKept = /* @__PURE__ */ new Set([...unresolvedNeighbors, ...changedNeighbors]);
11454
+ const gateKept = /* @__PURE__ */ new Set([...pendingGate.live, ...changedNeighbors]);
11303
11455
  const deletedNeighbors = [];
11304
11456
  for (const entry of pendingCandidates) {
11305
11457
  if (gateKept.has(entry))
@@ -11312,7 +11464,7 @@ ${testLines.join("\n")}`;
11312
11464
  const pendingBlocks = [];
11313
11465
  let unresolvedShown = 0;
11314
11466
  if (unresolvedNeighbors.length > 0) {
11315
- const lines = unresolvedNeighbors.slice(-maxShown).reverse().map((entry) => ` \u2022 ${toRunnerDisplayPath(cwd, entry.filePath)}: ${entry.errorCount} error(s) unresolved (${pendingAge(entry.checkedAt)})`);
11467
+ const lines = unresolvedPending.slice(-maxShown).reverse().map((pending2) => ` \u2022 ${toRunnerDisplayPath(cwd, pending2.entry.filePath)}: ${pending2.errors} error(s) unresolved (${pendingAge(pending2.entry.checkedAt)})`);
11316
11468
  unresolvedShown = lines.length;
11317
11469
  const more = unresolvedNeighbors.length - lines.length;
11318
11470
  if (more > 0)
@@ -11356,15 +11508,20 @@ ${lines.join("\n")}`);
11356
11508
  }
11357
11509
  });
11358
11510
  }
11359
- if (changedNeighbors.length + deletedNeighbors.length > 0) {
11511
+ if (changedNeighbors.length + deletedNeighbors.length + disposedPendingErrors > 0) {
11360
11512
  logCascade({
11361
11513
  phase: "cascade_pending_gated",
11362
11514
  filePath: cascadeLogFilePath,
11363
11515
  metadata: {
11364
11516
  changed: changedNeighbors.length,
11365
11517
  deleted: deletedNeighbors.length,
11518
+ // #5344: a pending error the project has marked is dropped from
11519
+ // the line, so the drop stays countable (#1616's suppressed
11520
+ // bucket: a finding must not vanish with no trace).
11521
+ disposed: disposedPendingErrors,
11366
11522
  changedPaths: changedNeighbors.slice(0, 10).map((e) => e.filePath),
11367
- deletedPaths: deletedNeighbors.slice(0, 10).map((e) => e.filePath)
11523
+ deletedPaths: deletedNeighbors.slice(0, 10).map((e) => e.filePath),
11524
+ disposedPaths: disposedEntries.slice(0, 10).map((e) => e.filePath)
11368
11525
  }
11369
11526
  });
11370
11527
  }
@@ -12758,8 +12915,8 @@ ${lines.join("\n")}`;
12758
12915
  } else {
12759
12916
  const callGraphStart = Date.now();
12760
12917
  try {
12761
- const { impact, formatImpact, parseSymbolKey } = await import("../chunk-RQRKIRFY.js");
12762
- const { callGraphImpactToProjectDiagnostics } = await import("../chunk-ZZDVGCGG.js");
12918
+ const { impact, formatImpact, parseSymbolKey } = await import("../chunk-TOOXNL6M.js");
12919
+ const { callGraphImpactToProjectDiagnostics } = await import("../chunk-R67WQ5RY.js");
12763
12920
  const impactLines = [];
12764
12921
  let callGraphDispositionSuppressed = 0;
12765
12922
  const impactFindings = [];
@@ -13778,10 +13935,10 @@ var TurnEndQueue = class {
13778
13935
  if (this.pending.length >= 1) {
13779
13936
  return Promise.reject(new Error("turn_end queue is busy"));
13780
13937
  }
13781
- return new Promise((resolve32, reject) => {
13938
+ return new Promise((resolve34, reject) => {
13782
13939
  const item = {
13783
13940
  work,
13784
- resolve: resolve32,
13941
+ resolve: resolve34,
13785
13942
  reject,
13786
13943
  timer: setTimeout(() => {
13787
13944
  const index = this.pending.indexOf(item);
@@ -14435,8 +14592,12 @@ var PRESET_AXES = {
14435
14592
  "full-text": { projection: "full", format: "text" },
14436
14593
  "full-json": { projection: "full", format: "json" }
14437
14594
  };
14595
+ var PRESET_ALIASES = {
14596
+ json: "full-json"
14597
+ };
14438
14598
  function resolveModuleReportPreset(view, maxRefsPerSymbol) {
14439
- const axes = typeof view === "string" && Object.hasOwn(PRESET_AXES, view) ? PRESET_AXES[view] : PRESET_AXES["summary-text"];
14599
+ const name = typeof view === "string" && Object.hasOwn(PRESET_ALIASES, view) ? PRESET_ALIASES[view] : view;
14600
+ const axes = typeof name === "string" && Object.hasOwn(PRESET_AXES, name) ? PRESET_AXES[name] : PRESET_AXES["summary-text"];
14440
14601
  if (typeof maxRefsPerSymbol === "number" && Number.isFinite(maxRefsPerSymbol)) {
14441
14602
  const format = axes.format;
14442
14603
  return {
@@ -14537,7 +14698,7 @@ function blastReadArgs(graph, normalizedFile) {
14537
14698
  return { path: normalizedFile, offset: 1, limit };
14538
14699
  }
14539
14700
  async function computeBlastRadius(graph, normalizedPath, projectRoot, maxDepth) {
14540
- const { computeTransitiveImpact } = await import("../chunk-C6AODRNU.js");
14701
+ const { computeTransitiveImpact } = await import("../chunk-WTSQKJAR.js");
14541
14702
  const result = computeTransitiveImpact(graph, normalizedPath, { maxDepth });
14542
14703
  const byFile = /* @__PURE__ */ new Map();
14543
14704
  for (const hit of result.hits) {
@@ -15154,7 +15315,7 @@ async function moduleReport(file, cwd, options) {
15154
15315
  let callGraphIdentity;
15155
15316
  let revisionDriftNote;
15156
15317
  try {
15157
- const { getCachedReviewGraph, getReviewGraphCacheIdentity, getReviewGraphSizeSkipVerdict, getReviewGraphRevisionDrift, formatReviewGraphRevisionDriftNote: formatReviewGraphRevisionDriftNote2 } = await import("../chunk-SKVNHCT5.js");
15318
+ const { getCachedReviewGraph, getReviewGraphCacheIdentity, getReviewGraphSizeSkipVerdict, getReviewGraphRevisionDrift, formatReviewGraphRevisionDriftNote: formatReviewGraphRevisionDriftNote2 } = await import("../chunk-7T64QA5D.js");
15158
15319
  graph = getCachedReviewGraph(cwd);
15159
15320
  graphFileCap = getReviewGraphSizeSkipVerdict(cwd)?.maxFileCount;
15160
15321
  const drift = graph ? getReviewGraphRevisionDrift(cwd) : void 0;
@@ -15743,6 +15904,8 @@ async function readEnclosing(file, line, cwd, options) {
15743
15904
  const startedAt = Date.now();
15744
15905
  const absPath = path26.resolve(cwd, file);
15745
15906
  const targetLine = Math.max(1, Math.floor(line));
15907
+ const maxLines = options?.maxLines !== void 0 && Number.isFinite(options.maxLines) ? Math.max(1, Math.floor(options.maxLines)) : void 0;
15908
+ const aroundLine = options?.aroundLine !== void 0 && Number.isFinite(options.aroundLine) ? options.aroundLine : void 0;
15746
15909
  const log = (found) => {
15747
15910
  logLatency({
15748
15911
  type: "phase",
@@ -15837,8 +16000,8 @@ async function readEnclosing(file, line, cwd, options) {
15837
16000
  }
15838
16001
  const lines = content.split(/\r?\n/);
15839
16002
  const limit = selected.endLine - selected.startLine + 1;
15840
- if (options?.maxLines && limit > options.maxLines) {
15841
- const oversize = options.onOversize ?? "error";
16003
+ if (maxLines !== void 0 && limit > maxLines) {
16004
+ const oversize = options?.onOversize ?? "error";
15842
16005
  const base = {
15843
16006
  path: absPath,
15844
16007
  line: targetLine,
@@ -15853,7 +16016,7 @@ async function readEnclosing(file, line, cwd, options) {
15853
16016
  ...warnings.length > 0 ? { warnings } : {}
15854
16017
  };
15855
16018
  if (oversize === "slice") {
15856
- const sliceLimit = Math.max(1, Math.floor(options.aroundLine ?? options.maxLines ?? 80));
16019
+ const sliceLimit = Math.max(1, Math.floor(aroundLine ?? maxLines ?? 80));
15857
16020
  const slice = clampSliceRange(targetLine, selected.startLine, selected.endLine, sliceLimit);
15858
16021
  const source2 = lines.slice(slice.startLine - 1, slice.endLine).join("\n");
15859
16022
  log(true);
@@ -15882,14 +16045,14 @@ async function readEnclosing(file, line, cwd, options) {
15882
16045
  confidence: "medium"
15883
16046
  },
15884
16047
  outline: enclosingOutline(selected, symbols, callbacks, filters, absPath),
15885
- error: `Enclosing ${selected.kind} spans ${limit} lines, above maxLines ${options.maxLines}`
16048
+ error: `Enclosing ${selected.kind} spans ${limit} lines, above maxLines ${maxLines}`
15886
16049
  };
15887
16050
  }
15888
16051
  log(false);
15889
16052
  return {
15890
16053
  ...base,
15891
16054
  found: false,
15892
- error: `Enclosing ${selected.kind} spans ${limit} lines, above maxLines ${options.maxLines}`
16055
+ error: `Enclosing ${selected.kind} spans ${limit} lines, above maxLines ${maxLines}`
15893
16056
  };
15894
16057
  }
15895
16058
  const source = lines.slice(selected.startLine - 1, selected.endLine).join("\n");
@@ -16063,7 +16226,7 @@ function roleFor(graph, filePath) {
16063
16226
  return top.length > 0 ? top.map((s) => s.name).join(", ") : void 0;
16064
16227
  }
16065
16228
  async function computeHubs(graph, degrees, cwd, limit, focusTerms) {
16066
- const { computeTransitiveImpact } = await import("../chunk-C6AODRNU.js");
16229
+ const { computeTransitiveImpact } = await import("../chunk-WTSQKJAR.js");
16067
16230
  const ranked = [...graph.fileNodes.entries()].map(([filePath, fileNodeId]) => ({
16068
16231
  filePath,
16069
16232
  fileNodeId,
@@ -16314,7 +16477,7 @@ function triggerBackgroundGraphBuild(cwd, deps) {
16314
16477
  async function projectReport(cwd, options) {
16315
16478
  const limit = clampLimit(options?.limit);
16316
16479
  const focusTerms = normalizeFocus2(options?.focus);
16317
- const { getCachedReviewGraph, getReviewGraphSizeSkipVerdict, getLastReviewGraphBuildAttempt, buildOrUpdateGraph, isGraphBuildInFlight, getReviewGraphRevisionDrift } = await import("../chunk-SKVNHCT5.js");
16480
+ const { getCachedReviewGraph, getReviewGraphSizeSkipVerdict, getLastReviewGraphBuildAttempt, buildOrUpdateGraph, isGraphBuildInFlight, getReviewGraphRevisionDrift } = await import("../chunk-7T64QA5D.js");
16318
16481
  let graph;
16319
16482
  try {
16320
16483
  graph = getCachedReviewGraph(cwd);
@@ -16337,7 +16500,7 @@ async function projectReport(cwd, options) {
16337
16500
  };
16338
16501
  }
16339
16502
  const previousAttempt = getLastReviewGraphBuildAttempt(cwd);
16340
- const { FactStore: FactStore2 } = await import("../chunk-46TQJSUE.js");
16503
+ const { FactStore: FactStore2 } = await import("../chunk-X33QECRJ.js");
16341
16504
  const trigger = triggerBackgroundGraphBuild(cwd, {
16342
16505
  buildOrUpdateGraph,
16343
16506
  isGraphBuildInFlight,
@@ -16372,6 +16535,9 @@ async function projectReport(cwd, options) {
16372
16535
  deadWeight
16373
16536
  };
16374
16537
  }
16538
+ function projectReportViewIsJson(view) {
16539
+ return resolveModuleReportPreset(view).format === "json";
16540
+ }
16375
16541
  function renderTextProjectReport(report) {
16376
16542
  if (!report.available) {
16377
16543
  const lines2 = [
@@ -16660,9 +16826,11 @@ async function effectiveConfig(options = {}) {
16660
16826
  };
16661
16827
  return view;
16662
16828
  }
16663
- function toolReason(selected, disabled, kind) {
16829
+ function toolReason(selected, disabled, lacksConfig, kind) {
16664
16830
  if (disabled)
16665
16831
  return "disabled-by-config";
16832
+ if (selected && lacksConfig)
16833
+ return "no-project-config";
16666
16834
  if (selected)
16667
16835
  return "selected";
16668
16836
  return kind === void 0 ? "no-dispatch-plan" : "not-registered-for-kind";
@@ -16698,16 +16866,22 @@ async function fileView(absolute, resolution, resolved, homeDir, workspaceCwd, l
16698
16866
  const planned = kind ? getToolPlan(kind)?.groups.flatMap((group) => group.runnerIds) ?? [] : [];
16699
16867
  const disabledRunners = new Map(disabledRunnersOf(resolution).runners.map((runner) => [runner.id, runner]));
16700
16868
  const ids = [.../* @__PURE__ */ new Set([...planned, ...available])].sort(compareOrdinal);
16701
- const tools = ids.map((id) => ({
16702
- id,
16703
- selected: available.has(id) && !disabledRunners.has(id),
16704
- reason: toolReason(available.has(id), disabledRunners.has(id), kind),
16705
- ...decidedByOrNothing(viewOf(disabledRunners.get(id)?.decidedBy, homeDir)),
16706
- resolvedCwd: homeRelativePath(resolveToolCwd("runner", id, absolute, {
16707
- cwd: workspaceCwd,
16708
- suppressTelemetry: true
16709
- }).cwd, homeDir)
16710
- }));
16869
+ const runnerCwdOf = (id) => resolveToolCwd("runner", id, absolute, {
16870
+ cwd: workspaceCwd,
16871
+ suppressTelemetry: true
16872
+ }).cwd;
16873
+ const wouldRun = new Set(await getAvailableRunners(absolute, { configCwd: runnerCwdOf }));
16874
+ const tools = ids.map((id) => {
16875
+ const denied2 = disabledRunners.has(id);
16876
+ const lacksConfig = available.has(id) && !wouldRun.has(id);
16877
+ return {
16878
+ id,
16879
+ selected: available.has(id) && !denied2 && !lacksConfig,
16880
+ reason: toolReason(available.has(id), denied2, lacksConfig, kind),
16881
+ ...decidedByOrNothing(viewOf(disabledRunners.get(id)?.decidedBy, homeDir)),
16882
+ resolvedCwd: homeRelativePath(runnerCwdOf(id), homeDir)
16883
+ };
16884
+ });
16711
16885
  return {
16712
16886
  path: homeRelativePath(absolute, homeDir),
16713
16887
  ...language === void 0 ? {} : { language: language.id },
@@ -16789,46 +16963,52 @@ function resourceFootprint() {
16789
16963
  return getResourceFootprint();
16790
16964
  }
16791
16965
  function symbolSearchFileMatchesLang(file, lang) {
16792
- const token = lang.toLowerCase();
16793
- const declared = resolveFilenameLanguage(file);
16794
- if (declared && (declared.id === token || declared.grammar === token)) {
16795
- return true;
16796
- }
16797
- const base = path29.basename(file);
16798
- if (SPECIAL_FILENAMES.some((entry) => entry.kind === token && entry.pattern.test(base))) {
16799
- return true;
16800
- }
16801
- const exts = extensionsForLanguageToken(token);
16802
- if (exts.length === 0)
16803
- return false;
16804
- return exts.includes(path29.extname(file).toLowerCase());
16805
- }
16806
- function fileMatchesPathGlobs(file, cwd, globs) {
16807
- const rel = path29.relative(cwd, file).split(path29.sep).join("/");
16808
- const abs = path29.resolve(file).split(path29.sep).join("/");
16809
- const options = { dot: true, nocase: process.platform === "win32" };
16810
- const matches = (candidate, pattern) => minimatch(candidate, pattern, options) || minimatch(candidate, `${pattern}/**`, options);
16811
- return globs.some((raw) => {
16812
- const within = path29.isAbsolute(raw) ? relativeInside(cwd, raw) : void 0;
16813
- if (within !== void 0)
16814
- return matches(rel, toPosix(within) || "**");
16815
- const pattern = toPosix(raw);
16816
- return matches(rel, pattern) || abs !== rel && matches(abs, pattern);
16817
- });
16966
+ const scope = resolveLanguageScope(lang);
16967
+ return "refusal" in scope ? false : scope.matches(file);
16818
16968
  }
16819
16969
  function buildSymbolSearchFileFilter(cwd, options) {
16820
16970
  const paths = options.paths;
16821
16971
  const lang = options.lang?.trim();
16822
16972
  if (!paths?.length && !lang)
16823
16973
  return void 0;
16974
+ const scope = paths?.length ? scopeEntryKeys(cwd, paths) : void 0;
16824
16975
  return (file) => {
16825
- if (paths?.length && !fileMatchesPathGlobs(file, cwd, paths))
16976
+ if (scope && !fileIsInScope(file, scope))
16826
16977
  return false;
16827
16978
  if (lang && !symbolSearchFileMatchesLang(file, lang))
16828
16979
  return false;
16829
16980
  return true;
16830
16981
  };
16831
16982
  }
16983
+ function scopeEntryKeys(cwd, paths) {
16984
+ return new Set(paths.map((entry) => normalizeEphemeralMapKey(path29.resolve(cwd, entry))));
16985
+ }
16986
+ function fileIsInScope(file, scope) {
16987
+ let key = normalizeEphemeralMapKey(path29.resolve(file));
16988
+ for (; ; ) {
16989
+ if (scope.has(key))
16990
+ return true;
16991
+ const cut = key.lastIndexOf("/");
16992
+ if (cut < 0)
16993
+ return false;
16994
+ key = key.slice(0, cut);
16995
+ if (!key.includes("/"))
16996
+ return scope.has(`${key}/`);
16997
+ }
16998
+ }
16999
+ function unknownLangRefusal(query, lang) {
17000
+ const tokens = lang?.trim() ? [lang] : [];
17001
+ for (const entry of parseWordIndexQuery(query).filters) {
17002
+ if (entry.key === "lang")
17003
+ tokens.push(entry.value);
17004
+ }
17005
+ for (const token of tokens) {
17006
+ const scope = resolveLanguageScope(token);
17007
+ if ("refusal" in scope)
17008
+ return scope.refusal;
17009
+ }
17010
+ return void 0;
17011
+ }
16832
17012
  function annotateSymbolSearchHitsWithGraph(hits, centrality, graph) {
16833
17013
  for (const hit of hits) {
16834
17014
  const normalized = normalizeMapKey(path29.resolve(hit.file));
@@ -16846,11 +17026,16 @@ function annotateSymbolSearchHitsWithGraph(hits, centrality, graph) {
16846
17026
  };
16847
17027
  }
16848
17028
  }
17029
+ var SYMBOL_SEARCH_EMPTY_QUERY_REFUSAL = "Provide a non-empty `query`, or scope the search with `paths`/`lang` or an inline `lang:`/`file:`/`ext:` filter.";
16849
17030
  function toSymbolSearchHit(result) {
17031
+ if (result.kind === "file") {
17032
+ return { file: result.file, score: result.score, kind: "file" };
17033
+ }
16850
17034
  const line = result.lines[0] ?? 1;
16851
17035
  return {
16852
17036
  file: result.file,
16853
17037
  score: result.score,
17038
+ kind: "symbol",
16854
17039
  hits: result.hits,
16855
17040
  startLine: line,
16856
17041
  endLine: line
@@ -16858,6 +17043,18 @@ function toSymbolSearchHit(result) {
16858
17043
  }
16859
17044
  async function symbolSearch(query, cwd, limit = 20, options = {}) {
16860
17045
  const effectiveLimit = Number.isFinite(limit) ? Math.max(1, Math.floor(limit)) : 20;
17046
+ if (isEmptyWordIndexQuery(query) && !options.paths?.length && !options.lang?.trim()) {
17047
+ return {
17048
+ available: true,
17049
+ query,
17050
+ results: [],
17051
+ refusal: SYMBOL_SEARCH_EMPTY_QUERY_REFUSAL
17052
+ };
17053
+ }
17054
+ const unknownLang = unknownLangRefusal(query, options.lang);
17055
+ if (unknownLang) {
17056
+ return { available: true, query, results: [], refusal: unknownLang };
17057
+ }
16861
17058
  const warmLease = acquireWarmWordIndex(cwd);
16862
17059
  const snapshot = loadProjectSnapshotWithoutWordIndex(cwd);
16863
17060
  const index = warmLease.index;
@@ -16889,7 +17086,7 @@ async function symbolSearch(query, cwd, limit = 20, options = {}) {
16889
17086
  warmLease.release();
16890
17087
  }
16891
17088
  const hits = results.map(toSymbolSearchHit);
16892
- const { getCachedReviewGraph } = await import("../chunk-SKVNHCT5.js");
17089
+ const { getCachedReviewGraph } = await import("../chunk-7T64QA5D.js");
16893
17090
  const graph = getCachedReviewGraph(cwd);
16894
17091
  if (graph)
16895
17092
  annotateSymbolSearchHitsWithGraph(hits, centrality, graph);
@@ -16907,6 +17104,9 @@ function coverageLine(coverage) {
16907
17104
  return `Index covers ${coverage.files} files${coverage.truncated ? " (capped \u2014 results may be incomplete)" : ""}.`;
16908
17105
  }
16909
17106
  function formatSymbolSearchRow(hit, position, cwd) {
17107
+ const file = path29.relative(cwd, hit.file);
17108
+ if (hit.kind === "file")
17109
+ return ` ${position}. ${file}`;
16910
17110
  const annotations = hit.annotations;
16911
17111
  const detail = [
16912
17112
  `score ${hit.score.toFixed(2)}`,
@@ -16914,7 +17114,7 @@ function formatSymbolSearchRow(hit, position, cwd) {
16914
17114
  ...typeof annotations?.fanIn === "number" ? [`fanIn ${annotations.fanIn}`] : [],
16915
17115
  ...typeof annotations?.complexity === "number" ? [`complexity ${annotations.complexity}`] : []
16916
17116
  ];
16917
- return ` ${position}. ${path29.relative(cwd, hit.file)} ${hit.startLine} (${detail.join(", ")})`;
17117
+ return ` ${position}. ${file} ${hit.startLine} (${detail.join(", ")})`;
16918
17118
  }
16919
17119
  function renderCompactSymbolSearch(result, options) {
16920
17120
  const hits = result.results;
@@ -16939,6 +17139,9 @@ function renderCompactSymbolSearch(result, options) {
16939
17139
  return sections.join("\n\n");
16940
17140
  }
16941
17141
 
17142
+ // dist/tools/ast-grep-replace.js
17143
+ import * as path33 from "node:path";
17144
+
16942
17145
  // dist/clients/deps/typebox.js
16943
17146
  import { Type } from "typebox";
16944
17147
 
@@ -16962,10 +17165,10 @@ function truncate(value, max) {
16962
17165
  return value;
16963
17166
  return `${value.slice(0, max)}\u2026[truncated ${value.length - max} chars]`;
16964
17167
  }
16965
- function classifyAstGrepError(errorMessage) {
16966
- if (!errorMessage)
17168
+ function classifyAstGrepError(errorMessage3) {
17169
+ if (!errorMessage3)
16967
17170
  return "other";
16968
- const lower = errorMessage.toLowerCase();
17171
+ const lower = errorMessage3.toLowerCase();
16969
17172
  if (lower.includes("multiple ast nodes are detected") || lower.includes("the pattern appears to contain multiple ast nodes")) {
16970
17173
  return "multiple_ast_nodes";
16971
17174
  }
@@ -17125,9 +17328,102 @@ function canonicalLanguage(lang) {
17125
17328
 
17126
17329
  // dist/tools/shared.js
17127
17330
  import * as os4 from "node:os";
17331
+ import * as path32 from "node:path";
17332
+
17333
+ // dist/clients/path-globs.js
17334
+ import * as fs19 from "node:fs";
17128
17335
  import * as path31 from "node:path";
17336
+ function fileMatchesPathGlobs(file, cwd, globs) {
17337
+ const rel = path31.relative(cwd, file).split(path31.sep).join("/");
17338
+ const abs = path31.resolve(file).split(path31.sep).join("/");
17339
+ const options = { dot: true, nocase: process.platform === "win32" };
17340
+ const matches = (candidate, pattern) => minimatch(candidate, pattern, options) || minimatch(candidate, `${pattern}/**`, options);
17341
+ return globs.some((raw) => {
17342
+ const within = path31.isAbsolute(raw) ? relativeInside(cwd, raw) : void 0;
17343
+ if (within !== void 0)
17344
+ return matches(rel, toPosix(within) || "**");
17345
+ const pattern = toPosix(raw);
17346
+ return matches(rel, pattern) || abs !== rel && matches(abs, pattern);
17347
+ });
17348
+ }
17349
+ function hasGlobMagic(text) {
17350
+ return /[*?[{]/.test(text);
17351
+ }
17352
+ async function isGlobEntry(resolved, cwd) {
17353
+ const spelled = relativeInside(path31.resolve(cwd), resolved) ?? resolved;
17354
+ if (!hasGlobMagic(spelled))
17355
+ return false;
17356
+ return fs19.promises.lstat(resolved).then(() => false, (refusal) => {
17357
+ return refusal.code === "ENOENT" || refusal.code === "ENOTDIR";
17358
+ });
17359
+ }
17360
+ function literalRoot(cwd, relative8) {
17361
+ let root = cwd;
17362
+ for (const segment of relative8.split("/")) {
17363
+ if (hasGlobMagic(segment))
17364
+ break;
17365
+ root = path31.join(root, segment);
17366
+ }
17367
+ return root;
17368
+ }
17369
+ async function expandPathsEntry(entry, cwd, budget, options = {}) {
17370
+ const cwdAbsolute = path31.resolve(cwd);
17371
+ const absolute = path31.resolve(cwdAbsolute, entry);
17372
+ if (!await isGlobEntry(absolute, cwdAbsolute))
17373
+ return { entries: [absolute], root: cwdAbsolute };
17374
+ const relative8 = relativeInside(cwdAbsolute, absolute);
17375
+ if (relative8 === void 0) {
17376
+ return { entries: [], refusal: "outside", root: cwdAbsolute };
17377
+ }
17378
+ const root = literalRoot(cwdAbsolute, relative8);
17379
+ const { signal } = options;
17380
+ const matcher = getProjectIgnoreMatcher(cwdAbsolute);
17381
+ const policy = { ignoreMatcher: matcher };
17382
+ const pattern = [absolute];
17383
+ const maxVisited = options.maxVisited ?? DEFAULT_MAX_SCAN_ENTRIES;
17384
+ const matches = [];
17385
+ let visited = 0;
17386
+ let walkedTooMuch = false;
17387
+ await walkTreeStackAsync(
17388
+ root,
17389
+ (entry_, fullPath) => {
17390
+ if (signal?.aborted)
17391
+ return "stop";
17392
+ visited += 1;
17393
+ if (visited > maxVisited) {
17394
+ walkedTooMuch = true;
17395
+ return "stop";
17396
+ }
17397
+ if (entry_.isDirectory()) {
17398
+ if (!shouldRecurseIntoDir(entry_, fullPath, policy))
17399
+ return "skip";
17400
+ if (!fileMatchesPathGlobs(fullPath, cwdAbsolute, pattern))
17401
+ return "recurse";
17402
+ } else if (!entry_.isFile() || matcher.isIgnored(fullPath, false) || !fileMatchesPathGlobs(fullPath, cwdAbsolute, pattern)) {
17403
+ return "skip";
17404
+ }
17405
+ matches.push(fullPath);
17406
+ return matches.length > budget ? "stop" : "skip";
17407
+ },
17408
+ // Yield off the event loop per budget slice: a glob can name a whole
17409
+ // workspace, and a tool call must not hold pi's TUI (#1137).
17410
+ { budgetMs: 8, beforeWalk: () => matcher.ensureTrackedIndex() }
17411
+ );
17412
+ if (signal?.aborted)
17413
+ return { entries: [], refusal: "aborted", root };
17414
+ if (walkedTooMuch)
17415
+ return { entries: [], refusal: "over-walk", root };
17416
+ if (matches.length > budget)
17417
+ return { entries: [], refusal: "over-cap", root };
17418
+ if (matches.length === 0)
17419
+ return { entries: [], refusal: "no-match", root };
17420
+ return { entries: matches, root };
17421
+ }
17422
+
17423
+ // dist/tools/shared.js
17129
17424
  var MAX_PATHS_ENTRIES = 100;
17130
17425
  var FILE_PATH_KEYS = ["path", "file", "filePath"];
17426
+ var CONSTRAINED_JSON_SCHEMA_SAMPLING = { type: "json_schema", strict: "prefer" };
17131
17427
  function readFilePath(params) {
17132
17428
  const sent = [];
17133
17429
  const blanks = [];
@@ -17156,6 +17452,14 @@ function readFilePath(params) {
17156
17452
  }
17157
17453
  return { path: first.value, key: first.key };
17158
17454
  }
17455
+ var PATHS_GLOB_CLAUSE = "A glob entry (e.g. `src/**/*.ts`) expands to the files it matches; one matching none is refused (`no file matches`).";
17456
+ function overCapRefusal(entry) {
17457
+ const what = entry === void 0 ? "`paths`" : `the glob \`${entry}\``;
17458
+ return {
17459
+ entries: [],
17460
+ refusal: `${what} names more than ${MAX_PATHS_ENTRIES} files \u2014 narrow the pattern, or pass a directory entry`
17461
+ };
17462
+ }
17159
17463
  function describeEntryType(value) {
17160
17464
  if (value === null)
17161
17465
  return "null";
@@ -17163,11 +17467,11 @@ function describeEntryType(value) {
17163
17467
  return "an array";
17164
17468
  return typeof value;
17165
17469
  }
17166
- function readPathsArgument(raw, options) {
17470
+ async function readPathsArgument(raw, options) {
17167
17471
  const base = options.cwd || ".";
17168
17472
  const absent = options.absent ?? "none";
17169
17473
  if (raw === void 0 || raw === null) {
17170
- return { entries: absent === "cwd" ? [path31.resolve(base)] : [] };
17474
+ return { entries: absent === "cwd" ? [path32.resolve(base)] : [] };
17171
17475
  }
17172
17476
  if (!Array.isArray(raw))
17173
17477
  return { entries: [], refusal: "paths must be an array of strings" };
@@ -17190,8 +17494,40 @@ function readPathsArgument(raw, options) {
17190
17494
  };
17191
17495
  if (!entry.trim())
17192
17496
  return { entries: [], refusal: `paths entry ${index + 1} is blank` };
17193
- entries.push(resolveHostToolPath(entry, base));
17497
+ if (entry.trimStart().startsWith("!"))
17498
+ return {
17499
+ entries: [],
17500
+ refusal: `paths entry ${index + 1} starts with "!": \`paths\` names the entries to include, not the ones to leave out, and a negated entry names every other file. Name the entries you want, or ignore what you do not want through the project ignore config.`
17501
+ };
17502
+ const resolved = resolveHostToolPath(entry, base);
17503
+ const expanded = await expandPathsEntry(resolved, base, options.filterOnly ? Number.POSITIVE_INFINITY : MAX_PATHS_ENTRIES - entries.length, { signal: options.signal });
17504
+ if (expanded.refusal === "no-match") {
17505
+ return {
17506
+ entries: [],
17507
+ refusal: `no file matches \`${entry}\` \u2014 the glob matched no file under ${expanded.root}`
17508
+ };
17509
+ }
17510
+ if (expanded.refusal === "over-cap")
17511
+ return overCapRefusal(entry);
17512
+ if (expanded.refusal === "over-walk") {
17513
+ return {
17514
+ entries: [],
17515
+ refusal: `the glob \`${entry}\` walked more than ${DEFAULT_MAX_SCAN_ENTRIES} entries under ${expanded.root} without finishing \u2014 name a deeper directory, or narrow the pattern`
17516
+ };
17517
+ }
17518
+ if (expanded.refusal === "outside") {
17519
+ return {
17520
+ entries: [],
17521
+ refusal: `the glob \`${entry}\` reaches outside the workspace ${expanded.root} \u2014 a glob expands inside the workspace only; name a file or directory outside it literally`
17522
+ };
17523
+ }
17524
+ if (expanded.refusal === "aborted") {
17525
+ return { entries: [], refusal: "paths expansion aborted" };
17526
+ }
17527
+ entries.push(...expanded.entries);
17194
17528
  }
17529
+ if (!options.filterOnly && entries.length > MAX_PATHS_ENTRIES)
17530
+ return overCapRefusal(void 0);
17195
17531
  return { entries };
17196
17532
  }
17197
17533
  function defaultedCwdHomeRefusal(paths, cwd) {
@@ -17261,7 +17597,7 @@ function lineCount(value) {
17261
17597
  }
17262
17598
  return lines;
17263
17599
  }
17264
- function createAstGrepReplaceTool(astGrepClient2, captureLineage) {
17600
+ function createAstGrepReplaceTool(astGrepClient2, captureLineage, getFlag) {
17265
17601
  return {
17266
17602
  name: "ast_grep_replace",
17267
17603
  label: "AST Replace",
@@ -17288,7 +17624,9 @@ function createAstGrepReplaceTool(astGrepClient2, captureLineage) {
17288
17624
  lang: Type.String({
17289
17625
  description: "Language id, e.g. typescript, tsx, python, go."
17290
17626
  }),
17291
- paths: Type.Optional(Type.Array(Type.String(), { description: "Specific files/folders" })),
17627
+ paths: Type.Optional(Type.Array(Type.String(), {
17628
+ description: `Specific files/folders. ${PATHS_GLOB_CLAUSE}`
17629
+ })),
17292
17630
  insideKind: Type.Optional(Type.String({
17293
17631
  description: "Ancestor AST node kind filter."
17294
17632
  })),
@@ -17312,6 +17650,19 @@ function createAstGrepReplaceTool(astGrepClient2, captureLineage) {
17312
17650
  }),
17313
17651
  async execute(_toolCallId, params, _signal, _onUpdate, ctx) {
17314
17652
  const lineage = captureLineage?.();
17653
+ const signal = combineAbortSignals(_signal, ctx.signal);
17654
+ const failureText = (failure, written = []) => {
17655
+ const lines = [
17656
+ failure.aborted ? "Error: operation aborted" : errorTextWithHint(failure.error ?? "")
17657
+ ];
17658
+ if (written.length > 0) {
17659
+ lines.push(`${written.length} file(s) were already rewritten before it stopped: ${written.join(", ")}`);
17660
+ }
17661
+ if (failure.writeStarted) {
17662
+ lines.push("The write had started, so some files may already be rewritten.");
17663
+ }
17664
+ return lines.join("\n");
17665
+ };
17315
17666
  const sessionId = ctx.sessionManager?.getSessionId?.();
17316
17667
  const startedAt = Date.now();
17317
17668
  const { pattern, rewrite, paths, apply, strictness, insideKind, hasKind, hasDescendantKind, follows, precedes } = params;
@@ -17348,9 +17699,10 @@ function createAstGrepReplaceTool(astGrepClient2, captureLineage) {
17348
17699
  details: {}
17349
17700
  };
17350
17701
  }
17351
- const pathsRead = readPathsArgument(paths, {
17702
+ const pathsRead = await readPathsArgument(paths, {
17352
17703
  cwd: ctx.cwd,
17353
- absent: "cwd"
17704
+ absent: "cwd",
17705
+ signal
17354
17706
  });
17355
17707
  if (pathsRead.refusal) {
17356
17708
  logOutcome("error", { errorRaw: pathsRead.refusal });
@@ -17385,6 +17737,16 @@ function createAstGrepReplaceTool(astGrepClient2, captureLineage) {
17385
17737
  };
17386
17738
  }
17387
17739
  const searchPaths = pathsRead.entries;
17740
+ const sessionRoot = path33.resolve(ctx.cwd ?? process.cwd());
17741
+ if (applyFlag && getFlag?.("no-autofix", sessionRoot)) {
17742
+ const reason = "ast_grep_replace refused: apply is disabled by the no-autofix flag (autofix.enabled=false); a preview with apply: false is still allowed";
17743
+ logOutcome("error", { errorRaw: reason });
17744
+ return {
17745
+ content: [{ type: "text", text: `Error: ${reason}` }],
17746
+ isError: true,
17747
+ details: {}
17748
+ };
17749
+ }
17388
17750
  if (hasStructuralIntent({
17389
17751
  insideKind,
17390
17752
  hasKind,
@@ -17417,7 +17779,7 @@ function createAstGrepReplaceTool(astGrepClient2, captureLineage) {
17417
17779
  details: {}
17418
17780
  };
17419
17781
  }
17420
- const ruleResult = await astGrepClient2.replaceWithRule(ruleYaml, searchPaths, applyFlag, { lineage, toolCallId: _toolCallId, sessionId });
17782
+ const ruleResult = await astGrepClient2.replaceWithRule(ruleYaml, searchPaths, applyFlag, { lineage, toolCallId: _toolCallId, sessionId, signal, sessionRoot });
17421
17783
  if (ruleResult.stalePreview) {
17422
17784
  logOutcome("error", { errorRaw: "stale_preview" });
17423
17785
  return {
@@ -17441,7 +17803,7 @@ function createAstGrepReplaceTool(astGrepClient2, captureLineage) {
17441
17803
  content: [
17442
17804
  {
17443
17805
  type: "text",
17444
- text: errorTextWithHint(ruleResult.error)
17806
+ text: failureText(ruleResult, applyFlag ? [...new Set(ruleResult.matches.map((m) => m.file))] : [])
17445
17807
  }
17446
17808
  ],
17447
17809
  isError: true,
@@ -17463,7 +17825,14 @@ function createAstGrepReplaceTool(astGrepClient2, captureLineage) {
17463
17825
  }
17464
17826
  };
17465
17827
  }
17466
- const result = await astGrepClient2.replace(pattern, rewrite, lang, searchPaths, applyFlag, { strictness, lineage, toolCallId: _toolCallId, sessionId });
17828
+ const result = await astGrepClient2.replace(pattern, rewrite, lang, searchPaths, applyFlag, {
17829
+ strictness,
17830
+ lineage,
17831
+ toolCallId: _toolCallId,
17832
+ sessionId,
17833
+ signal,
17834
+ sessionRoot
17835
+ });
17467
17836
  if (result.stalePreview) {
17468
17837
  logOutcome("error", { errorRaw: "stale_preview" });
17469
17838
  return {
@@ -17480,11 +17849,11 @@ function createAstGrepReplaceTool(astGrepClient2, captureLineage) {
17480
17849
  if (result.error) {
17481
17850
  logOutcome("error", { errorRaw: result.error });
17482
17851
  return {
17483
- content: [
17484
- { type: "text", text: errorTextWithHint(result.error) }
17485
- ],
17852
+ content: [{ type: "text", text: failureText(result) }],
17486
17853
  isError: true,
17487
- details: {}
17854
+ // #5417: an interrupted `--update-all` rewrote files before it
17855
+ // failed; they still dispatch, as the structural path's do.
17856
+ details: { appliedFiles: result.appliedFiles ?? [] }
17488
17857
  };
17489
17858
  }
17490
17859
  const isDryRun = !applyFlag;
@@ -17753,7 +18122,7 @@ function createAstGrepSearchTool(astGrepClient2) {
17753
18122
  }),
17754
18123
  paths: Type.Optional(Type.Array(Type.String(), {
17755
18124
  maxItems: MAX_PATHS_ENTRIES,
17756
- description: "Files or directories to search."
18125
+ description: `Files or directories to search. ${PATHS_GLOB_CLAUSE}`
17757
18126
  })),
17758
18127
  selector: Type.Optional(Type.String({
17759
18128
  description: "AST node kind filter."
@@ -17855,9 +18224,10 @@ function createAstGrepSearchTool(astGrepClient2) {
17855
18224
  const hasPattern = Boolean(pattern.trim());
17856
18225
  const hasNodeKind = normalizedNodeKind.length > 0;
17857
18226
  const rawPaths = params.paths;
17858
- const pathsRead = readPathsArgument(rawPaths, {
18227
+ const pathsRead = await readPathsArgument(rawPaths, {
17859
18228
  cwd: ctx.cwd,
17860
- absent: "cwd"
18229
+ absent: "cwd",
18230
+ signal: abortSignal
17861
18231
  });
17862
18232
  if (pathsRead.refusal) {
17863
18233
  const errorRaw = pathsRead.refusal;
@@ -18202,10 +18572,10 @@ ${hint}` : `${output}${paginationNote}`;
18202
18572
  }
18203
18573
 
18204
18574
  // dist/tools/lens-diagnostics.js
18205
- import { promises as fs22 } from "node:fs";
18575
+ import { promises as fs23 } from "node:fs";
18206
18576
  import * as fsSync from "node:fs";
18207
18577
  import * as os7 from "node:os";
18208
- import * as path38 from "node:path";
18578
+ import * as path40 from "node:path";
18209
18579
 
18210
18580
  // dist/clients/project-diagnostics/extractors.js
18211
18581
  var WARM_TRIGGER = {
@@ -18263,14 +18633,14 @@ function reasonFromAvailabilityVerdict(tool, verdict) {
18263
18633
  }
18264
18634
 
18265
18635
  // dist/clients/project-diagnostics/fresh-fetch.js
18266
- import * as fs20 from "node:fs";
18636
+ import * as fs21 from "node:fs";
18267
18637
  import * as os5 from "node:os";
18268
- import * as path36 from "node:path";
18638
+ import * as path38 from "node:path";
18269
18639
 
18270
18640
  // dist/clients/project-diagnostics/runner-adapters/jscpd.js
18271
- import * as path32 from "node:path";
18641
+ import * as path34 from "node:path";
18272
18642
  function resolveClonePath(cwd, file) {
18273
- return path32.isAbsolute(file) ? file : path32.resolve(cwd, file);
18643
+ return path34.isAbsolute(file) ? file : path34.resolve(cwd, file);
18274
18644
  }
18275
18645
  function jscpdCloneToProjectDiagnostics(cwd, clone) {
18276
18646
  const a = resolveClonePath(cwd, clone.fileA);
@@ -18283,7 +18653,7 @@ function jscpdCloneToProjectDiagnostics(cwd, clone) {
18283
18653
  tool: "jscpd",
18284
18654
  runner: "jscpd",
18285
18655
  rule: "jscpd:duplicate",
18286
- message: `Duplicate code (${clone.lines} lines) \u2014 also at ${path32.relative(cwd, otherFile)}:${otherLine}`,
18656
+ message: `Duplicate code (${clone.lines} lines) \u2014 also at ${path34.relative(cwd, otherFile)}:${otherLine}`,
18287
18657
  source: "project-scan"
18288
18658
  });
18289
18659
  return [
@@ -18298,16 +18668,16 @@ function jscpdResultToProjectDiagnostics(cwd, result) {
18298
18668
  }
18299
18669
 
18300
18670
  // dist/clients/project-diagnostics/runner-adapters/madge.js
18301
- import * as path33 from "node:path";
18671
+ import * as path35 from "node:path";
18302
18672
  function resolveCyclePath(cwd, file) {
18303
- return path33.isAbsolute(file) ? file : path33.resolve(cwd, file);
18673
+ return path35.isAbsolute(file) ? file : path35.resolve(cwd, file);
18304
18674
  }
18305
18675
  function cycleMembers(dep) {
18306
18676
  return dep.path.length > 0 ? dep.path : [dep.file];
18307
18677
  }
18308
18678
  function circularDepToProjectDiagnostics(cwd, dep) {
18309
18679
  const members = cycleMembers(dep);
18310
- const rendered = `${members.map((f) => path33.basename(f)).join(" \u2192 ")} \u2192 ${path33.basename(members[0] ?? "")}`;
18680
+ const rendered = `${members.map((f) => path35.basename(f)).join(" \u2192 ")} \u2192 ${path35.basename(members[0] ?? "")}`;
18311
18681
  return members.map((file) => ({
18312
18682
  filePath: resolveCyclePath(cwd, file),
18313
18683
  severity: "warning",
@@ -18333,7 +18703,7 @@ function circularDepsToProjectDiagnostics(cwd, circular) {
18333
18703
  }
18334
18704
 
18335
18705
  // dist/clients/project-diagnostics/runner-adapters/opengrep.js
18336
- import * as path34 from "node:path";
18706
+ import * as path36 from "node:path";
18337
18707
  function severityFor(raw) {
18338
18708
  switch (raw.toUpperCase()) {
18339
18709
  case "ERROR":
@@ -18348,7 +18718,7 @@ function opengrepFindingToProjectDiagnostic(cwd, finding) {
18348
18718
  const { severity, blocking } = severityFor(finding.severity);
18349
18719
  const cweSuffix = finding.cwe?.length ? ` (${finding.cwe[0]})` : "";
18350
18720
  return {
18351
- filePath: path34.isAbsolute(finding.path) ? finding.path : path34.resolve(cwd, finding.path),
18721
+ filePath: path36.isAbsolute(finding.path) ? finding.path : path36.resolve(cwd, finding.path),
18352
18722
  line: finding.startLine,
18353
18723
  column: finding.startCol,
18354
18724
  severity,
@@ -18367,8 +18737,8 @@ function opengrepResultToProjectDiagnostics(cwd, result) {
18367
18737
  }
18368
18738
 
18369
18739
  // dist/clients/project-diagnostics/runner-adapters/runner-findings.js
18370
- import * as fs19 from "node:fs";
18371
- import * as path35 from "node:path";
18740
+ import * as fs20 from "node:fs";
18741
+ import * as path37 from "node:path";
18372
18742
  function failureMessage(failure) {
18373
18743
  const firstLine2 = failure.message.split("\n")[0]?.slice(0, 300) ?? "";
18374
18744
  return firstLine2 ? `${failure.name}: ${firstLine2}` : failure.name;
@@ -18434,7 +18804,7 @@ function testRunnerFindingsToProjectDiagnostics(cache, cwd, runtime) {
18434
18804
  return [];
18435
18805
  const validation = cwd ? validateAdvisoryProvenance(cache, cwd, runtime) : { status: "unknown", reasons: ["validation-context-missing"] };
18436
18806
  const root = cwd ?? process.cwd();
18437
- const missingKeys = new Set((cache.provenance?.files ?? []).filter((file) => !fs19.existsSync(path35.resolve(root, file.path))).map((file) => advisoryPathKey(file.path, root)));
18807
+ const missingKeys = new Set((cache.provenance?.files ?? []).filter((file) => !fs20.existsSync(path37.resolve(root, file.path))).map((file) => advisoryPathKey(file.path, root)));
18438
18808
  const historical = cache.superseded === true || cache.stale === true || validation.status !== "current";
18439
18809
  return cache.results.filter((result) => !missingKeys.has(advisoryPathKey(result.file, root))).flatMap((result) => testResultToProjectDiagnostics(result, historical)).map((diagnostic) => historical ? {
18440
18810
  ...diagnostic,
@@ -18464,15 +18834,15 @@ function laneObservedAtMs(scannedAt, startedAtMs) {
18464
18834
  return parseScannedAtMs(scannedAt) ?? startedAtMs;
18465
18835
  }
18466
18836
  async function fetchFreshProjectDiagnostics(cacheManager2, cwd, clients, signal, options = {}) {
18467
- const requestedRoot = options.analysisRoot === void 0 ? cwd : path36.resolve(cwd, options.analysisRoot);
18837
+ const requestedRoot = options.analysisRoot === void 0 ? cwd : path38.resolve(cwd, options.analysisRoot);
18468
18838
  let analysisRoot;
18469
18839
  let analysisRootValidation;
18470
18840
  if (options.analysisRoot !== void 0) {
18471
18841
  try {
18472
- if (!fs20.statSync(requestedRoot).isDirectory()) {
18842
+ if (!fs21.statSync(requestedRoot).isDirectory()) {
18473
18843
  throw new Error("is not a directory");
18474
18844
  }
18475
- analysisRoot = fs20.realpathSync(requestedRoot);
18845
+ analysisRoot = fs21.realpathSync(requestedRoot);
18476
18846
  } catch (error) {
18477
18847
  const detail = error instanceof Error ? error.message : String(error);
18478
18848
  const reason = `the explicit analysis root ${requestedRoot} is unavailable or ${detail}`;
@@ -18631,7 +19001,7 @@ async function fetchFreshProjectDiagnostics(cacheManager2, cwd, clients, signal,
18631
19001
  markCold("jscpd", reasonFromAvailabilityVerdict("jscpd", clients.jscpdClient.getAvailabilityVerdict?.()));
18632
19002
  return;
18633
19003
  }
18634
- const isTsProject = fs20.existsSync(path36.join(analysisRoot, "tsconfig.json"));
19004
+ const isTsProject = fs21.existsSync(path38.join(analysisRoot, "tsconfig.json"));
18635
19005
  const scannerKey = isTsProject ? "jscpd-ts" : "jscpd";
18636
19006
  const startMs = Date.now();
18637
19007
  const result = await clients.jscpdClient.scan(analysisRoot, void 0, void 0, isTsProject);
@@ -18656,9 +19026,11 @@ async function fetchFreshProjectDiagnostics(cacheManager2, cwd, clients, signal,
18656
19026
  }
18657
19027
  const startMs = Date.now();
18658
19028
  const result = await clients.depChecker.scanProject(analysisRoot);
18659
- cacheManager2.writeCache("madge", result, analysisRoot, {
18660
- scanDurationMs: Date.now() - startMs
18661
- });
19029
+ if (result.analyzed === true) {
19030
+ cacheManager2.writeCache("madge", result, analysisRoot, {
19031
+ scanDurationMs: Date.now() - startMs
19032
+ });
19033
+ }
18662
19034
  record("madge", circularDepsToProjectDiagnostics(analysisRoot, result.circular ?? []), Date.now() - startMs, result.analyzed === true, result, laneObservedAtMs(result.scannedAt, startMs));
18663
19035
  }),
18664
19036
  // gitleaks — committed-secrets detection. session_start/per-edit stay
@@ -18936,13 +19308,13 @@ function makeProgressReporter(onUpdate, label, throttleMs = 250) {
18936
19308
  }
18937
19309
 
18938
19310
  // dist/tools/lsp-diagnostics.js
18939
- import * as fs21 from "node:fs";
18940
- import * as path37 from "node:path";
19311
+ import * as fs22 from "node:fs";
19312
+ import * as path39 from "node:path";
18941
19313
 
18942
19314
  // dist/clients/out-of-band-changes.js
18943
19315
  import { promises as fsp } from "node:fs";
18944
19316
  import * as os6 from "node:os";
18945
- import { basename as basename8, join as join17 } from "node:path";
19317
+ import { basename as basename7, join as join18 } from "node:path";
18946
19318
 
18947
19319
  // dist/clients/disk-changes.js
18948
19320
  var DISK_CHANGE_ORIGINS = [
@@ -19269,7 +19641,7 @@ var INSTALL_MARKERS = [
19269
19641
  ".yarn-integrity"
19270
19642
  ];
19271
19643
  var VENV_LIB_DIR = "lib";
19272
- var VENV_WINDOWS_SITE_PACKAGES = join17("Lib", "site-packages");
19644
+ var VENV_WINDOWS_SITE_PACKAGES = join18("Lib", "site-packages");
19273
19645
  var VENV_INTERPRETER_DIRS_MAX = 4;
19274
19646
  var DECLARATION_WALK_MAX_DIRS = 4096;
19275
19647
  var DECLARATION_WALK_MAX_FILES = 2048;
@@ -19277,8 +19649,7 @@ var DECLARATION_WALK_CONCURRENCY = 16;
19277
19649
  var DECLARATION_FILE = /(?:\.d\.[cm]?ts|\.pyi)$/i;
19278
19650
  var MAX_ROOTS = 64;
19279
19651
  function declarationLookIntervalMs() {
19280
- const raw = Number(process.env.PI_LENS_DECLARATION_LOOK_MS);
19281
- return Number.isFinite(raw) && raw >= 0 ? raw : 2e3;
19652
+ return nonNegativeIntEnv("PI_LENS_DECLARATION_LOOK_MS", 2e3);
19282
19653
  }
19283
19654
  var records = new BoundedFifoMap(MAX_ROOTS);
19284
19655
  var looks = createSingleFlight({ coalesceTrailing: true });
@@ -19292,21 +19663,21 @@ function demandsWalk(trigger, walk) {
19292
19663
  }
19293
19664
  var fingerprint = (stat) => `${stat.ino}:${stat.size}:${stat.mtimeMs}`;
19294
19665
  function diffServerConfigs(root, before, after) {
19295
- return diffDeclarations(new Map([...before].map(([name, print]) => [join17(root, name), print])), new Map([...after].map(([name, print]) => [join17(root, name), print])));
19666
+ return diffDeclarations(new Map([...before].map(([name, print]) => [join18(root, name), print])), new Map([...after].map(([name, print]) => [join18(root, name), print])));
19296
19667
  }
19297
19668
  async function readVenvInstallParts(root, listed) {
19298
19669
  const targets = [];
19299
19670
  for (const name of PROJECT_VENV_DIR_NAMES) {
19300
19671
  if (!listed.has(name))
19301
19672
  continue;
19302
- const venvRoot = join17(root, name);
19673
+ const venvRoot = join18(root, name);
19303
19674
  targets.push({
19304
19675
  label: `${name}/${VENV_WINDOWS_SITE_PACKAGES}`,
19305
- dir: join17(venvRoot, VENV_WINDOWS_SITE_PACKAGES)
19676
+ dir: join18(venvRoot, VENV_WINDOWS_SITE_PACKAGES)
19306
19677
  });
19307
19678
  let interpreters;
19308
19679
  try {
19309
- interpreters = await fsp.readdir(join17(venvRoot, VENV_LIB_DIR), {
19680
+ interpreters = await fsp.readdir(join18(venvRoot, VENV_LIB_DIR), {
19310
19681
  withFileTypes: true
19311
19682
  });
19312
19683
  } catch {
@@ -19317,7 +19688,7 @@ async function readVenvInstallParts(root, listed) {
19317
19688
  for (const interpreter of interpreterDirs) {
19318
19689
  targets.push({
19319
19690
  label: `${name}/${VENV_LIB_DIR}/${interpreter.name}/site-packages`,
19320
- dir: join17(venvRoot, VENV_LIB_DIR, interpreter.name, "site-packages")
19691
+ dir: join18(venvRoot, VENV_LIB_DIR, interpreter.name, "site-packages")
19321
19692
  });
19322
19693
  }
19323
19694
  }
@@ -19351,7 +19722,7 @@ async function readInstallStamp(root) {
19351
19722
  names.push(`node_modules/${marker}`);
19352
19723
  let link;
19353
19724
  try {
19354
- link = await fsp.lstat(join17(root, "node_modules"));
19725
+ link = await fsp.lstat(join18(root, "node_modules"));
19355
19726
  } catch {
19356
19727
  link = void 0;
19357
19728
  }
@@ -19367,7 +19738,7 @@ async function readInstallStamp(root) {
19367
19738
  const [statted, venvParts] = await Promise.all([
19368
19739
  Promise.all([...names, ...configNames].map(async (name) => {
19369
19740
  try {
19370
- const stat = await fsp.stat(join17(root, name));
19741
+ const stat = await fsp.stat(join18(root, name));
19371
19742
  return {
19372
19743
  part: `${name}=${fingerprint(stat)}`,
19373
19744
  changedAt: stat.mtimeMs
@@ -19422,9 +19793,9 @@ async function walkDeclarations(root) {
19422
19793
  for (const entry of entries) {
19423
19794
  if (entry.isDirectory()) {
19424
19795
  if (!isExcludedDirName(entry.name))
19425
- queue.push(join17(dir, entry.name));
19796
+ queue.push(join18(dir, entry.name));
19426
19797
  } else if (entry.isFile() && DECLARATION_FILE.test(entry.name)) {
19427
- found.push(join17(dir, entry.name));
19798
+ found.push(join18(dir, entry.name));
19428
19799
  }
19429
19800
  }
19430
19801
  if (found.length > DECLARATION_WALK_MAX_FILES)
@@ -19624,7 +19995,7 @@ async function lookOnce(root, key, trigger, runtime, options, skipWalk) {
19624
19995
  changed: count(2),
19625
19996
  deleted: count(3),
19626
19997
  // The server config files this look forwarded (#4532), by name.
19627
- configs: configChanges.map((change) => `${CHANGE_TYPE[change.type]}:${basename8(change.filePath)}`)
19998
+ configs: configChanges.map((change) => `${CHANGE_TYPE[change.type]}:${basename7(change.filePath)}`)
19628
19999
  }
19629
20000
  });
19630
20001
  }
@@ -19709,7 +20080,7 @@ function lspUnavailableMessage(filePath, health) {
19709
20080
  return void 0;
19710
20081
  }
19711
20082
  const candidates = health.candidateServerIds?.length ? ` candidates=${health.candidateServerIds.join(",")}` : "";
19712
- const reason = (health.serverCountAttempted ?? 0) === 0 ? "no LSP server configured" : "no LSP client is currently ready";
20083
+ const reason = (health.serverCountAttempted ?? 0) === 0 ? NO_SERVER_REASON : "no LSP client is currently ready";
19713
20084
  const stale = (health.mergedCount ?? 0) > 0 ? " Showing stale last-known diagnostics below." : " No diagnostics were collected.";
19714
20085
  return `LSP unavailable for ${filePath}: ${reason}; ready=${health.serverCountReady ?? 0}/${health.serverCountAttempted ?? 0}.${candidates}.${stale}`;
19715
20086
  }
@@ -19734,7 +20105,7 @@ async function collectFiles(dir, extensions, maxFiles, isIgnored = () => false)
19734
20105
  return;
19735
20106
  let entries;
19736
20107
  try {
19737
- entries = await fs21.promises.readdir(current, { withFileTypes: true });
20108
+ entries = await fs22.promises.readdir(current, { withFileTypes: true });
19738
20109
  } catch {
19739
20110
  return;
19740
20111
  }
@@ -19743,11 +20114,11 @@ async function collectFiles(dir, extensions, maxFiles, isIgnored = () => false)
19743
20114
  return;
19744
20115
  if (entry.isSymbolicLink())
19745
20116
  continue;
19746
- const full = path37.join(current, entry.name);
20117
+ const full = path39.join(current, entry.name);
19747
20118
  if (entry.isDirectory()) {
19748
20119
  if (!isExcludedDirName(entry.name) && !isIgnored(full, true))
19749
20120
  await walk(full);
19750
- } else if (entry.isFile() && extensions.includes(path37.extname(full))) {
20121
+ } else if (entry.isFile() && extensions.includes(path39.extname(full))) {
19751
20122
  if (isIgnored(full, false))
19752
20123
  continue;
19753
20124
  files.push(full);
@@ -19780,10 +20151,7 @@ function createLspDiagnosticsTool(nextWriteIndex, onConfirmedNoBlockers, getServ
19780
20151
  const concurrency = boundedPositiveInt(typedParams.concurrency, DEFAULT_BATCH_CONCURRENCY, 1, MAX_BATCH_CONCURRENCY);
19781
20152
  const waitMs = typeof typedParams.waitMs === "number" && typedParams.waitMs >= 0 ? Math.floor(typedParams.waitMs) : void 0;
19782
20153
  const serverScope = typedParams.serverScope === "primary" ? "primary" : "all";
19783
- const excludeServerIds = getFlag ? /* @__PURE__ */ new Set([
19784
- ...configDisabledAuxiliaryLspServerIds((name) => getFlag(name, cwd)),
19785
- ...enabledOptInAuxiliaryLspServerIds((name) => getFlag(name, cwd))
19786
- ]) : void 0;
20154
+ const excludeServerIds = getFlag ? auxiliaryServersNotRun((name) => getFlag(name, cwd)) : void 0;
19787
20155
  const lspService = getService();
19788
20156
  if (!lspService) {
19789
20157
  return {
@@ -19825,7 +20193,7 @@ function createLspDiagnosticsTool(nextWriteIndex, onConfirmedNoBlockers, getServ
19825
20193
  details: { mode: "batch", filesChecked: 0 }
19826
20194
  };
19827
20195
  }
19828
- const expanded = await expandPathsToFiles(cwd, rawPaths);
20196
+ const expanded = await expandPathsToFiles(cwd, rawPaths, typedParams.pathsAlreadyResolved === true);
19829
20197
  if (expanded.files.length === 0) {
19830
20198
  const { listed, text } = describeDirectoriesWithoutFiles(expanded.directoriesWithoutFiles);
19831
20199
  return {
@@ -19866,7 +20234,7 @@ function createLspDiagnosticsTool(nextWriteIndex, onConfirmedNoBlockers, getServ
19866
20234
  const absPath = normalizeMapKey(typedParams.pathAlreadyResolved === true ? rawPath : resolveHostToolPath(rawPath, cwd));
19867
20235
  let stat;
19868
20236
  try {
19869
- stat = fs21.statSync(absPath);
20237
+ stat = fs22.statSync(absPath);
19870
20238
  } catch {
19871
20239
  return {
19872
20240
  content: [
@@ -19898,7 +20266,7 @@ async function collectDiagnosticsForFile(absPath, lspService, scanRoot, waitMs,
19898
20266
  let content;
19899
20267
  let touched;
19900
20268
  try {
19901
- content = fs21.readFileSync(absPath, "utf-8");
20269
+ content = fs22.readFileSync(absPath, "utf-8");
19902
20270
  const contentLimit = explicitQuery ? exceedsExplicitQueryLimits(content) : exceedsLspSyncLimits(content);
19903
20271
  if (contentLimit.tooLarge) {
19904
20272
  const reason = `file too large for LSP diagnostics (${contentLimit.reason})`;
@@ -20174,7 +20542,7 @@ async function collectFileDiagnosticResult(file, severity, lspService, waitMs, n
20174
20542
  const scannedAt = Date.now();
20175
20543
  let stat;
20176
20544
  try {
20177
- stat = fs21.statSync(file);
20545
+ stat = fs22.statSync(file);
20178
20546
  if (!stat.isFile()) {
20179
20547
  return { file, diagnostics: [], error: `${file}: not a file` };
20180
20548
  }
@@ -20424,12 +20792,9 @@ async function runFileDiagnostics(absPath, severity, lspService, waitMs, nextWri
20424
20792
  const suppressedLine = dispositionSuppressedLine(policy.suppressed);
20425
20793
  const withheldLine = withheldCompileNote(policy.withheld);
20426
20794
  const notRunServerIds = serverScope === "all" && excludeServerIds && excludeServerIds.size > 0 ? getServersForFileWithConfig(absPath).flatMap((server) => excludeServerIds.has(server.id) ? [server.id] : []) : [];
20427
- const switchedOffServerIds = notRunServerIds.flatMap((id) => isOptInAuxiliaryServerId(id) ? [] : [id]);
20428
- const optInNotRunServerIds = notRunServerIds.flatMap((id) => isOptInAuxiliaryServerId(id) ? [id] : []);
20429
20795
  const noAuxiliaryLine = [
20430
20796
  "No auxiliary findings.",
20431
- ...switchedOffServerIds.length > 0 ? [`Switched off, not run: ${switchedOffServerIds.join(", ")}.`] : [],
20432
- ...optInNotRunServerIds.length > 0 ? [`Opt-in, not run by this check: ${optInNotRunServerIds.join(", ")}.`] : []
20797
+ ...auxiliaryNotRunSentences(notRunServerIds)
20433
20798
  ].join(" ");
20434
20799
  let text;
20435
20800
  if (total === 0) {
@@ -20718,15 +21083,15 @@ async function collectBatchDiagnostics(files, severity, lspService, options) {
20718
21083
  incompleteFiles: Math.max(0, files.length - results.length)
20719
21084
  };
20720
21085
  }
20721
- async function expandPathsToFiles(cwd, rawPaths) {
21086
+ async function expandPathsToFiles(cwd, rawPaths, pathsAlreadyResolved = false) {
20722
21087
  const explicitFiles = [];
20723
21088
  const directories = [];
20724
21089
  const seenFileKeys = /* @__PURE__ */ new Set();
20725
21090
  for (const entry of rawPaths) {
20726
- const abs = normalizeMapKey(resolveHostToolPath(entry, cwd));
21091
+ const abs = normalizeMapKey(pathsAlreadyResolved ? entry : resolveHostToolPath(entry, cwd));
20727
21092
  let stat;
20728
21093
  try {
20729
- stat = fs21.statSync(abs);
21094
+ stat = fs22.statSync(abs);
20730
21095
  } catch {
20731
21096
  }
20732
21097
  if (stat?.isDirectory()) {
@@ -20934,7 +21299,7 @@ async function runDirectoryDiagnostics(absPath, severity, lspService, options) {
20934
21299
  reason: batchOutcomeReason(result)
20935
21300
  }));
20936
21301
  const auxiliaryOnlyLine = auxiliaryOnlyFindingsLine(results);
20937
- const tooLargeLines = renderBatchOutcomeLines(outcomeDetails, (file) => path37.relative(absPath, file));
21302
+ const tooLargeLines = renderBatchOutcomeLines(outcomeDetails, (file) => path39.relative(absPath, file));
20938
21303
  const withheldDirectory = mergeWithheld(results.map((r) => r.withheldCompile));
20939
21304
  const withheldDisclosure = withheldCompileNote(withheldDirectory);
20940
21305
  let text;
@@ -20976,7 +21341,7 @@ async function runDirectoryDiagnostics(absPath, severity, lspService, options) {
20976
21341
  ];
20977
21342
  const toRelative = (d) => ({
20978
21343
  ...d,
20979
- file: path37.relative(absPath, d.file)
21344
+ file: path39.relative(absPath, d.file)
20980
21345
  });
20981
21346
  if (primaryDisplay.length > 0) {
20982
21347
  lines.push(`Primary findings (${primaryDisplay.length}):`);
@@ -21009,7 +21374,7 @@ async function runDirectoryDiagnostics(absPath, severity, lspService, options) {
21009
21374
  filesScanned: filesToProcess.length,
21010
21375
  capped: wasCapped,
21011
21376
  diagnostics: display.map((d) => ({
21012
- file: path37.relative(absPath, d.file),
21377
+ file: path39.relative(absPath, d.file),
21013
21378
  line: d.line,
21014
21379
  character: d.character,
21015
21380
  severity: d.severity,
@@ -21084,7 +21449,7 @@ async function findFullScanBindingMismatches(results) {
21084
21449
  result.boundToCurrentDisk !== true && result.contentHash !== void 0
21085
21450
  ) {
21086
21451
  try {
21087
- const content = await fs22.readFile(result.filePath, "utf-8");
21452
+ const content = await fs23.readFile(result.filePath, "utf-8");
21088
21453
  if (hashDiagnosticContent(content) !== result.contentHash) {
21089
21454
  mismatched.add(result);
21090
21455
  }
@@ -21094,7 +21459,7 @@ async function findFullScanBindingMismatches(results) {
21094
21459
  sinceYield += 1;
21095
21460
  if (sinceYield >= FULL_SCAN_BINDING_YIELD_EVERY) {
21096
21461
  sinceYield = 0;
21097
- await new Promise((resolve32) => setImmediate(resolve32));
21462
+ await new Promise((resolve34) => setImmediate(resolve34));
21098
21463
  }
21099
21464
  }
21100
21465
  return mismatched;
@@ -21144,7 +21509,7 @@ function createLensDiagnosticsTool(cacheManager2, getCwd, getLspService = getLSP
21144
21509
  const files2 = details.filesChecked ?? details.filesScanned ?? 0;
21145
21510
  const noun = count === 1 ? "diagnostic" : "diagnostics";
21146
21511
  const filePath = typeof details?.filePath === "string" ? details.filePath : Array.isArray(args?.paths) && args.paths.length === 1 && typeof args.paths[0] === "string" ? args.paths[0] : void 0;
21147
- const singleFile = (details?.mode === "file" || files2 === 1) && typeof filePath === "string" ? ` ${path38.basename(filePath)}` : "";
21512
+ const singleFile = (details?.mode === "file" || files2 === 1) && typeof filePath === "string" ? ` ${path40.basename(filePath)}` : "";
21148
21513
  const scope = files2 > 1 ? ` across ${files2} files` : singleFile;
21149
21514
  if (isError)
21150
21515
  return `lens_diagnostics lsp \u2014 ${text.split("\n")[0] ?? "error"}`;
@@ -21179,8 +21544,10 @@ function createLensDiagnosticsTool(cacheManager2, getCwd, getLspService = getLSP
21179
21544
  const aw = details?.actionableWarnings ?? 0;
21180
21545
  const cq = details?.qualityIssues ?? 0;
21181
21546
  const pd = details?.projectDiagnostics ?? 0;
21182
- if (aw + cq + pd === 0)
21183
- return `lens_diagnostics delta \u2014 clean${coldSuffix}${failedSuffix}`;
21547
+ if (aw + cq + pd === 0) {
21548
+ const uncheckedDelta = details?.uncheckedFileCount ?? 0;
21549
+ return `lens_diagnostics delta \u2014 clean${uncheckedDelta > 0 ? ` \xB7 ${uncheckedDelta} unchecked` : ""}${coldSuffix}${failedSuffix}`;
21550
+ }
21184
21551
  return `lens_diagnostics delta \u2014 ${aw} actionable \xB7 ${cq} quality \xB7 ${pd} project${coldSuffix}${failedSuffix}`;
21185
21552
  }
21186
21553
  const b = details?.totalBlocking ?? 0;
@@ -21189,15 +21556,19 @@ function createLensDiagnosticsTool(cacheManager2, getCwd, getLspService = getLSP
21189
21556
  const adv = details?.totalAdvisories ?? 0;
21190
21557
  const files = details?.filesWithIssues ?? details?.filesChecked ?? 0;
21191
21558
  const cacheVerdict = details?.validationStatus === "no-matching-findings" ? "no matching cached findings" : details?.validationStatus === "findings" ? void 0 : details?.validationStatus;
21559
+ const unchecked = details?.uncheckedFileCount ?? 0;
21560
+ const uncheckedSuffix = unchecked > 0 ? ` \xB7 ${unchecked} unchecked` : "";
21192
21561
  if (b + e + w === 0) {
21193
21562
  const advisorySuffix = adv > 0 ? `, ${adv} hint${adv === 1 ? "" : "s"}` : "";
21194
- return `lens_diagnostics ${mode} \u2014 ${cacheVerdict ?? "clean"}${advisorySuffix} (${files} files)${coldSuffix}${failedSuffix}`;
21563
+ if (cacheVerdict === void 0 && unchecked > 0 && unchecked >= (details?.filesChecked ?? files))
21564
+ return `lens_diagnostics ${mode} \u2014 unchecked${advisorySuffix} (${files} files)${coldSuffix}${failedSuffix}`;
21565
+ return `lens_diagnostics ${mode} \u2014 ${cacheVerdict ?? "clean"}${advisorySuffix}${uncheckedSuffix} (${files} files)${coldSuffix}${failedSuffix}`;
21195
21566
  }
21196
21567
  const parts = [`${b} blocking`];
21197
21568
  if (b === 0 && e > 0)
21198
21569
  parts.push(`${e} errors`);
21199
21570
  parts.push(`${w} warnings`);
21200
- return `lens_diagnostics ${mode} \u2014 ${parts.join(" \xB7 ")}${cacheVerdict === "inconclusive" || cacheVerdict === "unverified" ? ` \xB7 ${cacheVerdict}` : ""} (${files} files)${coldSuffix}${failedSuffix}`;
21571
+ return `lens_diagnostics ${mode} \u2014 ${parts.join(" \xB7 ")}${cacheVerdict === "inconclusive" || cacheVerdict === "unverified" ? ` \xB7 ${cacheVerdict}` : ""}${uncheckedSuffix} (${files} files)${coldSuffix}${failedSuffix}`;
21201
21572
  }),
21202
21573
  parameters: Type.Object({
21203
21574
  source: Type.Optional(Type.String({
@@ -21258,7 +21629,7 @@ function createLensDiagnosticsTool(cacheManager2, getCwd, getLspService = getLSP
21258
21629
  })),
21259
21630
  paths: Type.Optional(Type.Array(Type.String(), {
21260
21631
  maxItems: MAX_PATHS_ENTRIES,
21261
- description: "Files or directories to filter."
21632
+ description: `Files or directories to filter. ${PATHS_GLOB_CLAUSE}`
21262
21633
  }))
21263
21634
  }),
21264
21635
  async execute(_toolCallId, params, signal, onUpdate, ctx) {
@@ -21276,10 +21647,19 @@ function createLensDiagnosticsTool(cacheManager2, getCwd, getLspService = getLSP
21276
21647
  details: {}
21277
21648
  };
21278
21649
  }
21279
- const pathsRead = readPathsArgument(params.paths, { cwd });
21280
- if (pathsRead.refusal) {
21650
+ const pathsSignal = ctx.signal ?? signal;
21651
+ const pathsRead = await readPathsArgument(params.paths, {
21652
+ cwd,
21653
+ signal: pathsSignal
21654
+ });
21655
+ const singleRead = !pathsRead.refusal && singlePath.path ? await readPathsArgument([singlePath.path], {
21656
+ cwd,
21657
+ signal: pathsSignal
21658
+ }) : void 0;
21659
+ const pathsRefusal = pathsRead.refusal ?? singleRead?.refusal;
21660
+ if (pathsRefusal) {
21281
21661
  return {
21282
- content: [{ type: "text", text: pathsRead.refusal }],
21662
+ content: [{ type: "text", text: pathsRefusal }],
21283
21663
  isError: true,
21284
21664
  details: { mode: legacyMode ?? "delta", pathsError: true }
21285
21665
  };
@@ -21288,14 +21668,15 @@ function createLensDiagnosticsTool(cacheManager2, getCwd, getLspService = getLSP
21288
21668
  ...params,
21289
21669
  ...singlePath.path ? { path: singlePath.path } : {}
21290
21670
  };
21291
- const pathEntries = singlePath.path ? [
21292
- ...pathsRead.entries,
21293
- ...readPathsArgument([singlePath.path], { cwd }).entries
21294
- ] : pathsRead.entries;
21671
+ const pathEntries = singlePath.path ? [...pathsRead.entries, ...singleRead?.entries ?? []] : pathsRead.entries;
21295
21672
  if (source === "lsp") {
21296
21673
  const lspParams = { ...params };
21297
21674
  delete lspParams.source;
21298
21675
  delete lspParams.scope;
21676
+ if (pathsRead.entries.length > 0) {
21677
+ lspParams.paths = pathsRead.entries;
21678
+ lspParams.pathsAlreadyResolved = true;
21679
+ }
21299
21680
  const hasExplicitPath = typeof lspParams.path === "string" && lspParams.path.length > 0;
21300
21681
  const hasExplicitPaths = Array.isArray(lspParams.paths) && lspParams.paths.length > 0;
21301
21682
  if (scope === "workspace" && !hasExplicitPath && !hasExplicitPaths) {
@@ -21392,9 +21773,9 @@ function createLensDiagnosticsTool(cacheManager2, getCwd, getLspService = getLSP
21392
21773
  host: ctx.host ?? "pi",
21393
21774
  // #4944: the sweep leaves an auxiliary the operator turned off
21394
21775
  // (`--no-ast-grep`, `astGrep.enabled=false`) unstarted, as the
21395
- // `source=lsp` probe does.
21776
+ // `source=lsp` probe does; #5287: and an opt-in one they turned on.
21396
21777
  ...getFlag && {
21397
- excludeServerIds: configDisabledAuxiliaryLspServerIds((name) => getFlag(name, cwd))
21778
+ excludeServerIds: auxiliaryServersNotRun((name) => getFlag(name, cwd))
21398
21779
  }
21399
21780
  });
21400
21781
  }
@@ -21425,7 +21806,7 @@ function appendProjectDiagnosticsDeltaLines(groups, cwd, report, severity, inclu
21425
21806
  const diagnostics = [...gated.live, ...gated.stale];
21426
21807
  const byFile = /* @__PURE__ */ new Map();
21427
21808
  for (const diagnostic of diagnostics) {
21428
- const filePath = path38.resolve(diagnostic.filePath);
21809
+ const filePath = path40.resolve(diagnostic.filePath);
21429
21810
  const bucket = byFile.get(filePath) ?? [];
21430
21811
  bucket.push(diagnostic);
21431
21812
  byFile.set(filePath, bucket);
@@ -21462,24 +21843,56 @@ function readContentForAnchors(filePath, stat) {
21462
21843
  function applyCachedDispositions(cachedDiagnostics, cwd, filePath) {
21463
21844
  if (!hasAnyDispositionMarks(cwd))
21464
21845
  return cachedDiagnostics;
21465
- if (!hasStrictDispositionMarks(cwd)) {
21466
- return applyWeakDispositions(cachedDiagnostics, cwd, filePath);
21846
+ const anchorOf = (d) => d.citedFile ?? filePath;
21847
+ const strictAnchors = hasStrictDispositionMarks(cwd);
21848
+ if (!strictAnchors && !cachedDiagnostics.some((d) => d.citedFile)) {
21849
+ return applyWeakDispositionsMultiFile(cachedDiagnostics, cwd, anchorOf);
21467
21850
  }
21468
- let stat;
21469
- try {
21470
- stat = fsSync.statSync(filePath);
21471
- } catch {
21472
- return applyWeakDispositions(cachedDiagnostics, cwd, filePath);
21851
+ const groups = /* @__PURE__ */ new Map();
21852
+ for (const d of cachedDiagnostics) {
21853
+ const anchor = anchorOf(d);
21854
+ const group = groups.get(anchor);
21855
+ if (group)
21856
+ group.push(d);
21857
+ else
21858
+ groups.set(anchor, [d]);
21859
+ }
21860
+ if (groups.size <= 1) {
21861
+ const anchor = groups.keys().next().value ?? filePath;
21862
+ const group = groups.values().next().value ?? cachedDiagnostics;
21863
+ return applyCachedStrict(group, cwd, anchor, {
21864
+ cited: anchor !== filePath,
21865
+ strictAnchors
21866
+ });
21473
21867
  }
21474
- const referenceMs = cachedDiagnostics.reduce((latest, d) => Math.max(latest, d.observedAt ?? 0), 0);
21475
- if (referenceMs > 0 && freshnessFromMtime({ mtimeMs: stat.mtimeMs, referenceMs }).verdict === "stale") {
21476
- return applyWeakDispositions(cachedDiagnostics, cwd, filePath);
21868
+ const kept = /* @__PURE__ */ new Set();
21869
+ for (const [anchor, group] of groups) {
21870
+ for (const d of applyCachedStrict(group, cwd, anchor, {
21871
+ cited: anchor !== filePath,
21872
+ strictAnchors
21873
+ })) {
21874
+ kept.add(d);
21875
+ }
21477
21876
  }
21478
- const content = readContentForAnchors(filePath, stat);
21479
- if (content === void 0) {
21480
- return applyWeakDispositions(cachedDiagnostics, cwd, filePath);
21877
+ return cachedDiagnostics.filter((d) => kept.has(d));
21878
+ }
21879
+ function applyCachedStrict(group, cwd, anchor, options) {
21880
+ const decision = cachedAnchorMarks({
21881
+ cwd,
21882
+ anchor,
21883
+ rows: group,
21884
+ cited: options.cited,
21885
+ strictAnchors: options.strictAnchors,
21886
+ readContent: readContentForAnchors
21887
+ });
21888
+ switch (decision.marks) {
21889
+ case "refused":
21890
+ return group;
21891
+ case "weak-only":
21892
+ return applyWeakDispositions(group, cwd, anchor);
21893
+ case "strict":
21894
+ return applyDispositions(group, cwd, anchor, decision.content);
21481
21895
  }
21482
- return applyDispositions(cachedDiagnostics, cwd, filePath, content);
21483
21896
  }
21484
21897
  function filterDeltaReportDispositions(report, cwd, policyMap) {
21485
21898
  if (!report?.diagnostics.length)
@@ -21655,10 +22068,22 @@ function formatDeltaMode(cacheManager2, cwd, severity, pathsScope) {
21655
22068
  if (carried.length > 0) {
21656
22069
  text += ` ${carriedIssues} finding${carriedIssues === 1 ? "" : "s"} across ${carried.length} file${carried.length === 1 ? "" : "s"} carried over from earlier this session \u2014 use mode=all to see them.`;
21657
22070
  }
22071
+ const uncheckedSummaries = getFileDiagnosticSummaries().filter((f) => includeFile(f.filePath) && f.uncheckedReason !== void 0);
22072
+ const uncheckedDeltaLine = uncheckedFilesLine(uncheckedSummaries, cwd);
22073
+ if (uncheckedDeltaLine)
22074
+ text += `
22075
+ ${uncheckedDeltaLine}`;
21658
22076
  text += pathsScopeCacheOnlyNote(pathsScope);
21659
22077
  return {
21660
22078
  content: [{ type: "text", text }],
21661
- details: { mode: "delta", warnings: 0, carriedOverFiles: carried.length }
22079
+ details: {
22080
+ mode: "delta",
22081
+ warnings: 0,
22082
+ carriedOverFiles: carried.length,
22083
+ ...uncheckedSummaries.length > 0 && {
22084
+ uncheckedFileCount: uncheckedSummaries.length
22085
+ }
22086
+ }
21662
22087
  };
21663
22088
  }
21664
22089
  const summary = `
@@ -21676,7 +22101,7 @@ Summary (turn delta): ${aw} actionable warning${aw === 1 ? "" : "s"} \xB7 ${cq}
21676
22101
  function createCurrentIgnoreFilter(cwd) {
21677
22102
  try {
21678
22103
  const matcher = getProjectIgnoreMatcher(cwd);
21679
- return (filePath) => !matcher.isIgnored(path38.resolve(filePath), false);
22104
+ return (filePath) => !matcher.isIgnored(path40.resolve(filePath), false);
21680
22105
  } catch {
21681
22106
  return () => true;
21682
22107
  }
@@ -21706,9 +22131,9 @@ function resolvePathsScope(entries) {
21706
22131
  }
21707
22132
  const fileKeys = new Set(fileEntries.map((f) => normalizeFilePath(f)));
21708
22133
  const dirPrefixes = dirEntries.map((d) => normalizeFilePath(d));
21709
- const includeExplicitFile = (filePath) => fileKeys.has(normalizeFilePath(path38.resolve(filePath)));
22134
+ const includeExplicitFile = (filePath) => fileKeys.has(normalizeFilePath(path40.resolve(filePath)));
21710
22135
  const includeFile = (filePath) => {
21711
- const key = normalizeFilePath(path38.resolve(filePath));
22136
+ const key = normalizeFilePath(path40.resolve(filePath));
21712
22137
  if (fileKeys.has(key))
21713
22138
  return true;
21714
22139
  return dirPrefixes.some((prefix) => isWithinForm(key, prefix));
@@ -21729,7 +22154,7 @@ function pathsScopeCacheOnlyNote(scope) {
21729
22154
  function pathsScopeMissingNote(scope) {
21730
22155
  if (!scope || scope.missing.length === 0)
21731
22156
  return "";
21732
- const shown2 = scope.missing.slice(0, 10).map((p) => path38.basename(p));
22157
+ const shown2 = scope.missing.slice(0, 10).map((p) => path40.basename(p));
21733
22158
  const more = scope.missing.length > shown2.length ? ` (+${scope.missing.length - shown2.length} more)` : "";
21734
22159
  return `
21735
22160
 
@@ -21881,7 +22306,7 @@ function runnerRetirementDecision(diagnostic, filePath, authoritativeRunnerIds,
21881
22306
  }
21882
22307
  return "keep";
21883
22308
  }
21884
- function summarizeDiagnostics(filePath, diagnostics, hasFinalSnapshot) {
22309
+ function summarizeDiagnostics(filePath, diagnostics, hasFinalSnapshot, carried) {
21885
22310
  let blocking = 0;
21886
22311
  let errors = 0;
21887
22312
  let warnings = 0;
@@ -21906,6 +22331,12 @@ function summarizeDiagnostics(filePath, diagnostics, hasFinalSnapshot) {
21906
22331
  warnings,
21907
22332
  advisories,
21908
22333
  hasFinalSnapshot,
22334
+ ...carried?.uncheckedReason !== void 0 && {
22335
+ uncheckedReason: carried.uncheckedReason
22336
+ },
22337
+ ...carried?.uncheckedInapplicable === true && {
22338
+ uncheckedInapplicable: true
22339
+ },
21909
22340
  diagnostics
21910
22341
  };
21911
22342
  }
@@ -22011,10 +22442,10 @@ function mergeDiagnosticsWithWidgetSummaries(widgetSummaries, lspResults, projec
22011
22442
  return;
22012
22443
  seen.add(key);
22013
22444
  diagnostics.push(widgetDiagnostic);
22014
- byFile.set(fileKey, summarizeDiagnostics(existing?.filePath ?? filePath, diagnostics, existing?.hasFinalSnapshot ?? true));
22445
+ byFile.set(fileKey, summarizeDiagnostics(existing?.filePath ?? filePath, diagnostics, existing?.hasFinalSnapshot ?? true, existing));
22015
22446
  };
22016
22447
  for (const summary of widgetSummaries) {
22017
- const filePath = path38.resolve(summary.filePath);
22448
+ const filePath = path40.resolve(summary.filePath);
22018
22449
  const fileKey = normalizeMapKey(summary.filePath);
22019
22450
  if (authoritativeLspFiles?.has(fileKey))
22020
22451
  continue;
@@ -22036,14 +22467,14 @@ function mergeDiagnosticsWithWidgetSummaries(widgetSummaries, lspResults, projec
22036
22467
  // diagnostics that are no longer delivered — full mode rendered
22037
22468
  // `main.go 1W … 1 warning` with no row under it. Recompute from what
22038
22469
  // survived, and only then (an untouched file keeps its own counts).
22039
- diagnostics.length === retained.length ? { ...summary, filePath, diagnostics } : summarizeDiagnostics(filePath, diagnostics, summary.hasFinalSnapshot ?? true)
22470
+ diagnostics.length === retained.length ? { ...summary, filePath, diagnostics } : summarizeDiagnostics(filePath, diagnostics, summary.hasFinalSnapshot ?? true, summary)
22040
22471
  );
22041
22472
  for (const diagnostic of diagnostics) {
22042
22473
  seen.add(diagnosticDedupKey(fileKey, diagnostic));
22043
22474
  }
22044
22475
  }
22045
22476
  for (const result of lspResults) {
22046
- const filePath = path38.resolve(result.filePath);
22477
+ const filePath = path40.resolve(result.filePath);
22047
22478
  for (const diagnostic of result.diagnostics ?? []) {
22048
22479
  addDiagnostic(filePath, {
22049
22480
  ...lspDiagnosticToWidget(diagnostic),
@@ -22063,12 +22494,12 @@ function mergeDiagnosticsWithWidgetSummaries(widgetSummaries, lspResults, projec
22063
22494
  });
22064
22495
  }
22065
22496
  for (const diagnostic of projectSnapshot?.diagnostics ?? []) {
22066
- addDiagnostic(path38.resolve(diagnostic.filePath), projectDiagnosticToWidget(diagnostic, diagnostic.filePath));
22497
+ addDiagnostic(path40.resolve(diagnostic.filePath), projectDiagnosticToWidget(diagnostic, diagnostic.filePath));
22067
22498
  }
22068
22499
  for (const diagnostic of deltaDiagnostics) {
22069
22500
  const widget = projectDiagnosticToWidget(diagnostic, diagnostic.filePath);
22070
22501
  const observedAt = widget.observedAt ?? deltaObservedAt;
22071
- addDiagnostic(path38.resolve(diagnostic.filePath), {
22502
+ addDiagnostic(path40.resolve(diagnostic.filePath), {
22072
22503
  ...widget,
22073
22504
  ...observedAt !== void 0 && { observedAt }
22074
22505
  });
@@ -22081,13 +22512,13 @@ async function applyInlineSuppressionsToSummaries(summaries, cwd, policyMap, dis
22081
22512
  return summary;
22082
22513
  let content;
22083
22514
  try {
22084
- content = await fs22.readFile(summary.filePath, "utf8");
22515
+ content = await fs23.readFile(summary.filePath, "utf8");
22085
22516
  } catch {
22086
22517
  const policyKept2 = applyRulePolicy(summary.diagnostics, policyMap, {
22087
22518
  root: cwd,
22088
22519
  filePath: summary.filePath
22089
22520
  });
22090
- return policyKept2.length === summary.diagnostics.length ? summary : summarizeDiagnostics(summary.filePath, policyKept2, summary.hasFinalSnapshot);
22521
+ return policyKept2.length === summary.diagnostics.length ? summary : summarizeDiagnostics(summary.filePath, policyKept2, summary.hasFinalSnapshot, summary);
22091
22522
  }
22092
22523
  const { kept: policyKept, inlineKept, disposed } = applyFindingPolicy(summary.diagnostics, {
22093
22524
  cwd,
@@ -22112,7 +22543,7 @@ async function applyInlineSuppressionsToSummaries(summaries, cwd, policyMap, dis
22112
22543
  if (pythonKept.kept.length === summary.diagnostics.length) {
22113
22544
  return summary;
22114
22545
  }
22115
- return summarizeDiagnostics(summary.filePath, pythonKept.kept, summary.hasFinalSnapshot);
22546
+ return summarizeDiagnostics(summary.filePath, pythonKept.kept, summary.hasFinalSnapshot, summary);
22116
22547
  }));
22117
22548
  }
22118
22549
  function shouldUseCachedProjectDiagnostics(value) {
@@ -22310,7 +22741,7 @@ async function formatFullMode(cwd, severity, lspService, cacheManager2, options
22310
22741
  unreconciledFiles.add(fileKey);
22311
22742
  recordDegradationOnce({
22312
22743
  kind: "diagnostic-retained-unreconciled",
22313
- subject: `${path38.resolve(result2.filePath)}:lsp`,
22744
+ subject: `${path40.resolve(result2.filePath)}:lsp`,
22314
22745
  reason: "confirmed diagnostic result could not replace retained widget state"
22315
22746
  });
22316
22747
  }
@@ -22318,7 +22749,7 @@ async function formatFullMode(cwd, severity, lspService, cacheManager2, options
22318
22749
  unreconciledFiles.add(fileKey);
22319
22750
  recordDegradationOnce({
22320
22751
  kind: "diagnostic-retained-unreconciled",
22321
- subject: `${path38.resolve(result2.filePath)}:lsp`,
22752
+ subject: `${path40.resolve(result2.filePath)}:lsp`,
22322
22753
  reason: "confirmed diagnostic result failed during widget reconciliation"
22323
22754
  });
22324
22755
  }
@@ -22385,7 +22816,7 @@ async function formatFullMode(cwd, severity, lspService, cacheManager2, options
22385
22816
  const dispositionDropped = [];
22386
22817
  let summaries = await applyInlineSuppressionsToSummaries(mergeDiagnosticsWithWidgetSummaries(getFileDiagnosticSummaries().filter((summary) => includeFile(summary.filePath)), confirmedLspResults, projectSnapshot, projectDelta, authoritativeLspFiles, authoritativeRunnerIds, authoritativeRunnerCoverage), cwd, policyMap, dispositionDropped);
22387
22818
  if (unreconciledFiles.size > 0) {
22388
- summaries = summaries.map((summary) => unreconciledFiles.has(normalizeMapKey(summary.filePath)) ? summarizeDiagnostics(summary.filePath, markUnreconciledFindings(summary.diagnostics), summary.hasFinalSnapshot) : summary);
22819
+ summaries = summaries.map((summary) => unreconciledFiles.has(normalizeMapKey(summary.filePath)) ? summarizeDiagnostics(summary.filePath, markUnreconciledFindings(summary.diagnostics), summary.hasFinalSnapshot, summary) : summary);
22389
22820
  }
22390
22821
  const parsedProjectScanObservedAt = projectSnapshot?.scannedAt ? Date.parse(projectSnapshot.scannedAt) : void 0;
22391
22822
  const projectScanObservedAt = parsedProjectScanObservedAt !== void 0 && Number.isFinite(parsedProjectScanObservedAt) ? parsedProjectScanObservedAt : void 0;
@@ -22446,10 +22877,10 @@ ${withheldText}`
22446
22877
  const auxiliaryCoverageNote = uncoveredScannerIds.length > 0 ? `
22447
22878
 
22448
22879
  \u26A0 Auxiliary coverage incomplete: ${uncoveredScannerIds.join(", ")} did not answer for ${partiallyCoveredLspResults.length} file(s). Findings from answering servers are included; this is not a clean verdict for the named scanner lane(s).` : "";
22449
- const switchedOffServerIds = [...options.excludeServerIds ?? []].sort((a, b) => Number(a > b) - Number(a < b));
22450
- const switchedOffNote = switchedOffServerIds.length > 0 ? `
22880
+ const notRunSentences = auxiliaryNotRunSentences([...options.excludeServerIds ?? []].sort((a, b) => Number(a > b) - Number(a < b)), "Switched off, not run (auxiliary LSP)");
22881
+ const switchedOffNote = notRunSentences.length > 0 ? `
22451
22882
 
22452
- Switched off, not run (auxiliary LSP): ${switchedOffServerIds.join(", ")}.` : "";
22883
+ ${notRunSentences.join(" ")}` : "";
22453
22884
  const lspPrimaryVsAuxiliary = tallyLspPrimaryVsAuxiliary(confirmedLspResults);
22454
22885
  logExtension({
22455
22886
  subsystem: "lsp-diagnostics",
@@ -22622,6 +23053,15 @@ async function projectResolvedCwd(summary, cwd) {
22622
23053
  diagnostics: summary.diagnostics ?? []
22623
23054
  };
22624
23055
  }
23056
+ var MAX_UNCHECKED_NAMED = 5;
23057
+ function uncheckedFilesLine(summaries, cwd) {
23058
+ const unchecked = summaries.filter((s) => s.uncheckedReason !== void 0);
23059
+ if (unchecked.length === 0)
23060
+ return "";
23061
+ const named = unchecked.slice(0, MAX_UNCHECKED_NAMED).map((s) => `${toProjectRelativePath(s.filePath, cwd)}: ${s.uncheckedReason}`);
23062
+ const more = unchecked.length - named.length;
23063
+ return `\u26A0 ${unchecked.length} file${unchecked.length === 1 ? "" : "s"} not checked, so no findings is not a clean result: ${named.join("; ")}${more > 0 ? `; +${more} more` : ""}.`;
23064
+ }
22625
23065
  async function formatAllMode(cwd, severity, summaries = getFileDiagnosticSummaries(), detailOverrides = { mode: "all" }, staleDropped = 0, pathsScope, fullModeDisposition = { dropped: [], analyzers: 0, analyzersByLane: {} }, sessionEvidence) {
22626
23066
  const isFullMode = detailOverrides.mode === "full";
22627
23067
  const includeFile = createScopedFileFilter(cwd, pathsScope);
@@ -22647,7 +23087,7 @@ async function formatAllMode(cwd, severity, summaries = getFileDiagnosticSummari
22647
23087
  }
22648
23088
  if (policyKept.length === kept.length && kept.length === diagnostics.length)
22649
23089
  return s;
22650
- return summarizeDiagnostics(s.filePath, policyKept, s.hasFinalSnapshot);
23090
+ return summarizeDiagnostics(s.filePath, policyKept, s.hasFinalSnapshot, s);
22651
23091
  });
22652
23092
  const eofGated = dispositioned.map((s) => {
22653
23093
  const { diagnostics, demotedCount } = demotePastEofDiagnostics({
@@ -22659,7 +23099,7 @@ async function formatAllMode(cwd, severity, summaries = getFileDiagnosticSummari
22659
23099
  });
22660
23100
  if (demotedCount === 0)
22661
23101
  return s;
22662
- return summarizeDiagnostics(s.filePath, diagnostics, s.hasFinalSnapshot);
23102
+ return summarizeDiagnostics(s.filePath, diagnostics, s.hasFinalSnapshot, s);
22663
23103
  });
22664
23104
  const visibleSummaries = eofGated.filter((s) => includeFile(s.filePath));
22665
23105
  const visibleDiagnostics = visibleSummaries.flatMap((s) => s.diagnostics ?? []);
@@ -22673,6 +23113,13 @@ async function formatAllMode(cwd, severity, summaries = getFileDiagnosticSummari
22673
23113
  return s.blocking > 0 || s.errors > 0 || s.warnings > 0;
22674
23114
  return s.blocking > 0 || s.errors > 0 || s.warnings > 0 || s.advisories > 0 || (s.diagnostics ?? []).some((d) => d.stale);
22675
23115
  });
23116
+ const uncheckedLine = uncheckedFilesLine(visibleSummaries, cwd);
23117
+ const uncheckedNote = uncheckedLine ? `
23118
+ ${uncheckedLine}` : "";
23119
+ const uncheckedCount = visibleSummaries.filter((s) => s.uncheckedReason !== void 0).length;
23120
+ const coverableUnchecked = visibleSummaries.filter((s) => s.uncheckedReason !== void 0 && s.uncheckedInapplicable !== true);
23121
+ const checkedCount = visibleSummaries.length - uncheckedCount;
23122
+ const uncheckedDetails = uncheckedCount > 0 ? { uncheckedFileCount: uncheckedCount } : {};
22676
23123
  let validationStatus;
22677
23124
  let validationNote = "";
22678
23125
  let evidenceDetails = {};
@@ -22694,10 +23141,17 @@ async function formatAllMode(cwd, severity, summaries = getFileDiagnosticSummari
22694
23141
  ...sessionEvidence?.stalePaths ?? [],
22695
23142
  ...pending2.map((s) => s.filePath),
22696
23143
  ...stale.map((s) => s.filePath),
22697
- ...unverified
23144
+ ...unverified,
23145
+ ...coverableUnchecked.map((s) => s.filePath)
22698
23146
  ])
22699
23147
  ];
22700
- validationStatus = staleDropped > 0 || staleDiagnosticCount > 0 || pending2.length > 0 ? "inconclusive" : visibleSummaries.length === 0 || unverified.length > 0 ? "unverified" : withIssues.length > 0 ? "findings" : "no-matching-findings";
23148
+ validationStatus = staleDropped > 0 || staleDiagnosticCount > 0 || pending2.length > 0 ? "inconclusive" : visibleSummaries.length === 0 || unverified.length > 0 ? "unverified" : withIssues.length > 0 ? "findings" : (
23149
+ // #5287: no finding in a file a check can cover but did not is not
23150
+ // the ✓ status, nor is a session in which nothing was checked. A
23151
+ // file no check can ever cover is named by the report's line and
23152
+ // does not hold the others back (the #5285 footer policy).
23153
+ coverableUnchecked.length > 0 || checkedCount === 0 ? "unverified" : "no-matching-findings"
23154
+ );
22701
23155
  const nextTool = resolveLensToolName("lens_diagnostics", sessionEvidence?.host ?? "pi");
22702
23156
  const nextPaths = rescanPaths.slice(0, MAX_PATHS_ENTRIES);
22703
23157
  const remainingRescanPathCount = rescanPaths.length - nextPaths.length;
@@ -22717,7 +23171,7 @@ async function formatAllMode(cwd, severity, summaries = getFileDiagnosticSummari
22717
23171
  } : {}
22718
23172
  };
22719
23173
  const omittedClause = staleDropped > 0 ? `, ${staleDropped} changed file${staleDropped === 1 ? "" : "s"} omitted as stale` : "";
22720
- validationNote = validationStatus === "inconclusive" || validationStatus === "unverified" ? `Session cache ${validationStatus} \u2014 not a clean verdict: ${pending2.length} pending file(s), ${staleDiagnosticCount} stale finding(s), ${unverified.length} requested file(s) without cached evidence${omittedClause}. Not active validation.
23174
+ validationNote = validationStatus === "inconclusive" || validationStatus === "unverified" ? `Session cache ${validationStatus} \u2014 not a clean verdict: ${pending2.length} pending file(s), ${staleDiagnosticCount} stale finding(s), ${unverified.length} requested file(s) without cached evidence, ${coverableUnchecked.length} file(s) no check completed on${omittedClause}. Not active validation.
22721
23175
  Next check: ${nextTool ?? "diagnostics"} source=lsp scope=paths${nextPaths.length > 0 ? ` paths=${JSON.stringify(nextPaths)}` : " with the changed paths"}.` + (remainingRescanPathCount > 0 ? ` ${remainingRescanPathCount} more path(s) need a check; narrow or batch the remaining paths.` : "") + " LSP may not cover these files; use a file-appropriate validator for unsupported or missing files.\n" : "Session cache only; not active validation.\n";
22722
23176
  logLatency({
22723
23177
  type: "phase",
@@ -22741,8 +23195,9 @@ Next check: ${nextTool ?? "diagnostics"} source=lsp scope=paths${nextPaths.lengt
22741
23195
  ${suppressedLine}` : "";
22742
23196
  const suppressedDetails = dispositionSuppressed > 0 ? { dispositionSuppressed } : {};
22743
23197
  if (withIssues.length === 0) {
22744
- const text = (visibleSummaries.length === 0 ? "No files diagnosed yet this session.\n" : validationStatus === "inconclusive" || validationStatus === "unverified" ? "" : `No ${severity === "all" ? "" : severity + " "}issues across ${visibleSummaries.length} file${visibleSummaries.length === 1 ? "" : "s"} diagnosed this session. \u2713
22745
- `) + validationNote + staleNote + suppressedNote + pathsNote;
23198
+ const text = (visibleSummaries.length === 0 ? "No files diagnosed yet this session.\n" : validationStatus === "inconclusive" || validationStatus === "unverified" || checkedCount === 0 ? "" : `No ${severity === "all" ? "" : severity + " "}issues across ${checkedCount} file${checkedCount === 1 ? "" : "s"} diagnosed this session. \u2713
23199
+ `) + (uncheckedLine ? `${uncheckedLine}
23200
+ ` : "") + validationNote + staleNote + suppressedNote + pathsNote;
22746
23201
  return {
22747
23202
  content: [{ type: "text", text }],
22748
23203
  details: {
@@ -22750,7 +23205,8 @@ ${suppressedLine}` : "";
22750
23205
  ...evidenceDetails,
22751
23206
  filesChecked: visibleSummaries.length,
22752
23207
  staleDropped,
22753
- ...suppressedDetails
23208
+ ...suppressedDetails,
23209
+ ...uncheckedDetails
22754
23210
  }
22755
23211
  };
22756
23212
  }
@@ -22816,35 +23272,616 @@ Summary (${visibleSummaries.length} files diagnosed this session):`,
22816
23272
  content: [
22817
23273
  {
22818
23274
  type: "text",
22819
- text: validationNote + lines.join("\n") + summary + staleNote + suppressedNote
23275
+ text: validationNote + lines.join("\n") + summary + uncheckedNote + staleNote + suppressedNote
22820
23276
  }
22821
23277
  ],
22822
23278
  details: {
22823
23279
  ...detailOverrides,
22824
23280
  ...evidenceDetails,
22825
23281
  filesWithIssues: withIssues.length,
23282
+ filesChecked: visibleSummaries.length,
22826
23283
  totalBlocking,
22827
23284
  totalErrors,
22828
23285
  totalWarnings,
22829
23286
  totalAdvisories,
22830
23287
  staleDropped,
22831
- ...suppressedDetails
23288
+ ...suppressedDetails,
23289
+ ...uncheckedDetails
22832
23290
  }
22833
23291
  };
22834
23292
  }
22835
23293
 
22836
- // dist/tools/lsp-navigation.js
22837
- import * as nodeFs4 from "node:fs";
22838
- import * as path39 from "node:path";
22839
- import { fileURLToPath as fileURLToPath2, pathToFileURL as pathToFileURL2 } from "node:url";
22840
-
22841
- // dist/tools/lsp-structured-output.js
22842
- import { fileURLToPath, pathToFileURL } from "node:url";
22843
- function asRecord(value) {
22844
- return typeof value === "object" && value !== null ? value : void 0;
22845
- }
22846
- function finiteNumber(value) {
22847
- return typeof value === "number" && Number.isFinite(value) ? value : void 0;
23294
+ // dist/tools/project-report.js
23295
+ function errorMessage(err) {
23296
+ return err instanceof Error ? err.message : String(err);
23297
+ }
23298
+ function createProjectReportTool(getProjectRoot) {
23299
+ return {
23300
+ name: "project_report",
23301
+ label: "Project Report",
23302
+ description: 'Orient in a project from its review graph, with ranked hubs and entry points. Returns a line-oriented TEXT report by default; pass view:"json" for the full JSON payload. On a cold cache, project_report and symbol_search return available: false with a retry hint and start a non-blocking background build; module_report degrades to outline-only with cache freshness explicit. Example: use project_report before module_report when the target file is unknown.',
23303
+ promptSnippet: "Orient in a project before choosing a file",
23304
+ renderResult: compactRenderResult(({ details, isError }) => {
23305
+ if (isError || details?.available === false) {
23306
+ return `project_report \u2014 unavailable${details?.hint ? `: ${details.hint}` : ""}`;
23307
+ }
23308
+ const parts = [
23309
+ `${details?.hubs ?? 0} hub(s)`,
23310
+ `${details?.entryPoints ?? 0} entry point(s)`
23311
+ ];
23312
+ const view = details?.view && details.view !== "default" ? ` [${details.view}]` : "";
23313
+ return `project_report ${parts.join(" \xB7 ")}${view}`;
23314
+ }),
23315
+ parameters: Type.Object({
23316
+ limit: Type.Optional(Type.Number({
23317
+ description: "Scales every ranked section's cap (default 10) \u2014 a single knob for all sections."
23318
+ })),
23319
+ focus: Type.Optional(Type.String({
23320
+ description: "Optional task hint used only to re-rank sections toward relevant subsystems (does not expand scope or trigger scans)."
23321
+ })),
23322
+ view: Type.Optional(Type.String({
23323
+ // Plain string, no enum: "json" (or any "*-json" preset name,
23324
+ // #5372) is the JSON hatch; anything else is text.
23325
+ description: 'Payload tier. "json" (or any "*-json" preset name) returns the full JSON report; any other value (or omitting view) returns the default line-oriented TEXT rendering.'
23326
+ }))
23327
+ }),
23328
+ async execute(_toolCallId, params, _signal, _onUpdate, ctx) {
23329
+ const cwd = getProjectRoot() || ctx.cwd || ".";
23330
+ let report;
23331
+ try {
23332
+ report = await projectReport(cwd, {
23333
+ limit: params.limit,
23334
+ focus: params.focus
23335
+ });
23336
+ } catch (err) {
23337
+ return {
23338
+ ...renderToolText(`Project report failed: ${errorMessage(err)}`),
23339
+ isError: true,
23340
+ details: { available: false }
23341
+ };
23342
+ }
23343
+ if (!report.available) {
23344
+ return {
23345
+ content: [
23346
+ { type: "text", text: renderTextProjectReport(report) }
23347
+ ],
23348
+ isError: true,
23349
+ details: { available: false, hint: report.hint }
23350
+ };
23351
+ }
23352
+ const jsonView = projectReportViewIsJson(params.view);
23353
+ const text = jsonView ? JSON.stringify(report) : renderTextProjectReport(report);
23354
+ return {
23355
+ content: [{ type: "text", text }],
23356
+ isError: false,
23357
+ details: {
23358
+ available: true,
23359
+ hubs: report.hubs?.length ?? 0,
23360
+ entryPoints: report.entryPoints?.length ?? 0,
23361
+ view: jsonView ? "json" : "default",
23362
+ [JSON_CELL_DETAILS_KEY]: jsonView
23363
+ }
23364
+ };
23365
+ }
23366
+ };
23367
+ }
23368
+
23369
+ // dist/tools/effective-config.js
23370
+ function countDenied(entries) {
23371
+ return entries.filter((entry) => entry.reason === "disabled-by-config").length;
23372
+ }
23373
+ function summarize(view) {
23374
+ const documents = `${view.documents.length} config file(s)`;
23375
+ if (!view.file)
23376
+ return `effective_config \u2014 ${documents}`;
23377
+ if (isEffectiveFileViewError(view.file)) {
23378
+ return `effective_config \u2014 ${documents} \xB7 ${view.file.error}`;
23379
+ }
23380
+ const selected = view.file.servers.filter((entry) => entry.selected).length;
23381
+ const denied = countDenied(view.file.servers);
23382
+ const tools = view.file.tools.filter((entry) => entry.selected).length;
23383
+ const deniedTools = countDenied(view.file.tools);
23384
+ const deniedClause = denied > 0 ? `, ${denied} denied by config` : "";
23385
+ const deniedToolsClause = deniedTools > 0 ? `, ${deniedTools} denied by config` : "";
23386
+ return `effective_config ${view.file.path} \u2014 ${documents} \xB7 ${selected} server(s) selected${deniedClause} \xB7 ${tools} tool(s)${deniedToolsClause}`;
23387
+ }
23388
+ function createEffectiveConfigTool(getProjectRoot, getNoTools) {
23389
+ return {
23390
+ name: "effective_config",
23391
+ label: "Effective Config",
23392
+ description: "Explain resolved configuration and provenance. Response is redacted by construction: it contains no environment values, no command arguments beyond the binary, and home-relative paths; a tier-denied LSP decision cannot be lifted by a nearer config. Example: pass `path` to see why its LSP server is selected.",
23393
+ promptSnippet: "Explain resolved configuration",
23394
+ renderResult: compactRenderResult(({ details, isError }) => isError ? "effective_config \u2014 failed" : details?.summary ?? "effective_config"),
23395
+ parameters: Type.Object({
23396
+ path: Type.Optional(Type.String({
23397
+ description: "Path to explain: adds the resolved language plus the per-server and per-runner selection decisions for it. Must resolve inside `cwd` (a sibling package in the same monorepo does not count) \u2014 a file outside it is rejected with the `cwd` it was measured against; re-query with `cwd` set to that file's own workspace instead."
23398
+ }))
23399
+ }),
23400
+ async execute(_toolCallId, params, _signal, _onUpdate, ctx) {
23401
+ const cwd = getProjectRoot() || ctx.cwd || ".";
23402
+ const fileRead = readFilePath(params);
23403
+ if (fileRead.refusal) {
23404
+ return {
23405
+ content: [{ type: "text", text: fileRead.refusal }],
23406
+ isError: true,
23407
+ details: { summary: "effective_config \u2014 failed" }
23408
+ };
23409
+ }
23410
+ const view = await effectiveConfig({
23411
+ cwd,
23412
+ ...fileRead.path ? { file: fileRead.path } : {},
23413
+ redact: true,
23414
+ noTools: getNoTools?.()
23415
+ });
23416
+ const summary = summarize(view);
23417
+ return {
23418
+ content: [
23419
+ {
23420
+ type: "text",
23421
+ text: `${summary}
23422
+
23423
+ ${JSON.stringify(view)}`
23424
+ }
23425
+ ],
23426
+ // Summary-shaped, like `symbol_search`'s: the full view is already
23427
+ // in `content[0].text`, and `details` exists for the renderer.
23428
+ // Duplicating a whole provenance dump into it would double the
23429
+ // payload of every call for one line of output.
23430
+ details: {
23431
+ summary,
23432
+ documents: view.documents.length,
23433
+ provenance: view.provenance.length,
23434
+ ...view.file === void 0 ? {} : isEffectiveFileViewError(view.file) ? { fileError: view.file.error } : {
23435
+ file: view.file.path,
23436
+ selectedServers: view.file.servers.filter((entry) => entry.selected).length
23437
+ }
23438
+ }
23439
+ };
23440
+ }
23441
+ };
23442
+ }
23443
+
23444
+ // dist/tools/module-report.js
23445
+ import * as path41 from "node:path";
23446
+ function resolveFile(filePath, cwd) {
23447
+ return resolveHostToolPath(filePath, cwd || ".");
23448
+ }
23449
+ function errorMessage2(err) {
23450
+ return err instanceof Error ? err.message : String(err);
23451
+ }
23452
+ function createModuleReportTool(getProjectRoot) {
23453
+ return {
23454
+ name: "module_report",
23455
+ label: "Module Report",
23456
+ description: "Return a navigable source-module outline with symbols, references, and read handles. An outline shows shape, not bodies, and does not satisfy read-before-edit; `read_symbol` and `read_enclosing` return body text and record read coverage. On a cold cache, project_report and symbol_search return available: false with a retry hint and start a non-blocking background build; module_report degrades to outline-only with cache freshness explicit. Example: use module_report on `src/app.ts` before read_symbol.",
23457
+ promptSnippet: "Outline a source module before reading a body",
23458
+ renderResult: compactRenderResult(({ details, args, isError }) => {
23459
+ const base = baseName(args.path) || "module";
23460
+ if (isError || details?.available === false) {
23461
+ return `module_report ${base} \u2014 unavailable`;
23462
+ }
23463
+ const parts = [
23464
+ `${details?.symbols ?? 0} symbols`,
23465
+ `${details?.exports ?? 0} exports`
23466
+ ];
23467
+ if (details?.callbacks)
23468
+ parts.push(`${details.callbacks} callbacks`);
23469
+ const view = details?.view && details.view !== "summary-text" ? ` [${details.view}]` : "";
23470
+ return `module_report ${base} ${parts.join(" \xB7 ")}${view}`;
23471
+ }),
23472
+ parameters: Type.Object({
23473
+ path: Type.String({
23474
+ description: "Source file, e.g. `src/app.ts`."
23475
+ }),
23476
+ maxRefsPerSymbol: Type.Optional(Type.Number({
23477
+ description: "Cap on who-uses-this entries per symbol (default 10)."
23478
+ })),
23479
+ focus: Type.Optional(Type.String({
23480
+ description: "Optional task hint used only to rank recommendedReads (does not expand scope or trigger scans)."
23481
+ })),
23482
+ view: Type.Optional(Type.String({
23483
+ description: 'Output preset: projection \xD7 format. "summary-text" (default) = metric fields off (no usedBy/fanout/complexity fields), text. "summary-json" = same fields, JSON. "full-text" = every field, text. "full-json" = every field, JSON (byte-identical to the pre-#5137 default). Metrics render as a cx:/fan: suffix and flags as [flag]; every field appears in the text cell, `kind` prints raw so it can be reused as read_symbol\'s kind filter, and an unavailable module still renders its callbacks and recommended reads. A summary cell states the omission in its PROVENANCE footer. A maxRefsPerSymbol argument promotes the projection to full and keeps the format.'
23484
+ })),
23485
+ blastRadius: Type.Optional(Type.Boolean({
23486
+ description: "Include the cross-file blast-radius section: transitive dependents aggregated to ranked file reads. Read-only over the cached graph (omitted when cold)."
23487
+ })),
23488
+ blastRadiusDepth: Type.Optional(Type.Number({
23489
+ description: "Max hops for the blast-radius walk (default 3). Only used with blastRadius."
23490
+ })),
23491
+ callGraph: Type.Optional(Type.Boolean({
23492
+ description: "Include bounded derived callers/callees from the cached FunctionCallGraph; cold or stale cache state is explicit."
23493
+ })),
23494
+ maxCallGraphEntries: Type.Optional(Type.Number({
23495
+ description: "Per-direction cap for call-graph relations (default 20)."
23496
+ }))
23497
+ }),
23498
+ async execute(_toolCallId, params, _signal, _onUpdate, ctx) {
23499
+ const absFile = resolveFile(params.path, ctx.cwd);
23500
+ const cwd = getProjectRoot() || ctx.cwd || ".";
23501
+ let report;
23502
+ try {
23503
+ report = await moduleReport(absFile, cwd, {
23504
+ maxRefsPerSymbol: params.maxRefsPerSymbol,
23505
+ view: params.view,
23506
+ focus: params.focus,
23507
+ blastRadius: params.blastRadius,
23508
+ blastRadiusDepth: params.blastRadiusDepth,
23509
+ callGraph: params.callGraph,
23510
+ maxCallGraphEntries: params.maxCallGraphEntries
23511
+ });
23512
+ } catch (err) {
23513
+ return {
23514
+ content: [
23515
+ {
23516
+ type: "text",
23517
+ text: `Module report failed for ${path41.basename(absFile)}: ${errorMessage2(err)}`
23518
+ }
23519
+ ],
23520
+ isError: true,
23521
+ details: { available: false }
23522
+ };
23523
+ }
23524
+ const choice = resolveModuleReportPreset(params.view, params.maxRefsPerSymbol);
23525
+ const text = renderModuleReportPreset(report, choice);
23526
+ return {
23527
+ content: [{ type: "text", text }],
23528
+ isError: !report.available,
23529
+ details: {
23530
+ available: report.available,
23531
+ staleness: report.staleness,
23532
+ symbols: report.summary.symbols,
23533
+ exports: report.summary.exports,
23534
+ callbacks: report.callbacks.length,
23535
+ callbackSupport: report.callbackSupport,
23536
+ view: choice.preset,
23537
+ [JSON_CELL_DETAILS_KEY]: choice.format === "json"
23538
+ }
23539
+ };
23540
+ }
23541
+ };
23542
+ }
23543
+ function recordReadCoverage(recordSymbolRead, result, phase, toolCallId, ctx) {
23544
+ if (!result.name || !result.kind || typeof result.startLine !== "number" || typeof result.endLine !== "number") {
23545
+ return false;
23546
+ }
23547
+ try {
23548
+ recordSymbolRead(result.path, {
23549
+ name: result.name,
23550
+ kind: result.kind,
23551
+ startLine: result.startLine,
23552
+ endLine: result.endLine
23553
+ }, toolCallId, ctx);
23554
+ return true;
23555
+ } catch (err) {
23556
+ logLatency({
23557
+ type: "phase",
23558
+ phase,
23559
+ filePath: result.path,
23560
+ durationMs: 0,
23561
+ metadata: { error: errorMessage2(err) }
23562
+ });
23563
+ return false;
23564
+ }
23565
+ }
23566
+ function createReadSymbolTool(getProjectRoot, recordSymbolRead) {
23567
+ return {
23568
+ name: "read_symbol",
23569
+ label: "Read Symbol",
23570
+ description: "Return one symbol's verbatim source. An outline shows shape, not bodies, and does not satisfy read-before-edit; `read_symbol` and `read_enclosing` return body text and record read coverage. Example: use read_symbol after module_report identifies `parseConfig`.",
23571
+ promptSnippet: "Read one symbol's body instead of the whole file",
23572
+ renderResult: compactRenderResult(({ details, args, isError, lineCount: lineCount3 }) => {
23573
+ const base = baseName(args.path);
23574
+ if (isError || details?.found === false) {
23575
+ const sym = typeof args.symbol === "string" ? args.symbol : "?";
23576
+ return `read_symbol "${sym}" ${base} \u2014 not found`;
23577
+ }
23578
+ const range = details?.startLine && details?.endLine ? `:${details.startLine}-${details.endLine} (${details.endLine - details.startLine + 1} lines)` : ` (${lineCount3} lines)`;
23579
+ return `read_symbol ${details?.kind ?? ""} ${details?.name ?? ""} ${base}${range}`.replace(/\s+/g, " ");
23580
+ }),
23581
+ parameters: Type.Object({
23582
+ path: Type.String({
23583
+ description: "Absolute or workspace-relative path to the source file."
23584
+ }),
23585
+ symbol: Type.String({
23586
+ description: "Exact symbol name or callback handle to read (e.g. a function, class, type, or module_report callbacks[].name). Accepts a dotted `Class.method` name to resolve a member."
23587
+ }),
23588
+ kind: Type.Optional(Type.String({
23589
+ description: "Optional kind filter (e.g. function, interface, class) to disambiguate when multiple same-file symbols share the requested name. Omitting it returns the first match, same as today."
23590
+ }))
23591
+ }),
23592
+ async execute(toolCallId, params, _signal, _onUpdate, ctx) {
23593
+ const absFile = resolveFile(params.path, ctx.cwd);
23594
+ const cwd = getProjectRoot() || ctx.cwd || ".";
23595
+ let result;
23596
+ try {
23597
+ result = await readSymbol(absFile, params.symbol, cwd, {
23598
+ kind: params.kind
23599
+ });
23600
+ } catch (err) {
23601
+ return {
23602
+ content: [
23603
+ {
23604
+ type: "text",
23605
+ text: `Read symbol failed for ${path41.basename(absFile)}: ${errorMessage2(err)}`
23606
+ }
23607
+ ],
23608
+ isError: true,
23609
+ details: { found: false }
23610
+ };
23611
+ }
23612
+ if (!result.found) {
23613
+ const warningSuffix = result.warnings?.length ? ` Warnings: ${result.warnings.join("; ")}` : "";
23614
+ const suggestionSuffix = result.suggestions?.length ? ` Did you mean: ${result.suggestions.join(", ")}?` : " Use module_report to list available symbols.";
23615
+ const text = result.error ? `Could not inspect ${path41.basename(absFile)}: ${result.error}${warningSuffix}` : `Symbol "${params.symbol}" not found in ${path41.basename(absFile)}.${suggestionSuffix}${warningSuffix}`;
23616
+ return {
23617
+ content: [{ type: "text", text }],
23618
+ isError: true,
23619
+ details: {
23620
+ found: false,
23621
+ ...result.error ? { error: result.error } : {},
23622
+ ...result.warnings ? { warnings: result.warnings } : {},
23623
+ ...result.suggestions ? { suggestions: result.suggestions } : {}
23624
+ }
23625
+ };
23626
+ }
23627
+ const readRecorded = recordReadCoverage(recordSymbolRead, result, "read_symbol_guard_error", toolCallId, ctx);
23628
+ const ambiguityNote = result.ambiguous ? ` (${result.ambiguous.count} matches \u2014 returned the ${result.kind}; pass \`kind\` to disambiguate: ${result.ambiguous.kinds.join(", ")})` : "";
23629
+ const header = `${result.kind} ${result.name}${ambiguityNote} ${path41.basename(result.path)}:${result.startLine}-${result.endLine}`;
23630
+ const guardWarning = readRecorded ? "" : "\n\nWarning: read coverage recording failed; the returned body may not satisfy the edit guard.";
23631
+ return {
23632
+ content: [
23633
+ {
23634
+ type: "text",
23635
+ text: `${header}${guardWarning}
23636
+
23637
+ ${result.source ?? ""}`
23638
+ }
23639
+ ],
23640
+ details: {
23641
+ found: true,
23642
+ name: result.name,
23643
+ kind: result.kind,
23644
+ startLine: result.startLine,
23645
+ endLine: result.endLine,
23646
+ readRecorded,
23647
+ ...result.ambiguous ? { ambiguous: result.ambiguous } : {}
23648
+ }
23649
+ };
23650
+ }
23651
+ };
23652
+ }
23653
+ function createReadEnclosingTool(getProjectRoot, recordSymbolRead) {
23654
+ return {
23655
+ name: "read_enclosing",
23656
+ label: "Read Enclosing",
23657
+ description: "Return the smallest symbol or callback enclosing a line. An outline shows shape, not bodies, and does not satisfy read-before-edit; `read_symbol` and `read_enclosing` return body text and record read coverage. Example: use read_enclosing after a diagnostic points to line 42.",
23658
+ promptSnippet: "Read the enclosing symbol or callback body for a line",
23659
+ renderResult: compactRenderResult(({ details, args, isError }) => {
23660
+ const base = baseName(args.path);
23661
+ if (isError || details?.found === false) {
23662
+ const ln = typeof args.line === "number" ? args.line : "?";
23663
+ return `read_enclosing ${base}:${ln} \u2014 no enclosing symbol`;
23664
+ }
23665
+ const range = details?.startLine && details?.endLine ? `:${details.startLine}-${details.endLine}` : "";
23666
+ return `read_enclosing ${details?.kind ?? ""} ${details?.name ?? ""} ${base}${range}`.replace(/\s+/g, " ");
23667
+ }),
23668
+ parameters: Type.Object({
23669
+ path: Type.String({
23670
+ description: "Absolute or workspace-relative path to the source file."
23671
+ }),
23672
+ line: Type.Number({
23673
+ description: "1-based line number inside the desired symbol/callback."
23674
+ }),
23675
+ kinds: Type.Optional(Type.Array(Type.String(), {
23676
+ description: "Optional kind filter, e.g. function, method, callback, class, object_property_callback."
23677
+ })),
23678
+ maxLines: Type.Optional(Type.Number({
23679
+ description: "Optional maximum body size to return. Oversized matches obey onOversize."
23680
+ })),
23681
+ onOversize: Type.Optional(Type.String({
23682
+ enum: ["error", "slice", "outline"],
23683
+ description: "Behavior when the enclosing body exceeds maxLines. error (default) returns metadata only; slice returns a bounded partial read around line; outline returns nested symbols/callbacks with read handles."
23684
+ })),
23685
+ aroundLine: Type.Optional(Type.Number({
23686
+ description: "Maximum lines for onOversize=slice; defaults to maxLines, then 80."
23687
+ }))
23688
+ }),
23689
+ async execute(toolCallId, params, _signal, _onUpdate, ctx) {
23690
+ const absFile = resolveFile(params.path, ctx.cwd);
23691
+ const cwd = getProjectRoot() || ctx.cwd || ".";
23692
+ let result;
23693
+ try {
23694
+ result = await readEnclosing(absFile, params.line, cwd, {
23695
+ kinds: params.kinds,
23696
+ maxLines: params.maxLines,
23697
+ onOversize: params.onOversize,
23698
+ aroundLine: params.aroundLine
23699
+ });
23700
+ } catch (err) {
23701
+ return {
23702
+ content: [
23703
+ {
23704
+ type: "text",
23705
+ text: `Read enclosing failed for ${path41.basename(absFile)}:${params.line}: ${errorMessage2(err)}`
23706
+ }
23707
+ ],
23708
+ isError: true,
23709
+ details: { found: false }
23710
+ };
23711
+ }
23712
+ if (!result.found) {
23713
+ const warningSuffix = result.warnings?.length ? ` Warnings: ${result.warnings.join("; ")}` : "";
23714
+ const outlineSuffix = result.outline?.length ? `
23715
+
23716
+ Nested outline:
23717
+ ${JSON.stringify(result.outline)}` : "";
23718
+ const text = result.error ? `Could not read enclosing range in ${path41.basename(absFile)}:${result.line}: ${result.error}${warningSuffix}${outlineSuffix}` : `No enclosing symbol/callback found in ${path41.basename(absFile)}:${result.line}.${warningSuffix}`;
23719
+ return {
23720
+ content: [{ type: "text", text }],
23721
+ isError: true,
23722
+ details: {
23723
+ found: false,
23724
+ line: result.line,
23725
+ ...result.name ? { name: result.name } : {},
23726
+ ...result.kind ? { kind: result.kind } : {},
23727
+ ...result.startLine ? { startLine: result.startLine } : {},
23728
+ ...result.endLine ? { endLine: result.endLine } : {},
23729
+ ...result.enclosingStartLine ? { enclosingStartLine: result.enclosingStartLine } : {},
23730
+ ...result.enclosingEndLine ? { enclosingEndLine: result.enclosingEndLine } : {},
23731
+ ...result.selection ? { selection: result.selection } : {},
23732
+ ...result.outline ? { outline: result.outline } : {},
23733
+ ...result.error ? { error: result.error } : {},
23734
+ ...result.warnings ? { warnings: result.warnings } : {}
23735
+ }
23736
+ };
23737
+ }
23738
+ const readRecorded = recordReadCoverage(recordSymbolRead, result, "read_enclosing_guard_error", toolCallId, ctx);
23739
+ const range = result.partial ? `${result.startLine}-${result.endLine} (partial of ${result.enclosingStartLine}-${result.enclosingEndLine})` : `${result.startLine}-${result.endLine}`;
23740
+ const header = `${result.kind} ${result.name} ${path41.basename(result.path)}:${range}`;
23741
+ const guardWarning = readRecorded ? "" : "\n\nWarning: read coverage recording failed; the returned body may not satisfy the edit guard.";
23742
+ return {
23743
+ content: [
23744
+ {
23745
+ type: "text",
23746
+ text: `${header}${guardWarning}
23747
+
23748
+ ${result.source ?? ""}`
23749
+ }
23750
+ ],
23751
+ details: {
23752
+ found: true,
23753
+ name: result.name,
23754
+ kind: result.kind,
23755
+ line: result.line,
23756
+ startLine: result.startLine,
23757
+ endLine: result.endLine,
23758
+ enclosingStartLine: result.enclosingStartLine,
23759
+ enclosingEndLine: result.enclosingEndLine,
23760
+ parentChain: result.parentChain,
23761
+ partial: result.partial,
23762
+ selection: result.selection,
23763
+ readRecorded,
23764
+ ...result.warnings ? { warnings: result.warnings } : {}
23765
+ }
23766
+ };
23767
+ }
23768
+ };
23769
+ }
23770
+
23771
+ // dist/tools/symbol-search.js
23772
+ function createSymbolSearchTool(getProjectRoot) {
23773
+ return {
23774
+ name: "symbol_search",
23775
+ label: "Symbol Search",
23776
+ description: "Find relevant files by ranked identifier search. On a cold cache, project_report and symbol_search return available: false with a retry hint and start a non-blocking background build; module_report degrades to outline-only with cache freshness explicit. Example: search `authenticate user` before module_report. Read a listed line with offset=<line>, limit=1. An `ext:` filter matches a path suffix, so `ext:test.ts` matches `foo.test.ts`.",
23777
+ promptSnippet: "Find files by identifier",
23778
+ renderResult: compactRenderResult(({ details, isError }) => {
23779
+ if (isError || details?.available === false) {
23780
+ return `symbol_search "${details?.query ?? ""}" \u2014 unavailable${details?.hint ? `: ${details.hint}` : ""}`;
23781
+ }
23782
+ return `symbol_search "${details?.query ?? ""}" ${details?.count ?? 0} file(s)`;
23783
+ }),
23784
+ parameters: Type.Object({
23785
+ query: Type.String({
23786
+ description: "Identifier-ish query, e.g. 'authenticate user'. Scope hits before ranking with composable prefix filters: lang:<kind|id> (e.g. lang:jsts, lang:typescript), file:<substr> (path substring), ext:<ext> (e.g. ext:ts or ext:.ts), each optionally negated with a leading '-' (-file:test). An unknown key: prefix is a literal search term, not an error; an unknown lang value refuses with the supported list. A scope with no terms lists the scoped files."
23787
+ }),
23788
+ limit: Type.Optional(Type.Number({
23789
+ description: "Max files to return (default 20)."
23790
+ })),
23791
+ paths: Type.Optional(Type.Array(Type.String(), {
23792
+ description: `Files, directories or globs scoping hits to matching files (a bare directory entry scopes its whole subtree). ${PATHS_GLOB_CLAUSE} Filters before ranking, so scores within the scoped set are unaffected.`
23793
+ })),
23794
+ lang: Type.Optional(Type.String({
23795
+ description: "Restrict hits to one language, using the same identifiers as ast_grep_search's `lang` param (e.g. 'typescript', 'python', 'go')."
23796
+ }))
23797
+ }),
23798
+ async execute(_toolCallId, params, _signal, _onUpdate, ctx) {
23799
+ const cwd = getProjectRoot() || ctx.cwd || ".";
23800
+ const pathsRead = await readPathsArgument(params.paths, {
23801
+ cwd,
23802
+ filterOnly: true,
23803
+ signal: _signal
23804
+ });
23805
+ if (pathsRead.refusal) {
23806
+ return {
23807
+ content: [{ type: "text", text: pathsRead.refusal }],
23808
+ isError: true,
23809
+ details: { available: true, query: params.query }
23810
+ };
23811
+ }
23812
+ let result;
23813
+ try {
23814
+ result = await symbolSearch(params.query, cwd, params.limit, {
23815
+ ...pathsRead.entries.length > 0 ? { paths: pathsRead.entries } : {},
23816
+ lang: params.lang
23817
+ });
23818
+ } catch (err) {
23819
+ const message = err instanceof Error ? err.message : String(err);
23820
+ return {
23821
+ content: [
23822
+ {
23823
+ type: "text",
23824
+ text: `Symbol search failed for "${params.query}": ${message}`
23825
+ }
23826
+ ],
23827
+ isError: true,
23828
+ details: { available: false, query: params.query }
23829
+ };
23830
+ }
23831
+ if (result.refusal) {
23832
+ return {
23833
+ content: [{ type: "text", text: result.refusal }],
23834
+ isError: true,
23835
+ details: { available: true, query: result.query }
23836
+ };
23837
+ }
23838
+ if (!result.available) {
23839
+ return {
23840
+ content: [
23841
+ {
23842
+ type: "text",
23843
+ text: result.hint ?? "No word index for this workspace yet \u2014 retry shortly."
23844
+ }
23845
+ ],
23846
+ isError: true,
23847
+ details: {
23848
+ available: false,
23849
+ query: result.query,
23850
+ hint: result.hint,
23851
+ unavailableReason: result.unavailableReason
23852
+ }
23853
+ };
23854
+ }
23855
+ return {
23856
+ content: [
23857
+ {
23858
+ type: "text",
23859
+ text: renderCompactSymbolSearch(result, { cwd })
23860
+ }
23861
+ ],
23862
+ details: {
23863
+ available: true,
23864
+ query: result.query,
23865
+ count: result.results.length,
23866
+ coverage: result.coverage
23867
+ }
23868
+ };
23869
+ }
23870
+ };
23871
+ }
23872
+
23873
+ // dist/tools/lsp-navigation.js
23874
+ import * as nodeFs4 from "node:fs";
23875
+ import * as path42 from "node:path";
23876
+ import { fileURLToPath as fileURLToPath2, pathToFileURL as pathToFileURL2 } from "node:url";
23877
+
23878
+ // dist/tools/lsp-structured-output.js
23879
+ import { fileURLToPath, pathToFileURL } from "node:url";
23880
+ function asRecord(value) {
23881
+ return typeof value === "object" && value !== null ? value : void 0;
23882
+ }
23883
+ function finiteNumber(value) {
23884
+ return typeof value === "number" && Number.isFinite(value) ? value : void 0;
22848
23885
  }
22849
23886
  function lspStatusFromFailureKind(failureKind) {
22850
23887
  if (failureKind === "success" || failureKind === "fallback_success" || failureKind === "fallback_after_timeout") {
@@ -23658,7 +24695,7 @@ function noServerAnsweredText(filePath) {
23658
24695
  const { disabledServerIds, fallbackServerIds } = disabledPrimaries(filePath);
23659
24696
  const cause = primaryUnavailableCause([...fallbackServerIds, ...disabledServerIds], disabledServerIds, fallbackServerIds);
23660
24697
  const who = disabledServerIds.length > 0 ? `Primary LSP (${disabledServerIds.join(", ")}) did not answer` : "no language server answered";
23661
- return `No LSP server available for ${path39.basename(filePath)}: ${who} (${PRIMARY_UNAVAILABLE_CAUSE[cause]}).`;
24698
+ return `No LSP server available for ${path42.basename(filePath)}: ${who} (${PRIMARY_UNAVAILABLE_CAUSE[cause]}).`;
23662
24699
  }
23663
24700
  function emptyReasonForOperation(operation) {
23664
24701
  if (operation === "signatureHelp")
@@ -24007,7 +25044,7 @@ function collectSearchReadsForOperation(operation, result, callHierarchyItem) {
24007
25044
  }
24008
25045
  function formatCapabilities(snapshots, filePath) {
24009
25046
  if (snapshots.length === 0) {
24010
- return filePath ? `No active LSP server for ${path39.basename(filePath)}. Open/touch the file first or run another LSP operation to start the server.` : "No active LSP servers in this session.";
25047
+ return filePath ? `No active LSP server for ${path42.basename(filePath)}. Open/touch the file first or run another LSP operation to start the server.` : "No active LSP servers in this session.";
24011
25048
  }
24012
25049
  const rows = [
24013
25050
  ["definition", (s) => !!s.operationSupport.definition],
@@ -24037,7 +25074,7 @@ function formatCapabilities(snapshots, filePath) {
24037
25074
  ];
24038
25075
  const lines = [];
24039
25076
  for (const snapshot of snapshots) {
24040
- const label = filePath ? `${snapshot.serverId} (${path39.basename(filePath)})` : `${snapshot.serverId} (${snapshot.root})`;
25077
+ const label = filePath ? `${snapshot.serverId} (${path42.basename(filePath)})` : `${snapshot.serverId} (${snapshot.root})`;
24041
25078
  lines.push(label);
24042
25079
  for (const [name, supported, note] of rows) {
24043
25080
  const suffix = note ? ` (${note})` : "";
@@ -24102,6 +25139,7 @@ function createLspNavigationTool(getFlag, mutationDeps) {
24102
25139
  }
24103
25140
  return `lsp_navigation ${op} \u2014 ${n} result${n === 1 ? "" : "s"}`;
24104
25141
  }),
25142
+ constrainedSampling: CONSTRAINED_JSON_SCHEMA_SAMPLING,
24105
25143
  parameters: Type.Object({
24106
25144
  operation: Type.String({
24107
25145
  enum: [...VALID_OPERATIONS],
@@ -24405,7 +25443,7 @@ function createLspNavigationTool(getFlag, mutationDeps) {
24405
25443
  content: [
24406
25444
  {
24407
25445
  type: "text",
24408
- text: `No LSP server available for ${path39.basename(filePath)}. Check that the language server is installed.`
25446
+ text: `No LSP server available for ${path42.basename(filePath)}: ${NO_SERVER_REASON}.`
24409
25447
  }
24410
25448
  ],
24411
25449
  isError: true
@@ -24570,7 +25608,7 @@ Note: ${snapshotWithheldLine}` : ""}`
24570
25608
  content: [
24571
25609
  {
24572
25610
  type: "text",
24573
- text: disabledPrimaries(filePath).disabledServerIds.length > 0 ? noServerAnsweredText(filePath) : `No LSP server available for ${path39.basename(filePath)}. Check that the language server is installed.`
25611
+ text: disabledPrimaries(filePath).disabledServerIds.length > 0 ? noServerAnsweredText(filePath) : `No LSP server available for ${path42.basename(filePath)}: ${NO_SERVER_REASON}.`
24574
25612
  }
24575
25613
  ],
24576
25614
  isError: true
@@ -24590,7 +25628,7 @@ Note: ${snapshotWithheldLine}` : ""}`
24590
25628
  content: [
24591
25629
  {
24592
25630
  type: "text",
24593
- text: `LSP server for ${path39.basename(filePath)} does not advertise support for ${operation}`
25631
+ text: `LSP server for ${path42.basename(filePath)} does not advertise support for ${operation}`
24594
25632
  }
24595
25633
  ],
24596
25634
  isError: true,
@@ -24644,7 +25682,7 @@ Note: ${snapshotWithheldLine}` : ""}`
24644
25682
  const msg = err instanceof Error ? err.message : String(err);
24645
25683
  if (rawPath && /No Project/i.test(msg)) {
24646
25684
  await openFileBestEffort(lspService, filePath);
24647
- await new Promise((resolve32) => setTimeout(resolve32, 120));
25685
+ await new Promise((resolve34) => setTimeout(resolve34, 120));
24648
25686
  const retryRaw = await lspService.workspaceSymbol(query ?? "", filePath);
24649
25687
  const retrySymbols = (Array.isArray(retryRaw) ? retryRaw : [retryRaw]).filter((s) => typeof s === "object" && s !== null);
24650
25688
  return dedupeWorkspaceSymbols(retrySymbols);
@@ -24899,7 +25937,7 @@ Note: ${snapshotWithheldLine}` : ""}`
24899
25937
  isError: true
24900
25938
  }, { operation, filePath, failureKind: "no_server", resultCount: 0 });
24901
25939
  }
24902
- const fileCtx = filePath ? " at " + path39.basename(filePath) : "";
25940
+ const fileCtx = filePath ? " at " + path42.basename(filePath) : "";
24903
25941
  const lineCtx = line ? ":" + line + ":" + character : "";
24904
25942
  let output = isEmpty ? "No results for " + operation + fileCtx + lineCtx : JSON.stringify(result);
24905
25943
  if (isEmpty && operation === "workspaceSymbol" && !rawPath) {
@@ -24944,9 +25982,6 @@ Note: ${snapshotWithheldLine}` : ""}`
24944
25982
  };
24945
25983
  }
24946
25984
 
24947
- // dist/tools/symbol-search.js
24948
- var SYMBOL_SEARCH_DESCRIPTION = "Find relevant files by ranked identifier search. On a cold cache, project_report and symbol_search return available: false with a retry hint and start a non-blocking background build; module_report degrades to outline-only with cache freshness explicit. Example: search `authenticate user` before module_report. Read a listed line with offset=<line>, limit=1. An `ext:` filter matches a path suffix, so `ext:test.ts` matches `foo.test.ts`.";
24949
-
24950
25985
  // dist/mcp/tool-arguments.js
24951
25986
  var MAX_REPORTED_KEYS = 8;
24952
25987
  var MAX_REPORTED_KEY_CHARS = 64;
@@ -25092,10 +26127,10 @@ Not run: ${reasons.join("; ")}.`
25092
26127
  }
25093
26128
 
25094
26129
  // dist/mcp/build-staleness.js
25095
- import * as fs23 from "node:fs";
26130
+ import * as fs24 from "node:fs";
25096
26131
  var realStat = (targetPath) => {
25097
26132
  try {
25098
- return fs23.statSync(targetPath);
26133
+ return fs24.statSync(targetPath);
25099
26134
  } catch {
25100
26135
  return void 0;
25101
26136
  }
@@ -25164,6 +26199,30 @@ var WARN_ONLY_STALE_TOOLS = /* @__PURE__ */ new Set([
25164
26199
  "pilens_effective_config"
25165
26200
  ]);
25166
26201
 
26202
+ // dist/mcp/input-schema.js
26203
+ function schemaWithCwd(parameters) {
26204
+ const p = parameters;
26205
+ const properties = {};
26206
+ for (const [key, value] of Object.entries(p.properties ?? {})) {
26207
+ const property = value;
26208
+ properties[key] = typeof property.description === "string" ? {
26209
+ ...property,
26210
+ description: translateGuidanceToolNames(property.description, "mcp")
26211
+ } : value;
26212
+ }
26213
+ return {
26214
+ type: "object",
26215
+ properties: {
26216
+ ...properties,
26217
+ cwd: {
26218
+ type: "string",
26219
+ description: "Project root (defaults to the server workspace)."
26220
+ }
26221
+ },
26222
+ ...p.required ? { required: p.required } : {}
26223
+ };
26224
+ }
26225
+
25167
26226
  // dist/mcp/server.js
25168
26227
  console.log = (...args) => {
25169
26228
  console.error(...args);
@@ -25175,11 +26234,11 @@ function resolveDefaultCwd() {
25175
26234
  const fromArg = process.argv.find((arg) => arg.startsWith("--cwd="))?.slice("--cwd=".length);
25176
26235
  return fromArg ?? process.env.PI_LENS_MCP_CWD ?? process.cwd();
25177
26236
  }
25178
- var DEFAULT_CWD = path40.resolve(resolveDefaultCwd());
26237
+ var DEFAULT_CWD = path43.resolve(resolveDefaultCwd());
25179
26238
  var lspReadyCwds = /* @__PURE__ */ new Set();
25180
26239
  var SERVER_FILE = fileURLToPath3(import.meta.url);
25181
- var SERVER_DIR = path40.dirname(SERVER_FILE);
25182
- var WORKER_PATH = path40.join(SERVER_DIR, "worker.js");
26240
+ var SERVER_DIR = path43.dirname(SERVER_FILE);
26241
+ var WORKER_PATH = path43.join(SERVER_DIR, "worker.js");
25183
26242
  var REBUILD_SCRIPT = resolveRebuildScript(SERVER_FILE);
25184
26243
  var STALENESS_STAT_PATH = process.env.PI_LENS_MCP_STALENESS_STAT_PATH ?? SERVER_FILE;
25185
26244
  var BUILD_STAMP = computeBuildStamp(STALENESS_STAT_PATH);
@@ -25200,21 +26259,21 @@ function isWarmBuildStale() {
25200
26259
  }
25201
26260
  function findRepoRoot(start) {
25202
26261
  for (const dir of walkUpDirs(start, { maxDepth: 6 })) {
25203
- const pkgPath = path40.join(dir, "package.json");
25204
- if (fs24.existsSync(pkgPath)) {
26262
+ const pkgPath = path43.join(dir, "package.json");
26263
+ if (fs25.existsSync(pkgPath)) {
25205
26264
  try {
25206
- const pkg = JSON.parse(fs24.readFileSync(pkgPath, "utf8"));
26265
+ const pkg = JSON.parse(fs25.readFileSync(pkgPath, "utf8"));
25207
26266
  if (pkg.name === "pi-lens")
25208
26267
  return dir;
25209
26268
  } catch {
25210
26269
  }
25211
26270
  }
25212
26271
  }
25213
- return path40.resolve(start, "..", "..");
26272
+ return path43.resolve(start, "..", "..");
25214
26273
  }
25215
- var REPO_ROOT = process.env.PI_LENS_MCP_REPO_ROOT ? path40.resolve(process.env.PI_LENS_MCP_REPO_ROOT) : findRepoRoot(SERVER_DIR);
26274
+ var REPO_ROOT = process.env.PI_LENS_MCP_REPO_ROOT ? path43.resolve(process.env.PI_LENS_MCP_REPO_ROOT) : findRepoRoot(SERVER_DIR);
25216
26275
  async function ensureReady(cwd) {
25217
- const normalized = path40.resolve(cwd);
26276
+ const normalized = path43.resolve(cwd);
25218
26277
  if (!shouldInitializeSessionRoot(normalized, lspReadyCwds)) {
25219
26278
  return;
25220
26279
  }
@@ -25260,12 +26319,12 @@ function getAutoSessionStatus() {
25260
26319
  }
25261
26320
  var IPC_PATH = ipcPathForCwd(DEFAULT_CWD);
25262
26321
  function rejectForeignTurnCwd(route, cwd) {
25263
- const message = `${route} cwd outside this server's workspace: ${path40.resolve(cwd)} not within ${DEFAULT_CWD}`;
26322
+ const message = `${route} cwd outside this server's workspace: ${path43.resolve(cwd)} not within ${DEFAULT_CWD}`;
25264
26323
  console.error(`[pi-lens-mcp] rejected ${message}`);
25265
26324
  return message;
25266
26325
  }
25267
26326
  function isWithinServerWorkspace(cwd) {
25268
- return isUnderDir(path40.resolve(cwd), DEFAULT_CWD);
26327
+ return isUnderDir(path43.resolve(cwd), DEFAULT_CWD);
25269
26328
  }
25270
26329
  function startIpcServer() {
25271
26330
  unlinkStaleUnixSocket(IPC_PATH);
@@ -25438,22 +26497,21 @@ var lensDiagnosticsTool = createLensDiagnosticsTool(
25438
26497
  );
25439
26498
  var astGrepClient = new AstGrepClient();
25440
26499
  var astGrepSearchTool = createAstGrepSearchTool(astGrepClient);
25441
- var astGrepReplaceTool = createAstGrepReplaceTool(astGrepClient);
26500
+ var astGrepReplaceTool = createAstGrepReplaceTool(
26501
+ astGrepClient,
26502
+ void 0,
26503
+ // #5417: resolved against the call's own project, like `lspNavigationTool`.
26504
+ (name, cwd) => createMcpHost(void 0, cwd ?? DEFAULT_CWD).getFlag(name)
26505
+ );
25442
26506
  var lspNavigationTool = createLspNavigationTool((name, cwd) => createMcpHost(void 0, cwd ?? DEFAULT_CWD).getFlag(name));
25443
- function schemaWithCwd(parameters) {
25444
- const p = parameters;
25445
- return {
25446
- type: "object",
25447
- properties: {
25448
- ...p.properties,
25449
- cwd: {
25450
- type: "string",
25451
- description: "Project root (defaults to the server workspace)."
25452
- }
25453
- },
25454
- ...p.required ? { required: p.required } : {}
25455
- };
25456
- }
26507
+ var symbolSearchTool = createSymbolSearchTool(() => DEFAULT_CWD);
26508
+ var projectReportTool = createProjectReportTool(() => DEFAULT_CWD);
26509
+ var moduleReportTool = createModuleReportTool(() => DEFAULT_CWD);
26510
+ var effectiveConfigTool = createEffectiveConfigTool(() => DEFAULT_CWD);
26511
+ var noReadCoverage = () => {
26512
+ };
26513
+ var readSymbolTool = createReadSymbolTool(() => DEFAULT_CWD, noReadCoverage);
26514
+ var readEnclosingTool = createReadEnclosingTool(() => DEFAULT_CWD, noReadCoverage);
25457
26515
  var ALL_TOOLS = [
25458
26516
  {
25459
26517
  name: "pilens_analyze",
@@ -25527,168 +26585,28 @@ var ALL_TOOLS = [
25527
26585
  },
25528
26586
  {
25529
26587
  name: "pilens_symbol_search",
25530
- description: translateGuidanceToolNames(SYMBOL_SEARCH_DESCRIPTION, "mcp"),
25531
- inputSchema: {
25532
- type: "object",
25533
- properties: {
25534
- query: {
25535
- type: "string",
25536
- description: "Identifier-ish query, e.g. 'authenticate user'. Mix in composable prefix filters: lang:<kind> (e.g. lang:jsts, lang:python \u2014 kinds from file-kinds.ts), file:<substr> (path substring), ext:<ext> (e.g. ext:ts or ext:.ts), each optionally negated with a leading '-' (-file:test). Filters apply before ranking; e.g. 'lang:jsts file:clients/ -file:test rank'. Unknown prefixes/kinds error with the supported list."
25537
- },
25538
- cwd: { type: "string" },
25539
- limit: {
25540
- type: "number",
25541
- description: "Max files to return (default 20)."
25542
- },
25543
- paths: {
25544
- type: "array",
25545
- items: { type: "string" },
25546
- description: "Glob array scoping hits to matching files \u2014 same shape/semantics as pilens_ast_grep_search's `paths` (a bare directory/file entry scopes its whole subtree). Filters before ranking, so scores within the scoped set are unaffected."
25547
- },
25548
- lang: {
25549
- type: "string",
25550
- description: "Restrict hits to one language, using the same identifiers as pilens_ast_grep_search's `lang` param (e.g. 'typescript', 'python', 'go')."
25551
- }
25552
- },
25553
- required: ["query"]
25554
- }
26588
+ description: translateGuidanceToolNames(symbolSearchTool.description, "mcp"),
26589
+ inputSchema: schemaWithCwd(symbolSearchTool.parameters)
25555
26590
  },
25556
26591
  {
25557
26592
  name: "pilens_module_report",
25558
- description: translateGuidanceToolNames("Return a navigable source-module outline with references and read handles. An outline shows shape, not bodies, and does not satisfy read-before-edit; `read_symbol` and `read_enclosing` return body text and record read coverage. On a cold cache, project_report and symbol_search return available: false with a retry hint and start a non-blocking background build; module_report degrades to outline-only with cache freshness explicit. Example: use pilens_module_report on `src/app.ts` before pilens_read_symbol.", "mcp"),
25559
- inputSchema: {
25560
- type: "object",
25561
- properties: {
25562
- file: {
25563
- type: "string",
25564
- description: "File to report on (absolute or relative to cwd)."
25565
- },
25566
- path: {
25567
- type: "string",
25568
- description: "File to report on (the canonical spelling of `file`)."
25569
- },
25570
- filePath: { type: "string", description: "Alias for `path`." },
25571
- cwd: { type: "string" },
25572
- maxRefsPerSymbol: {
25573
- type: "number",
25574
- description: "Cap who-uses-this entries per symbol (default 10)."
25575
- },
25576
- focus: {
25577
- type: "string",
25578
- description: "Optional task hint used only to rank recommendedReads (does not expand scope or trigger scans)."
25579
- },
25580
- view: {
25581
- type: "string",
25582
- description: 'Output preset: projection \xD7 format. "summary-text" (default) = metric fields off (no usedBy/fanout/complexity fields), text. "summary-json" = same fields, JSON. "full-text" = every field, text. "full-json" = every field, JSON (byte-identical to the pre-#5137 default). Metrics render as a cx:/fan: suffix and flags as [flag]; every field appears in the text cell, `kind` prints raw so it can be reused as read_symbol\'s kind filter, and an unavailable module still renders its callbacks and recommended reads. A summary cell states the omission in its PROVENANCE footer. A maxRefsPerSymbol argument promotes the projection to full and keeps the format.'
25583
- },
25584
- blastRadius: {
25585
- type: "boolean",
25586
- description: "Include the cross-file blast radius: transitive dependents aggregated to ranked file reads. Read-only over the cached graph (omitted when cold)."
25587
- },
25588
- blastRadiusDepth: {
25589
- type: "number",
25590
- description: "Max hops for the blast-radius walk (default 3). Only used with blastRadius."
25591
- },
25592
- callGraph: {
25593
- type: "boolean",
25594
- description: "Include bounded derived callers/callees from the cached FunctionCallGraph; cold or stale cache state is explicit."
25595
- },
25596
- maxCallGraphEntries: {
25597
- type: "number",
25598
- description: "Per-direction cap for call-graph relations (default 20)."
25599
- }
25600
- }
25601
- }
26593
+ description: translateGuidanceToolNames(moduleReportTool.description, "mcp"),
26594
+ inputSchema: schemaWithCwd(moduleReportTool.parameters)
25602
26595
  },
25603
26596
  {
25604
26597
  name: "pilens_project_report",
25605
- description: translateGuidanceToolNames('Orient in a project from its review graph. Returns a line-oriented TEXT report by default; pass view:"json" for the full JSON payload. On a cold cache, project_report and symbol_search return available: false with a retry hint and start a non-blocking background build; module_report degrades to outline-only with cache freshness explicit. Example: use pilens_project_report before choosing a file.', "mcp"),
25606
- inputSchema: {
25607
- type: "object",
25608
- properties: {
25609
- cwd: { type: "string" },
25610
- limit: {
25611
- type: "number",
25612
- description: "Scales every ranked section's cap (default 10) \u2014 a single knob for all sections."
25613
- },
25614
- focus: {
25615
- type: "string",
25616
- description: "Optional task hint used only to re-rank sections toward relevant subsystems (does not expand scope or trigger scans)."
25617
- },
25618
- view: {
25619
- type: "string",
25620
- // Plain string, no enum: "json" is the JSON hatch; anything else is text.
25621
- description: 'Payload tier. "json" returns the full JSON report; any other value (or omitting view) returns the default line-oriented TEXT rendering.'
25622
- }
25623
- }
25624
- }
26598
+ description: translateGuidanceToolNames(projectReportTool.description, "mcp"),
26599
+ inputSchema: schemaWithCwd(projectReportTool.parameters)
25625
26600
  },
25626
26601
  {
25627
26602
  name: "pilens_read_symbol",
25628
- description: translateGuidanceToolNames("Return one symbol's verbatim source. An outline shows shape, not bodies, and does not satisfy read-before-edit; `read_symbol` and `read_enclosing` return body text and record read coverage. Example: use pilens_read_symbol after pilens_module_report identifies `parseConfig`.", "mcp"),
25629
- inputSchema: {
25630
- type: "object",
25631
- properties: {
25632
- file: { type: "string", description: "File containing the symbol." },
25633
- path: {
25634
- type: "string",
25635
- description: "File containing the symbol (the canonical spelling of `file`)."
25636
- },
25637
- filePath: { type: "string", description: "Alias for `path`." },
25638
- symbol: {
25639
- type: "string",
25640
- description: "Exact symbol name to read, or a dotted `Class.method` to disambiguate a member."
25641
- },
25642
- kind: {
25643
- type: "string",
25644
- description: "Optional kind filter (e.g. function, interface, class) to disambiguate when multiple same-file symbols share the requested name."
25645
- },
25646
- cwd: { type: "string" }
25647
- },
25648
- required: ["symbol"]
25649
- }
26603
+ description: translateGuidanceToolNames(readSymbolTool.description, "mcp"),
26604
+ inputSchema: schemaWithCwd(readSymbolTool.parameters)
25650
26605
  },
25651
26606
  {
25652
26607
  name: "pilens_read_enclosing",
25653
- description: translateGuidanceToolNames("Return the smallest symbol or callback enclosing a line. An outline shows shape, not bodies, and does not satisfy read-before-edit; `read_symbol` and `read_enclosing` return body text and record read coverage. Example: use pilens_read_enclosing after a diagnostic points to line 42.", "mcp"),
25654
- inputSchema: {
25655
- type: "object",
25656
- properties: {
25657
- file: {
25658
- type: "string",
25659
- description: "Absolute or workspace-relative path to the source file."
25660
- },
25661
- path: {
25662
- type: "string",
25663
- description: "Absolute or workspace-relative path to the source file (the canonical spelling of `file`)."
25664
- },
25665
- filePath: { type: "string", description: "Alias for `path`." },
25666
- line: {
25667
- type: "number",
25668
- description: "1-based line number inside the desired symbol/callback."
25669
- },
25670
- cwd: { type: "string" },
25671
- kinds: {
25672
- type: "array",
25673
- items: { type: "string" },
25674
- description: "Optional kind filter, e.g. function, method, callback, class."
25675
- },
25676
- maxLines: {
25677
- type: "number",
25678
- description: "Optional maximum body size to return. Oversized matches obey onOversize."
25679
- },
25680
- onOversize: {
25681
- type: "string",
25682
- enum: ["error", "slice", "outline"],
25683
- description: "Behavior when the enclosing body exceeds maxLines. error (default) returns metadata only; slice returns a bounded partial read around line; outline returns nested symbols/callbacks with read handles."
25684
- },
25685
- aroundLine: {
25686
- type: "number",
25687
- description: "Maximum lines for onOversize=slice; defaults to maxLines, then 80."
25688
- }
25689
- },
25690
- required: ["line"]
25691
- }
26608
+ description: translateGuidanceToolNames(readEnclosingTool.description, "mcp"),
26609
+ inputSchema: schemaWithCwd(readEnclosingTool.parameters)
25692
26610
  },
25693
26611
  {
25694
26612
  name: "pilens_health",
@@ -25697,22 +26615,8 @@ var ALL_TOOLS = [
25697
26615
  },
25698
26616
  {
25699
26617
  name: "pilens_effective_config",
25700
- description: "Explain resolved configuration and provenance. Response is redacted by construction: it contains no environment values, no command arguments beyond the binary, and home-relative paths; a tier-denied LSP decision cannot be lifted by a nearer config. Example: pass `file` to explain one selection.",
25701
- inputSchema: {
25702
- type: "object",
25703
- properties: {
25704
- cwd: { type: "string" },
25705
- file: {
25706
- type: "string",
25707
- description: "Path to explain: adds the resolved language plus the per-server and per-runner selection decisions for it. Must resolve inside `cwd` (a sibling package in the same monorepo does not count) \u2014 a file outside it is rejected with the `cwd` it was measured against; re-query with `cwd` set to that file's own workspace instead."
25708
- },
25709
- path: {
25710
- type: "string",
25711
- description: "Path to explain (the canonical spelling of `file`)."
25712
- },
25713
- filePath: { type: "string", description: "Alias for `path`." }
25714
- }
25715
- }
26618
+ description: translateGuidanceToolNames(effectiveConfigTool.description, "mcp"),
26619
+ inputSchema: schemaWithCwd(effectiveConfigTool.parameters)
25716
26620
  },
25717
26621
  {
25718
26622
  name: "pilens_session_start",
@@ -25772,7 +26676,12 @@ function enabledToolsForCwd(cwd) {
25772
26676
  }
25773
26677
  function formatAnalyze(result, cwd, mode, servedBy) {
25774
26678
  const lspNote = result.lsp ? ` \xB7 lsp ${result.lsp.diagnosticCount} (${result.lsp.status}${result.lsp.failureKind ? `: ${result.lsp.failureKind}` : ""}, ${result.lsp.durationMs}ms)` : "";
25775
- const summary = `${path40.relative(cwd, result.filePath) || result.filePath} [${mode}] \u2014 ${result.counts.blockers} blocking, ${result.counts.warnings} warning(s), ${result.counts.advisories} advisory(ies), ${result.counts.diagnostics} total` + (result.latency ? ` \xB7 ${result.latency.totalDurationMs}ms` : "") + lspNote + (result.counts.fixed > 0 ? ` \xB7 ${result.counts.fixed} auto-fixed` : "") + (servedBy ? `
26679
+ const notChecked = verdictUncheckedReason(result.verdict);
26680
+ const summary = `${path43.relative(cwd, result.filePath) || result.filePath} [${mode}] \u2014 ${result.counts.blockers} blocking, ${result.counts.warnings} warning(s), ${result.counts.advisories} advisory(ies), ${result.counts.diagnostics} total` + // #5287: zero counts beside a check that never completed are not a clean
26681
+ // file, so the summary says so beside them.
26682
+ // A worker reply from an older build carries no verdict (the facade casts
26683
+ // it unvalidated), which the shared reader also treats as unchecked.
26684
+ (notChecked === void 0 ? "" : ` \xB7 not checked: ${notChecked}`) + (result.latency ? ` \xB7 ${result.latency.totalDurationMs}ms` : "") + lspNote + (result.counts.fixed > 0 ? ` \xB7 ${result.counts.fixed} auto-fixed` : "") + (servedBy ? `
25776
26685
 
25777
26686
  servedBy: ${servedBy}` : "");
25778
26687
  return renderToolText(summary, servedBy ? { ...result, servedBy } : result);
@@ -25909,7 +26818,7 @@ ${outcome.output}`, {
25909
26818
  }
25910
26819
  const { deduped, byRule, byFile } = summarizeScan(snapshot.diagnostics);
25911
26820
  const topRules = Object.entries(byRule).sort((a, b) => b[1] - a[1]);
25912
- const topFiles = Object.entries(byFile).sort((a, b) => b[1] - a[1]).slice(0, 15).map(([file, count]) => ({ file: path40.relative(cwd, file), count }));
26821
+ const topFiles = Object.entries(byFile).sort((a, b) => b[1] - a[1]).slice(0, 15).map(([file, count]) => ({ file: path43.relative(cwd, file), count }));
25913
26822
  const summaryLines = [
25914
26823
  `Scanned ${snapshot.filesScanned} file(s) [${snapshot.runners.join(", ")}] \u2192 ${deduped.length} unique diagnostic(s)` + (snapshot.diagnostics.length !== deduped.length ? ` (${snapshot.diagnostics.length} raw, ${snapshot.diagnostics.length - deduped.length} duplicate)` : ""),
25915
26824
  ...topRules.slice(0, 12).map(([rule, count]) => ` ${count}\xD7 ${rule}`)
@@ -25942,16 +26851,19 @@ ${outcome.output}`, {
25942
26851
  }
25943
26852
  if (name === "pilens_symbol_search") {
25944
26853
  const query = typeof args.query === "string" ? args.query : "";
25945
- if (!query.trim())
25946
- return renderToolText("Provide a non-empty `query`.");
25947
26854
  const cwd = typeof args.cwd === "string" ? args.cwd : DEFAULT_CWD;
25948
- const pathsRead = readPathsArgument(args.paths, { cwd });
26855
+ const pathsRead = await readPathsArgument(args.paths, {
26856
+ cwd,
26857
+ filterOnly: true
26858
+ });
25949
26859
  if (pathsRead.refusal)
25950
26860
  return { ...renderToolText(pathsRead.refusal), isError: true };
25951
26861
  const limit = typeof args.limit === "number" && Number.isFinite(args.limit) ? args.limit : void 0;
25952
26862
  const paths = pathsRead.entries.length > 0 ? pathsRead.entries : void 0;
25953
26863
  const lang = typeof args.lang === "string" ? args.lang : void 0;
25954
26864
  const result = await symbolSearch(query, cwd, limit, { paths, lang });
26865
+ if (result.refusal)
26866
+ return { ...renderToolText(result.refusal), isError: true };
25955
26867
  if (!result.available) {
25956
26868
  return renderToolText(result.hint ?? "No word index for this workspace yet \u2014 run pilens_session_start first.");
25957
26869
  }
@@ -26016,7 +26928,7 @@ ${graphStaleness}` : rendered;
26016
26928
  isError: true
26017
26929
  };
26018
26930
  }
26019
- if (args.view === "json") {
26931
+ if (projectReportViewIsJson(args.view)) {
26020
26932
  return {
26021
26933
  content: [{ type: "text", text: JSON.stringify(report) }],
26022
26934
  details: { [JSON_CELL_DETAILS_KEY]: true }
@@ -26042,7 +26954,7 @@ ${graphStaleness}` : rendered;
26042
26954
  const result = await readSymbol(file, symbol, cwd, { kind });
26043
26955
  if (!result.found && result.error) {
26044
26956
  return {
26045
- ...renderToolText(`Could not inspect ${path40.basename(file)}: ${result.error}`, {
26957
+ ...renderToolText(`Could not inspect ${path43.basename(file)}: ${result.error}`, {
26046
26958
  found: false,
26047
26959
  error: result.error,
26048
26960
  ...result.warnings ? { warnings: result.warnings } : {}
@@ -26053,7 +26965,7 @@ ${graphStaleness}` : rendered;
26053
26965
  if (!result.found) {
26054
26966
  const suggestionSuffix = result.suggestions?.length ? ` Did you mean: ${result.suggestions.join(", ")}?` : " Use pilens_module_report to list symbols.";
26055
26967
  return {
26056
- ...renderToolText(`Symbol "${symbol}" not found in ${path40.basename(file)}.${suggestionSuffix}`, {
26968
+ ...renderToolText(`Symbol "${symbol}" not found in ${path43.basename(file)}.${suggestionSuffix}`, {
26057
26969
  found: false,
26058
26970
  ...result.suggestions ? { suggestions: result.suggestions } : {},
26059
26971
  ...result.warnings ? { warnings: result.warnings } : {}
@@ -26063,7 +26975,7 @@ ${graphStaleness}` : rendered;
26063
26975
  }
26064
26976
  const sigSuffix = result.signature ? ` ${result.signature}` : "";
26065
26977
  const ambiguityNote = result.ambiguous ? ` (${result.ambiguous.count} matches \u2014 returned the ${result.kind}; pass \`kind\` to disambiguate: ${result.ambiguous.kinds.join(", ")})` : "";
26066
- const header = `${result.kind} ${result.name}${ambiguityNote}${sigSuffix} ${path40.relative(cwd, result.path)}:${result.startLine}-${result.endLine}`;
26978
+ const header = `${result.kind} ${result.name}${ambiguityNote}${sigSuffix} ${path43.relative(cwd, result.path)}:${result.startLine}-${result.endLine}`;
26067
26979
  return {
26068
26980
  content: [
26069
26981
  {
@@ -26089,9 +27001,9 @@ ${result.source ?? ""}`
26089
27001
  }
26090
27002
  const cwd = typeof args.cwd === "string" ? args.cwd : DEFAULT_CWD;
26091
27003
  const kinds = Array.isArray(args.kinds) ? args.kinds.filter((k) => typeof k === "string") : void 0;
26092
- const maxLines = typeof args.maxLines === "number" && Number.isFinite(args.maxLines) ? Math.max(1, Math.floor(args.maxLines)) : void 0;
27004
+ const maxLines = typeof args.maxLines === "number" ? args.maxLines : void 0;
26093
27005
  const onOversize = args.onOversize === "error" || args.onOversize === "slice" || args.onOversize === "outline" ? args.onOversize : void 0;
26094
- const aroundLine = typeof args.aroundLine === "number" && Number.isFinite(args.aroundLine) ? Math.max(1, Math.floor(args.aroundLine)) : void 0;
27006
+ const aroundLine = typeof args.aroundLine === "number" ? args.aroundLine : void 0;
26095
27007
  const result = await readEnclosing(file, line, cwd, {
26096
27008
  kinds,
26097
27009
  maxLines,
@@ -26104,14 +27016,14 @@ ${result.source ?? ""}`
26104
27016
 
26105
27017
  Nested outline:
26106
27018
  ${JSON.stringify(result.outline)}` : "";
26107
- const text = result.error ? `Could not read enclosing range in ${path40.basename(file)}:${result.line}: ${result.error}${warningSuffix}${outlineSuffix}` : `No enclosing symbol/callback found in ${path40.basename(file)}:${result.line}.${warningSuffix}`;
27019
+ const text = result.error ? `Could not read enclosing range in ${path43.basename(file)}:${result.line}: ${result.error}${warningSuffix}${outlineSuffix}` : `No enclosing symbol/callback found in ${path43.basename(file)}:${result.line}.${warningSuffix}`;
26108
27020
  return {
26109
27021
  ...renderToolText(text, { found: false, line: result.line }),
26110
27022
  isError: true
26111
27023
  };
26112
27024
  }
26113
27025
  const range = result.partial ? `${result.startLine}-${result.endLine} (partial of ${result.enclosingStartLine}-${result.enclosingEndLine})` : `${result.startLine}-${result.endLine}`;
26114
- const header = `${result.kind} ${result.name} ${path40.relative(cwd, result.path)}:${range}`;
27026
+ const header = `${result.kind} ${result.name} ${path43.relative(cwd, result.path)}:${range}`;
26115
27027
  return {
26116
27028
  content: [
26117
27029
  {
@@ -26146,7 +27058,7 @@ ${result.source ?? ""}`
26146
27058
  ]),
26147
27059
  ...renderLspBrokenStatusLines(brokenServers),
26148
27060
  ...renderDegradationLines(degradations),
26149
- last ? `Last dispatch: ${path40.basename(last.filePath)} \u2014 ${last.totalDurationMs}ms, ${last.totalDiagnostics} diagnostic(s)` : "Last dispatch: none yet",
27061
+ last ? `Last dispatch: ${path43.basename(last.filePath)} \u2014 ${last.totalDurationMs}ms, ${last.totalDiagnostics} diagnostic(s)` : "Last dispatch: none yet",
26150
27062
  `Diagnostics this session: ${stats.totalShown} shown \xB7 ${stats.totalAutoFixed} auto-fixed \xB7 ${stats.totalUnresolved} unresolved`,
26151
27063
  autoSession ? `Auto session_start: ${autoSession.succeeded ? "succeeded" : autoSession.error ? "FAILED" : autoSession.attempted ? "in progress" : "not yet attempted"}${autoSession.firedAt ? ` (fired ${autoSession.firedAt})` : ""}${autoSession.error ? ` \u2014 ${autoSession.error}` : ""}` : "Auto session_start: disabled (PI_LENS_MCP_AUTO_SESSION not set)",
26152
27064
  turnEnd ? `Stop-hook turn-end: ${turnEnd.ran} ran \xB7 ${turnEnd.skipped} skipped${turnEnd.lastRunAt ? ` (last ran ${turnEnd.lastRunAt})` : ""}${turnEnd.lastSkipReason ? ` \u2014 last skip: ${turnEnd.lastSkipReason}${turnEnd.lastSkipAt ? ` at ${turnEnd.lastSkipAt}` : ""}` : ""}` : "Stop-hook turn-end: no activity recorded (hook not installed, or no Stop yet)",
@@ -26215,7 +27127,7 @@ ${result.source ?? ""}`
26215
27127
  const limit = typeof args.limit === "number" && Number.isFinite(args.limit) ? Math.max(1, Math.floor(args.limit)) : 5;
26216
27128
  const fileFilter = typeof args.file === "string" ? args.file : void 0;
26217
27129
  const recent = recentLatency(limit, fileFilter);
26218
- const summary = recent.length === 0 ? "No dispatch latency reports yet." : recent.map((report) => `${path40.basename(report.filePath)}: ${report.totalDurationMs}ms (${report.totalDiagnostics} diag${report.stoppedEarly ? ", stopped early" : ""})`).join("\n");
27130
+ const summary = recent.length === 0 ? "No dispatch latency reports yet." : recent.map((report) => `${path43.basename(report.filePath)}: ${report.totalDurationMs}ms (${report.totalDiagnostics} diag${report.stoppedEarly ? ", stopped early" : ""})`).join("\n");
26219
27131
  return renderToolText(summary, recent);
26220
27132
  }
26221
27133
  if (name === "pilens_session_start") {