@herbertgao/pi-extensions 2026.10.2 → 2026.10.4

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 (362) hide show
  1. package/README.md +6 -12
  2. package/THIRD_PARTY_NOTICES.md +5 -1
  3. package/node_modules/@herbertgao/pi-subagents/CHANGELOG.md +8 -0
  4. package/node_modules/@herbertgao/pi-subagents/README.md +1 -1
  5. package/node_modules/@herbertgao/pi-subagents/package.json +4 -5
  6. package/node_modules/@herbertgao/pi-subagents/src/index.ts +1 -1
  7. package/node_modules/@herbertgao/pi-subagents/src/invocation-config.ts +1 -1
  8. package/node_modules/@herbertgao/pi-subagents/src/mention-clone.ts +48 -72
  9. package/node_modules/@herbertgao/pi-subagents/src/nested-tools.ts +1 -1
  10. package/node_modules/@herbertgao/pi-subagents/src/output-file.ts +15 -6
  11. package/node_modules/@herbertgao/pi-subagents/src/workflow/collisions.ts +4 -1
  12. package/node_modules/@herbertgao/pi-subagents/src/workflow/json-schema.ts +9 -8
  13. package/node_modules/@narumitw/pi-caffeinate/dist/index.ts +6 -1
  14. package/node_modules/@narumitw/pi-caffeinate/dist/index.ts.map +2 -2
  15. package/node_modules/@narumitw/pi-caffeinate/package.json +1 -1
  16. package/node_modules/@narumitw/pi-caffeinate/src/dbus-inhibit.ts +13 -1
  17. package/node_modules/pi-lens/CHANGELOG.md +95 -0
  18. package/node_modules/pi-lens/README.md +1 -0
  19. package/node_modules/pi-lens/dist/chunk-2FQ62SPM.js +83 -0
  20. package/node_modules/pi-lens/dist/{chunk-6P62QVEA.js → chunk-2UMYMRI3.js} +2 -2
  21. package/node_modules/pi-lens/dist/{chunk-O6TQT6RI.js → chunk-34OCDWOS.js} +1 -1
  22. package/node_modules/pi-lens/dist/{chunk-XK4CIILI.js → chunk-3FERWMCH.js} +26 -26
  23. package/node_modules/pi-lens/dist/{chunk-ZAWW3AF6.js → chunk-3JL6IFD7.js} +8 -8
  24. package/node_modules/pi-lens/dist/{chunk-OAXNDZJ7.js → chunk-3JSEWUWI.js} +8 -4
  25. package/node_modules/pi-lens/dist/{chunk-RPD5K5NC.js → chunk-3MRXIJ6I.js} +2 -2
  26. package/node_modules/pi-lens/dist/{chunk-IVP5KAB7.js → chunk-3P4PF2BX.js} +14 -14
  27. package/node_modules/pi-lens/dist/{chunk-5THXD6X5.js → chunk-3PNFWVHT.js} +2 -2
  28. package/node_modules/pi-lens/dist/{chunk-VD4JQCQC.js → chunk-3TTPKMEF.js} +37 -37
  29. package/node_modules/pi-lens/dist/{chunk-7F72PXY2.js → chunk-5JHXUETW.js} +3 -3
  30. package/node_modules/pi-lens/dist/{chunk-5ZEJHV35.js → chunk-64LU2OVH.js} +2 -2
  31. package/node_modules/pi-lens/dist/{chunk-ODEEOXPH.js → chunk-6B5I6ICN.js} +11 -11
  32. package/node_modules/pi-lens/dist/{chunk-5RXBNSW2.js → chunk-6P54TMWL.js} +16 -8
  33. package/node_modules/pi-lens/dist/{chunk-K6VYLB2U.js → chunk-6UYA642J.js} +12 -12
  34. package/node_modules/pi-lens/dist/{chunk-V7R425XG.js → chunk-6XX5HCLK.js} +4 -4
  35. package/node_modules/pi-lens/dist/{chunk-D6QS3U6M.js → chunk-7AXO3ZDF.js} +15 -15
  36. package/node_modules/pi-lens/dist/{chunk-YGVYKNSN.js → chunk-7BX5DWSA.js} +59 -12
  37. package/node_modules/pi-lens/dist/{chunk-N3YQJI6O.js → chunk-7ELY2CSM.js} +7 -4
  38. package/node_modules/pi-lens/dist/{chunk-AWE5TMPO.js → chunk-7M4T5N3V.js} +13 -13
  39. package/node_modules/pi-lens/dist/{chunk-AJ3QXTRQ.js → chunk-AFZYMAIV.js} +33 -33
  40. package/node_modules/pi-lens/dist/{chunk-AJXODZY6.js → chunk-ALQRYH6O.js} +12 -12
  41. package/node_modules/pi-lens/dist/{chunk-AJVLWNFN.js → chunk-AXKPQ6ZI.js} +5 -5
  42. package/node_modules/pi-lens/dist/{chunk-HWBZIGMJ.js → chunk-BHWHXMQ2.js} +8 -8
  43. package/node_modules/pi-lens/dist/{chunk-IXEBJSUE.js → chunk-BJF25SUG.js} +10 -10
  44. package/node_modules/pi-lens/dist/{chunk-GVXA6CCE.js → chunk-BNKLYOOO.js} +1 -1
  45. package/node_modules/pi-lens/dist/{chunk-T4ERT73Y.js → chunk-CBD2B5CP.js} +20 -20
  46. package/node_modules/pi-lens/dist/{chunk-O5WILGMI.js → chunk-CFYISHUW.js} +5 -5
  47. package/node_modules/pi-lens/dist/{chunk-EOKRQ3SA.js → chunk-CMU4RMJB.js} +1 -1
  48. package/node_modules/pi-lens/dist/{chunk-YSNFMJKN.js → chunk-CULQYFLU.js} +2 -2
  49. package/node_modules/pi-lens/dist/{chunk-ORTMY4Q4.js → chunk-D65GOCJB.js} +21 -14
  50. package/node_modules/pi-lens/dist/{chunk-NTUJEGDZ.js → chunk-D6YF5HKX.js} +2 -2
  51. package/node_modules/pi-lens/dist/{chunk-BRJKOBZP.js → chunk-DMS52BEP.js} +17 -6
  52. package/node_modules/pi-lens/dist/{chunk-NL5GLMFI.js → chunk-ELVWJYRV.js} +11 -11
  53. package/node_modules/pi-lens/dist/{chunk-4W2PLC4J.js → chunk-EUT3B22Y.js} +12 -12
  54. package/node_modules/pi-lens/dist/{chunk-GUOGVTCQ.js → chunk-F5VLZHUW.js} +1 -1
  55. package/node_modules/pi-lens/dist/{chunk-I7SPGOWI.js → chunk-FGALODG3.js} +1 -1
  56. package/node_modules/pi-lens/dist/{chunk-Q5U6FMDI.js → chunk-G3RLJYA2.js} +12 -6
  57. package/node_modules/pi-lens/dist/{chunk-FJNKANOS.js → chunk-GAYGGICG.js} +9 -9
  58. package/node_modules/pi-lens/dist/{chunk-HVUZXSWK.js → chunk-H2W2AXD3.js} +38 -40
  59. package/node_modules/pi-lens/dist/{chunk-VHQLPIRJ.js → chunk-H5EV3VMF.js} +2 -2
  60. package/node_modules/pi-lens/dist/{chunk-27BBHSZC.js → chunk-HREZQCT3.js} +3 -3
  61. package/node_modules/pi-lens/dist/{chunk-TT22N74J.js → chunk-HSIRMK2D.js} +12 -12
  62. package/node_modules/pi-lens/dist/{chunk-3I5QFT3N.js → chunk-IMSQR4WO.js} +6 -3
  63. package/node_modules/pi-lens/dist/{chunk-B3I2UUT4.js → chunk-IQZXOZ7S.js} +156 -32
  64. package/node_modules/pi-lens/dist/{chunk-RIISMHKN.js → chunk-IR6XFA5P.js} +14 -13
  65. package/node_modules/pi-lens/dist/{chunk-LNAKEO63.js → chunk-IUKPRZER.js} +4 -4
  66. package/node_modules/pi-lens/dist/{chunk-RUOG5D2C.js → chunk-IUR76K6A.js} +5 -5
  67. package/node_modules/pi-lens/dist/{chunk-TO6WL3GM.js → chunk-J3FZR3YY.js} +12 -2
  68. package/node_modules/pi-lens/dist/{chunk-Y4T27COV.js → chunk-J6DFZDFA.js} +4 -4
  69. package/node_modules/pi-lens/dist/{chunk-E4MAEDPM.js → chunk-J7WJZ6W7.js} +11 -11
  70. package/node_modules/pi-lens/dist/{chunk-52H5B5TC.js → chunk-JONGANYH.js} +30 -30
  71. package/node_modules/pi-lens/dist/{chunk-TGPXLY2J.js → chunk-KJCWXUUS.js} +35 -1
  72. package/node_modules/pi-lens/dist/{chunk-I3R7GKDR.js → chunk-KJN4IOEJ.js} +1 -1
  73. package/node_modules/pi-lens/dist/{chunk-RPD4ZSB7.js → chunk-KMGPUKFD.js} +12 -12
  74. package/node_modules/pi-lens/dist/{chunk-OQGFCZJ4.js → chunk-LD7WFTRX.js} +13 -13
  75. package/node_modules/pi-lens/dist/{chunk-DIULIWKU.js → chunk-LNOMA3MP.js} +3 -3
  76. package/node_modules/pi-lens/dist/{chunk-HHYAELLJ.js → chunk-MGIWSROG.js} +5 -5
  77. package/node_modules/pi-lens/dist/{chunk-YLF3PPT5.js → chunk-MQA2YBAH.js} +3 -3
  78. package/node_modules/pi-lens/dist/{chunk-TVN5N6GY.js → chunk-MTDRLSI7.js} +690 -186
  79. package/node_modules/pi-lens/dist/{chunk-DQ2NZ7C4.js → chunk-N2IRDBZI.js} +44 -6
  80. package/node_modules/pi-lens/dist/{chunk-AHDW3GPE.js → chunk-N77WFUL7.js} +22 -22
  81. package/node_modules/pi-lens/dist/{chunk-NXPS2L6U.js → chunk-N7YNJE5R.js} +7 -7
  82. package/node_modules/pi-lens/dist/{chunk-7FBF7NPR.js → chunk-NFXP47RV.js} +13 -12
  83. package/node_modules/pi-lens/dist/{chunk-UY752QSN.js → chunk-NJF2X5XF.js} +17 -17
  84. package/node_modules/pi-lens/dist/{chunk-WONERJTP.js → chunk-O7HZX7CA.js} +1 -1
  85. package/node_modules/pi-lens/dist/{chunk-AS44CFQ4.js → chunk-OC7LYAU5.js} +7 -7
  86. package/node_modules/pi-lens/dist/{chunk-4RERDEXR.js → chunk-OEX24ECI.js} +30 -30
  87. package/node_modules/pi-lens/dist/{chunk-6VCD4VKZ.js → chunk-OYOB3ZFG.js} +2 -2
  88. package/node_modules/pi-lens/dist/{chunk-IIXOAGHR.js → chunk-OYTMZXRF.js} +18 -15
  89. package/node_modules/pi-lens/dist/{chunk-ARFCXG7S.js → chunk-OZJINN4O.js} +2 -2
  90. package/node_modules/pi-lens/dist/{chunk-34U7PLGE.js → chunk-PCHDGUKT.js} +11 -11
  91. package/node_modules/pi-lens/dist/{chunk-VCSRSYLF.js → chunk-RJFED73B.js} +34 -36
  92. package/node_modules/pi-lens/dist/chunk-RTQNRM5X.js +27 -0
  93. package/node_modules/pi-lens/dist/{chunk-PAK6IDME.js → chunk-S6AMWKPC.js} +2 -2
  94. package/node_modules/pi-lens/dist/{chunk-U3VGR4VU.js → chunk-T4QZ6FEH.js} +4 -4
  95. package/node_modules/pi-lens/dist/{chunk-VN2AXLEX.js → chunk-T54VJRAD.js} +54 -12
  96. package/node_modules/pi-lens/dist/{chunk-ZMOL6RQC.js → chunk-TA5L5KWQ.js} +2 -2
  97. package/node_modules/pi-lens/dist/{chunk-JOLITGCC.js → chunk-TQFBZVCG.js} +1 -1
  98. package/node_modules/pi-lens/dist/{chunk-VDBPVIKD.js → chunk-U52SAGRM.js} +1 -1
  99. package/node_modules/pi-lens/dist/{chunk-LW6XKDZQ.js → chunk-UEAHAMEI.js} +284 -35
  100. package/node_modules/pi-lens/dist/{chunk-NMABWBZN.js → chunk-UGSMCQ4D.js} +1 -1
  101. package/node_modules/pi-lens/dist/{chunk-6QIUX4EP.js → chunk-USHG4DLH.js} +7 -7
  102. package/node_modules/pi-lens/dist/{chunk-LSMJ6KBE.js → chunk-V5MEBST3.js} +16 -16
  103. package/node_modules/pi-lens/dist/chunk-VGEVL5EQ.js +29 -0
  104. package/node_modules/pi-lens/dist/{chunk-47D2BO4S.js → chunk-VPWKF3GN.js} +10 -10
  105. package/node_modules/pi-lens/dist/{chunk-UK3CMEAL.js → chunk-VSMJK3ZJ.js} +1 -1
  106. package/node_modules/pi-lens/dist/{chunk-22AVIGXS.js → chunk-VYKKMYVT.js} +7 -7
  107. package/node_modules/pi-lens/dist/{chunk-OS32RNR2.js → chunk-VZHJS6DR.js} +15 -15
  108. package/node_modules/pi-lens/dist/{chunk-E2WFBRHM.js → chunk-WATC3IQR.js} +3 -3
  109. package/node_modules/pi-lens/dist/chunk-WPE5FPGR.js +54 -0
  110. package/node_modules/pi-lens/dist/{chunk-V5PXFSZK.js → chunk-WSEWKCXU.js} +4 -4
  111. package/node_modules/pi-lens/dist/{chunk-NKOUFPQF.js → chunk-WW5BLB74.js} +2 -2
  112. package/node_modules/pi-lens/dist/{chunk-PWFHBTSF.js → chunk-XGUL4SLQ.js} +2 -2
  113. package/node_modules/pi-lens/dist/{chunk-F3P7VQ7H.js → chunk-XHSCVSOL.js} +3 -3
  114. package/node_modules/pi-lens/dist/{chunk-DFVMIKMQ.js → chunk-YLN4K6WD.js} +45 -9
  115. package/node_modules/pi-lens/dist/{chunk-VNMT7C64.js → chunk-Z6BB4JLQ.js} +2 -2
  116. package/node_modules/pi-lens/dist/{chunk-NTHH2J74.js → chunk-Z7QQA2KT.js} +12 -12
  117. package/node_modules/pi-lens/dist/{chunk-F3AU2TMM.js → chunk-ZETYB3XG.js} +15 -15
  118. package/node_modules/pi-lens/dist/{chunk-XECLWQZN.js → chunk-ZMOMPX2Z.js} +12 -10
  119. package/node_modules/pi-lens/dist/{chunk-C2AUYXQH.js → chunk-ZOEYVXSV.js} +4 -4
  120. package/node_modules/pi-lens/dist/{chunk-TLGFBM3F.js → chunk-ZZUFZUQZ.js} +68 -64
  121. package/node_modules/pi-lens/dist/index.js +30113 -28398
  122. package/node_modules/pi-lens/dist/mcp/analyze-cli.js +8 -8
  123. package/node_modules/pi-lens/dist/mcp/cli.js +37 -37
  124. package/node_modules/pi-lens/dist/mcp/server.js +257 -158
  125. package/node_modules/pi-lens/dist/mcp/worker.js +55 -55
  126. package/node_modules/pi-lens/dist/probes/installer.js +19 -19
  127. package/node_modules/pi-lens/docs/ast-grep_rules_catalog.md +2 -2
  128. package/node_modules/pi-lens/docs/configuration.md +9 -2
  129. package/node_modules/pi-lens/docs/custom-rules.md +25 -2
  130. package/node_modules/pi-lens/docs/environment-variables.md +34 -6
  131. package/node_modules/pi-lens/docs/features.md +37 -1
  132. package/node_modules/pi-lens/docs/globalconfig.md +1 -1
  133. package/node_modules/pi-lens/docs/lsp-capability-matrix.md +2 -1
  134. package/node_modules/pi-lens/docs/lsp-idle-eviction.md +1 -1
  135. package/node_modules/pi-lens/docs/pi-lens-fixer.md +9 -5
  136. package/node_modules/pi-lens/docs/pi-lens-merge-policy.md +43 -1
  137. package/node_modules/pi-lens/docs/pi-lens-monitor.md +3 -1
  138. package/node_modules/pi-lens/docs/pi-lens-reviewer.md +4 -3
  139. package/node_modules/pi-lens/docs/schema/pi-lens-config-v1.json +530 -0
  140. package/node_modules/pi-lens/docs/servercapabilities.md +4 -1
  141. package/node_modules/pi-lens/docs/word-index.md +6 -0
  142. package/node_modules/pi-lens/package.json +1 -1
  143. package/node_modules/pi-lens/rules/ast-grep-rules/rule-tests/no-identity-operator-on-literals-test.yml +12 -2
  144. package/node_modules/pi-lens/rules/ast-grep-rules/rule-tests/throw-new-error-js-test.yml +2 -0
  145. package/node_modules/pi-lens/rules/ast-grep-rules/rule-tests/throw-new-error-test.yml +2 -0
  146. package/node_modules/pi-lens/rules/ast-grep-rules/rules/no-identity-operator-on-literals.yml +20 -12
  147. package/node_modules/pi-lens/rules/ast-grep-rules/rules/throw-new-error-js.yml +2 -2
  148. package/node_modules/pi-lens/rules/ast-grep-rules/rules/throw-new-error.yml +2 -2
  149. package/node_modules/pi-provider-qoder/README.md +140 -0
  150. package/node_modules/pi-provider-qoder/dist/index.js +10249 -0
  151. package/node_modules/pi-provider-qoder/package.json +57 -0
  152. package/node_modules/pi-web-access/CHANGELOG.md +28 -0
  153. package/node_modules/pi-web-access/README.md +10 -6
  154. package/node_modules/pi-web-access/ceramic.ts +219 -0
  155. package/node_modules/pi-web-access/curator-page.ts +3 -1
  156. package/node_modules/pi-web-access/curator-server.ts +1 -0
  157. package/node_modules/pi-web-access/dist/index.js +846 -588
  158. package/node_modules/pi-web-access/dist/mcp-cli.js +725 -516
  159. package/node_modules/pi-web-access/gemini-search.ts +8 -4
  160. package/node_modules/pi-web-access/github-extract.ts +34 -2
  161. package/node_modules/pi-web-access/index.ts +72 -30
  162. package/node_modules/pi-web-access/openai-search.ts +3 -3
  163. package/node_modules/pi-web-access/package.json +2 -2
  164. package/node_modules/pi-web-access/page-query.ts +6 -9
  165. package/node_modules/pi-web-access/parallel-mcp.ts +2 -0
  166. package/node_modules/pi-web-access/query-rewrite.ts +2 -2
  167. package/node_modules/pi-web-access/storage.ts +49 -0
  168. package/node_modules/pi-web-access/summary-review.ts +7 -6
  169. package/node_modules/pi-web-access/utils.ts +21 -6
  170. package/node_modules/pi-web-access/web-tool-core.ts +1 -0
  171. package/package.json +10 -12
  172. package/node_modules/pi-lens/dist/chunk-54B42YRX.js +0 -27
  173. package/node_modules/pi-lens/dist/chunk-CGGAIP7J.js +0 -29
  174. package/node_modules/pi-lens/dist/chunk-HMFXILPV.js +0 -83
  175. package/node_modules/pi-lens/dist/chunk-T6D4Q4AQ.js +0 -54
  176. package/node_modules/pi-web-access/opencode-session-headers.ts +0 -24
  177. package/node_modules/remote-pi/LICENSE +0 -21
  178. package/node_modules/remote-pi/README.md +0 -675
  179. package/node_modules/remote-pi/dist/actions/handlers.d.ts +0 -122
  180. package/node_modules/remote-pi/dist/actions/handlers.js +0 -160
  181. package/node_modules/remote-pi/dist/actions/handlers.js.map +0 -1
  182. package/node_modules/remote-pi/dist/actions/registry.d.ts +0 -39
  183. package/node_modules/remote-pi/dist/actions/registry.js +0 -58
  184. package/node_modules/remote-pi/dist/actions/registry.js.map +0 -1
  185. package/node_modules/remote-pi/dist/bin/supervisord.d.ts +0 -2
  186. package/node_modules/remote-pi/dist/bin/supervisord.js +0 -86
  187. package/node_modules/remote-pi/dist/bin/supervisord.js.map +0 -1
  188. package/node_modules/remote-pi/dist/commands/builtin_mirror.d.ts +0 -58
  189. package/node_modules/remote-pi/dist/commands/builtin_mirror.js +0 -71
  190. package/node_modules/remote-pi/dist/commands/builtin_mirror.js.map +0 -1
  191. package/node_modules/remote-pi/dist/commands/list_commands.d.ts +0 -60
  192. package/node_modules/remote-pi/dist/commands/list_commands.js +0 -73
  193. package/node_modules/remote-pi/dist/commands/list_commands.js.map +0 -1
  194. package/node_modules/remote-pi/dist/config.d.ts +0 -62
  195. package/node_modules/remote-pi/dist/config.js +0 -115
  196. package/node_modules/remote-pi/dist/config.js.map +0 -1
  197. package/node_modules/remote-pi/dist/daemon/client.d.ts +0 -20
  198. package/node_modules/remote-pi/dist/daemon/client.js +0 -131
  199. package/node_modules/remote-pi/dist/daemon/client.js.map +0 -1
  200. package/node_modules/remote-pi/dist/daemon/control_protocol.d.ts +0 -176
  201. package/node_modules/remote-pi/dist/daemon/control_protocol.js +0 -63
  202. package/node_modules/remote-pi/dist/daemon/control_protocol.js.map +0 -1
  203. package/node_modules/remote-pi/dist/daemon/cron_log.d.ts +0 -45
  204. package/node_modules/remote-pi/dist/daemon/cron_log.js +0 -72
  205. package/node_modules/remote-pi/dist/daemon/cron_log.js.map +0 -1
  206. package/node_modules/remote-pi/dist/daemon/cron_registry.d.ts +0 -80
  207. package/node_modules/remote-pi/dist/daemon/cron_registry.js +0 -194
  208. package/node_modules/remote-pi/dist/daemon/cron_registry.js.map +0 -1
  209. package/node_modules/remote-pi/dist/daemon/id.d.ts +0 -24
  210. package/node_modules/remote-pi/dist/daemon/id.js +0 -36
  211. package/node_modules/remote-pi/dist/daemon/id.js.map +0 -1
  212. package/node_modules/remote-pi/dist/daemon/install.d.ts +0 -170
  213. package/node_modules/remote-pi/dist/daemon/install.js +0 -547
  214. package/node_modules/remote-pi/dist/daemon/install.js.map +0 -1
  215. package/node_modules/remote-pi/dist/daemon/registry.d.ts +0 -63
  216. package/node_modules/remote-pi/dist/daemon/registry.js +0 -153
  217. package/node_modules/remote-pi/dist/daemon/registry.js.map +0 -1
  218. package/node_modules/remote-pi/dist/daemon/rpc_child.d.ts +0 -194
  219. package/node_modules/remote-pi/dist/daemon/rpc_child.js +0 -389
  220. package/node_modules/remote-pi/dist/daemon/rpc_child.js.map +0 -1
  221. package/node_modules/remote-pi/dist/daemon/supervisor.d.ts +0 -93
  222. package/node_modules/remote-pi/dist/daemon/supervisor.js +0 -596
  223. package/node_modules/remote-pi/dist/daemon/supervisor.js.map +0 -1
  224. package/node_modules/remote-pi/dist/extension_ui_bridge.d.ts +0 -26
  225. package/node_modules/remote-pi/dist/extension_ui_bridge.js +0 -341
  226. package/node_modules/remote-pi/dist/extension_ui_bridge.js.map +0 -1
  227. package/node_modules/remote-pi/dist/index.d.ts +0 -213
  228. package/node_modules/remote-pi/dist/index.js +0 -4996
  229. package/node_modules/remote-pi/dist/index.js.map +0 -1
  230. package/node_modules/remote-pi/dist/mcp/mesh_result.d.ts +0 -10
  231. package/node_modules/remote-pi/dist/mcp/mesh_result.js +0 -42
  232. package/node_modules/remote-pi/dist/mcp/mesh_result.js.map +0 -1
  233. package/node_modules/remote-pi/dist/mcp/mesh_server.d.ts +0 -16
  234. package/node_modules/remote-pi/dist/mcp/mesh_server.js +0 -327
  235. package/node_modules/remote-pi/dist/mcp/mesh_server.js.map +0 -1
  236. package/node_modules/remote-pi/dist/mesh/canonical.d.ts +0 -30
  237. package/node_modules/remote-pi/dist/mesh/canonical.js +0 -61
  238. package/node_modules/remote-pi/dist/mesh/canonical.js.map +0 -1
  239. package/node_modules/remote-pi/dist/mesh/client.d.ts +0 -18
  240. package/node_modules/remote-pi/dist/mesh/client.js +0 -125
  241. package/node_modules/remote-pi/dist/mesh/client.js.map +0 -1
  242. package/node_modules/remote-pi/dist/mesh/encoding.d.ts +0 -38
  243. package/node_modules/remote-pi/dist/mesh/encoding.js +0 -216
  244. package/node_modules/remote-pi/dist/mesh/encoding.js.map +0 -1
  245. package/node_modules/remote-pi/dist/mesh/self_revoke.d.ts +0 -73
  246. package/node_modules/remote-pi/dist/mesh/self_revoke.js +0 -401
  247. package/node_modules/remote-pi/dist/mesh/self_revoke.js.map +0 -1
  248. package/node_modules/remote-pi/dist/mesh/siblings.d.ts +0 -49
  249. package/node_modules/remote-pi/dist/mesh/siblings.js +0 -159
  250. package/node_modules/remote-pi/dist/mesh/siblings.js.map +0 -1
  251. package/node_modules/remote-pi/dist/mesh/types.d.ts +0 -34
  252. package/node_modules/remote-pi/dist/mesh/types.js +0 -11
  253. package/node_modules/remote-pi/dist/mesh/types.js.map +0 -1
  254. package/node_modules/remote-pi/dist/mesh/verify.d.ts +0 -17
  255. package/node_modules/remote-pi/dist/mesh/verify.js +0 -86
  256. package/node_modules/remote-pi/dist/mesh/verify.js.map +0 -1
  257. package/node_modules/remote-pi/dist/pairing/crypto.d.ts +0 -8
  258. package/node_modules/remote-pi/dist/pairing/crypto.js +0 -22
  259. package/node_modules/remote-pi/dist/pairing/crypto.js.map +0 -1
  260. package/node_modules/remote-pi/dist/pairing/handshake.d.ts +0 -28
  261. package/node_modules/remote-pi/dist/pairing/handshake.js +0 -113
  262. package/node_modules/remote-pi/dist/pairing/handshake.js.map +0 -1
  263. package/node_modules/remote-pi/dist/pairing/noise-sha256.d.ts +0 -16
  264. package/node_modules/remote-pi/dist/pairing/noise-sha256.js +0 -103
  265. package/node_modules/remote-pi/dist/pairing/noise-sha256.js.map +0 -1
  266. package/node_modules/remote-pi/dist/pairing/qr.d.ts +0 -59
  267. package/node_modules/remote-pi/dist/pairing/qr.js +0 -125
  268. package/node_modules/remote-pi/dist/pairing/qr.js.map +0 -1
  269. package/node_modules/remote-pi/dist/pairing/storage.d.ts +0 -120
  270. package/node_modules/remote-pi/dist/pairing/storage.js +0 -604
  271. package/node_modules/remote-pi/dist/pairing/storage.js.map +0 -1
  272. package/node_modules/remote-pi/dist/protocol/codec.d.ts +0 -7
  273. package/node_modules/remote-pi/dist/protocol/codec.js +0 -49
  274. package/node_modules/remote-pi/dist/protocol/codec.js.map +0 -1
  275. package/node_modules/remote-pi/dist/protocol/types.d.ts +0 -393
  276. package/node_modules/remote-pi/dist/protocol/types.js +0 -2
  277. package/node_modules/remote-pi/dist/protocol/types.js.map +0 -1
  278. package/node_modules/remote-pi/dist/rooms.d.ts +0 -29
  279. package/node_modules/remote-pi/dist/rooms.js +0 -57
  280. package/node_modules/remote-pi/dist/rooms.js.map +0 -1
  281. package/node_modules/remote-pi/dist/session/address.d.ts +0 -49
  282. package/node_modules/remote-pi/dist/session/address.js +0 -58
  283. package/node_modules/remote-pi/dist/session/address.js.map +0 -1
  284. package/node_modules/remote-pi/dist/session/agent_bridge.d.ts +0 -55
  285. package/node_modules/remote-pi/dist/session/agent_bridge.js +0 -146
  286. package/node_modules/remote-pi/dist/session/agent_bridge.js.map +0 -1
  287. package/node_modules/remote-pi/dist/session/bridge.d.ts +0 -37
  288. package/node_modules/remote-pi/dist/session/bridge.js +0 -130
  289. package/node_modules/remote-pi/dist/session/bridge.js.map +0 -1
  290. package/node_modules/remote-pi/dist/session/broker.d.ts +0 -189
  291. package/node_modules/remote-pi/dist/session/broker.js +0 -507
  292. package/node_modules/remote-pi/dist/session/broker.js.map +0 -1
  293. package/node_modules/remote-pi/dist/session/broker_remote.d.ts +0 -74
  294. package/node_modules/remote-pi/dist/session/broker_remote.js +0 -583
  295. package/node_modules/remote-pi/dist/session/broker_remote.js.map +0 -1
  296. package/node_modules/remote-pi/dist/session/cwd_lock.d.ts +0 -33
  297. package/node_modules/remote-pi/dist/session/cwd_lock.js +0 -126
  298. package/node_modules/remote-pi/dist/session/cwd_lock.js.map +0 -1
  299. package/node_modules/remote-pi/dist/session/envelope.d.ts +0 -33
  300. package/node_modules/remote-pi/dist/session/envelope.js +0 -117
  301. package/node_modules/remote-pi/dist/session/envelope.js.map +0 -1
  302. package/node_modules/remote-pi/dist/session/global_config.d.ts +0 -33
  303. package/node_modules/remote-pi/dist/session/global_config.js +0 -73
  304. package/node_modules/remote-pi/dist/session/global_config.js.map +0 -1
  305. package/node_modules/remote-pi/dist/session/ipc.d.ts +0 -27
  306. package/node_modules/remote-pi/dist/session/ipc.js +0 -22
  307. package/node_modules/remote-pi/dist/session/ipc.js.map +0 -1
  308. package/node_modules/remote-pi/dist/session/leader_election.d.ts +0 -32
  309. package/node_modules/remote-pi/dist/session/leader_election.js +0 -106
  310. package/node_modules/remote-pi/dist/session/leader_election.js.map +0 -1
  311. package/node_modules/remote-pi/dist/session/local_config.d.ts +0 -55
  312. package/node_modules/remote-pi/dist/session/local_config.js +0 -157
  313. package/node_modules/remote-pi/dist/session/local_config.js.map +0 -1
  314. package/node_modules/remote-pi/dist/session/mesh_message.d.ts +0 -20
  315. package/node_modules/remote-pi/dist/session/mesh_message.js +0 -28
  316. package/node_modules/remote-pi/dist/session/mesh_message.js.map +0 -1
  317. package/node_modules/remote-pi/dist/session/mesh_node.d.ts +0 -116
  318. package/node_modules/remote-pi/dist/session/mesh_node.js +0 -573
  319. package/node_modules/remote-pi/dist/session/mesh_node.js.map +0 -1
  320. package/node_modules/remote-pi/dist/session/peer.d.ts +0 -139
  321. package/node_modules/remote-pi/dist/session/peer.js +0 -451
  322. package/node_modules/remote-pi/dist/session/peer.js.map +0 -1
  323. package/node_modules/remote-pi/dist/session/peer_inventory.d.ts +0 -13
  324. package/node_modules/remote-pi/dist/session/peer_inventory.js +0 -48
  325. package/node_modules/remote-pi/dist/session/peer_inventory.js.map +0 -1
  326. package/node_modules/remote-pi/dist/session/peer_limits.d.ts +0 -9
  327. package/node_modules/remote-pi/dist/session/peer_limits.js +0 -21
  328. package/node_modules/remote-pi/dist/session/peer_limits.js.map +0 -1
  329. package/node_modules/remote-pi/dist/session/setup_wizard.d.ts +0 -39
  330. package/node_modules/remote-pi/dist/session/setup_wizard.js +0 -63
  331. package/node_modules/remote-pi/dist/session/setup_wizard.js.map +0 -1
  332. package/node_modules/remote-pi/dist/session/tool_gate.d.ts +0 -5
  333. package/node_modules/remote-pi/dist/session/tool_gate.js +0 -11
  334. package/node_modules/remote-pi/dist/session/tool_gate.js.map +0 -1
  335. package/node_modules/remote-pi/dist/session/tools.d.ts +0 -24
  336. package/node_modules/remote-pi/dist/session/tools.js +0 -252
  337. package/node_modules/remote-pi/dist/session/tools.js.map +0 -1
  338. package/node_modules/remote-pi/dist/session/wizard.d.ts +0 -13
  339. package/node_modules/remote-pi/dist/session/wizard.js +0 -20
  340. package/node_modules/remote-pi/dist/session/wizard.js.map +0 -1
  341. package/node_modules/remote-pi/dist/settings.d.ts +0 -15
  342. package/node_modules/remote-pi/dist/settings.js +0 -52
  343. package/node_modules/remote-pi/dist/settings.js.map +0 -1
  344. package/node_modules/remote-pi/dist/transport/peer_channel.d.ts +0 -37
  345. package/node_modules/remote-pi/dist/transport/peer_channel.js +0 -98
  346. package/node_modules/remote-pi/dist/transport/peer_channel.js.map +0 -1
  347. package/node_modules/remote-pi/dist/transport/pi_forward_client.d.ts +0 -29
  348. package/node_modules/remote-pi/dist/transport/pi_forward_client.js +0 -62
  349. package/node_modules/remote-pi/dist/transport/pi_forward_client.js.map +0 -1
  350. package/node_modules/remote-pi/dist/transport/relay_client.d.ts +0 -91
  351. package/node_modules/remote-pi/dist/transport/relay_client.js +0 -206
  352. package/node_modules/remote-pi/dist/transport/relay_client.js.map +0 -1
  353. package/node_modules/remote-pi/dist/ui/footer.d.ts +0 -32
  354. package/node_modules/remote-pi/dist/ui/footer.js +0 -34
  355. package/node_modules/remote-pi/dist/ui/footer.js.map +0 -1
  356. package/node_modules/remote-pi/docs/daemon.md +0 -289
  357. package/node_modules/remote-pi/package.json +0 -92
  358. package/node_modules/remote-pi/service-templates/launchd.plist.template +0 -35
  359. package/node_modules/remote-pi/service-templates/systemd.service.template +0 -19
  360. package/node_modules/remote-pi/service-templates/task-launcher.vbs.template +0 -10
  361. package/node_modules/remote-pi/service-templates/task-scheduler.xml.template +0 -38
  362. package/node_modules/remote-pi/skills/agent-network/SKILL.md +0 -310
@@ -3,8 +3,10 @@ import {
3
3
  resolveWebTreeSitterPackageDir
4
4
  } from "./chunk-Z54ZSOBZ.js";
5
5
  import {
6
- EXTENSION_TO_GRAMMAR
7
- } from "./chunk-TGPXLY2J.js";
6
+ EXTENSION_TO_GRAMMAR,
7
+ getUserRuleRoot,
8
+ ruleCorpusFingerprintForCycle
9
+ } from "./chunk-KJCWXUUS.js";
8
10
  import {
9
11
  getPackageRoot,
10
12
  js_yaml_default,
@@ -13,40 +15,41 @@ import {
13
15
  import {
14
16
  assertInstallAllowed,
15
17
  getProjectTrustGeneration
16
- } from "./chunk-NTUJEGDZ.js";
18
+ } from "./chunk-D6YF5HKX.js";
17
19
  import {
18
20
  transientRetryDelayMs
19
- } from "./chunk-WONERJTP.js";
21
+ } from "./chunk-O7HZX7CA.js";
20
22
  import {
21
23
  getProjectIgnoreMatcher,
22
24
  isExcludedDirName
23
- } from "./chunk-VN2AXLEX.js";
25
+ } from "./chunk-T54VJRAD.js";
24
26
  import {
25
27
  notifyUserDegradation
26
- } from "./chunk-DQ2NZ7C4.js";
28
+ } from "./chunk-N2IRDBZI.js";
27
29
  import {
28
30
  writeFileAtomic
29
31
  } from "./chunk-2EECBNC5.js";
30
32
  import {
33
+ compareOrdinal,
31
34
  escapeRegExp,
32
35
  getDegradationLedgerGeneration,
33
36
  incrementDegradationCount,
34
37
  recordDegradation,
35
38
  recordDegradationOnce
36
- } from "./chunk-N3YQJI6O.js";
39
+ } from "./chunk-7ELY2CSM.js";
37
40
  import {
38
41
  createNdjsonLogger,
39
42
  getGlobalPiLensLogDir,
40
43
  getMaxLogSizeMB,
41
44
  isTestMode
42
- } from "./chunk-UK3CMEAL.js";
45
+ } from "./chunk-VSMJK3ZJ.js";
43
46
  import {
44
47
  BoundedFifoMap
45
48
  } from "./chunk-ABBOA7UD.js";
46
49
  import {
47
50
  normalizeFilePath,
48
51
  normalizeLoggedPath
49
- } from "./chunk-Q5U6FMDI.js";
52
+ } from "./chunk-G3RLJYA2.js";
50
53
 
51
54
  // dist/clients/tree-sitter-logger.js
52
55
  import * as path from "node:path";
@@ -118,7 +121,7 @@ function logTreeSitterDiagnostic(entry) {
118
121
 
119
122
  // dist/clients/tree-sitter-client.js
120
123
  import { AsyncLocalStorage } from "node:async_hooks";
121
- import * as crypto2 from "node:crypto";
124
+ import * as crypto3 from "node:crypto";
122
125
  import * as fs5 from "node:fs";
123
126
  import { createRequire as createRequire2 } from "node:module";
124
127
  import * as path4 from "node:path";
@@ -1429,6 +1432,7 @@ function isSqlAlchemyEntityQueryArgument(node, root) {
1429
1432
 
1430
1433
  // dist/clients/tree-sitter-query-loader.js
1431
1434
  import * as fs4 from "node:fs";
1435
+ import * as crypto2 from "node:crypto";
1432
1436
  import * as path3 from "node:path";
1433
1437
 
1434
1438
  // dist/clients/bundled-resource-health.js
@@ -1500,6 +1504,7 @@ function ruleFilesForLanguage(languageId, rootDir = process.cwd()) {
1500
1504
  for (const lang of ruleSourceLanguages(languageId)) {
1501
1505
  for (const dir of [
1502
1506
  path3.join(resolvedRoot, "rules", "tree-sitter-queries", lang),
1507
+ path3.join(getUserRuleRoot(), "tree-sitter-queries", lang),
1503
1508
  path3.join(BUNDLED_QUERIES_ROOT, lang)
1504
1509
  ]) {
1505
1510
  if (!fs4.existsSync(dir))
@@ -1518,6 +1523,67 @@ function ruleFilesForLanguage(languageId, rootDir = process.cwd()) {
1518
1523
  }
1519
1524
  return [...files];
1520
1525
  }
1526
+ function computeRuleFilesFingerprint(ruleFiles) {
1527
+ const hash = crypto2.createHash("sha256");
1528
+ for (const file of [...ruleFiles].sort(compareOrdinal)) {
1529
+ const resolved = path3.resolve(file);
1530
+ if (!fs4.existsSync(resolved))
1531
+ continue;
1532
+ const stat = fs4.statSync(resolved);
1533
+ hash.update(`${file}:${stat.mtimeMs}:${stat.size}`);
1534
+ if (resolved !== BUNDLED_QUERIES_ROOT && !resolved.startsWith(BUNDLED_QUERIES_ROOT + path3.sep)) {
1535
+ hash.update(fs4.readFileSync(resolved));
1536
+ }
1537
+ }
1538
+ return hash.digest("hex").slice(0, 16);
1539
+ }
1540
+ function computeMutableRuleFingerprint(rootDir) {
1541
+ const files = [];
1542
+ for (const queriesDir of [
1543
+ path3.join(path3.resolve(rootDir), "rules", "tree-sitter-queries"),
1544
+ path3.join(getUserRuleRoot(), "tree-sitter-queries")
1545
+ ]) {
1546
+ if (!fs4.existsSync(queriesDir))
1547
+ continue;
1548
+ let languages;
1549
+ try {
1550
+ languages = fs4.readdirSync(queriesDir, { withFileTypes: true });
1551
+ } catch {
1552
+ continue;
1553
+ }
1554
+ for (const language of languages) {
1555
+ if (!language.isDirectory())
1556
+ continue;
1557
+ let names;
1558
+ try {
1559
+ names = fs4.readdirSync(path3.join(queriesDir, language.name));
1560
+ } catch {
1561
+ continue;
1562
+ }
1563
+ for (const name of names) {
1564
+ if (name.endsWith(".yml")) {
1565
+ files.push(path3.join(queriesDir, language.name, name));
1566
+ }
1567
+ }
1568
+ }
1569
+ }
1570
+ const hash = crypto2.createHash("sha256");
1571
+ for (const filePath of files.sort(compareOrdinal)) {
1572
+ hash.update(filePath);
1573
+ hash.update("\0");
1574
+ let content;
1575
+ try {
1576
+ content = fs4.readFileSync(filePath, "utf-8");
1577
+ } catch {
1578
+ hash.update("missing");
1579
+ hash.update("\0");
1580
+ continue;
1581
+ }
1582
+ hash.update(content);
1583
+ hash.update("\0");
1584
+ }
1585
+ return hash.digest("hex").slice(0, 16);
1586
+ }
1521
1587
  function queriesForLanguage(queries, languageId) {
1522
1588
  const enabled = (langId) => (queries.get(langId) ?? []).filter((q) => !isDisabledQueryFilePath(q.filePath));
1523
1589
  return ruleSourceLanguages(languageId).flatMap((langId) => enabled(langId));
@@ -1535,6 +1601,7 @@ var TreeSitterQueryLoader = class {
1535
1601
  queries = /* @__PURE__ */ new Map();
1536
1602
  loaded = false;
1537
1603
  loadedRoot = null;
1604
+ loadedRuleFingerprint = null;
1538
1605
  verbose;
1539
1606
  /**
1540
1607
  * This root's per-file parse failures, remembered across the memoized
@@ -1612,16 +1679,24 @@ var TreeSitterQueryLoader = class {
1612
1679
  /**
1613
1680
  * Load all queries from the rules/tree-sitter-queries directory.
1614
1681
  *
1615
- * Returns the in-memory memo when the same root was already loaded.
1616
- * `force: true` re-reads from disk even then — the memo has no notion of
1617
- * rule-file mtimes, so a caller that KNOWS the files changed (the dispatch
1618
- * runner's RuleCache-miss path: a miss means the rule-file fingerprint
1619
- * moved) must force, or it gets the pre-edit rules back and persists them
1682
+ * Returns the in-memory memo when the same root is already loaded and the
1683
+ * mutable corpus's content fingerprint is unchanged. That fingerprint is
1684
+ * computed at most once per dispatch cycle and reused by every later call
1685
+ * in the cycle (`ruleCorpusFingerprintForCycle`), so routine re-scans and
1686
+ * structural searches do no filesystem work at all on the warm path
1687
+ * (#4212 round 4; rounds 2 and 3 each paid for per-call detection). An edit
1688
+ * made during a cycle is therefore seen by the NEXT cycle — or earlier, by
1689
+ * any `force: true` call, which republishes the fresh value into the cycle.
1690
+ *
1691
+ * `force: true` re-reads from disk regardless — the dispatch runner's
1692
+ * RuleCache-miss path: a miss means the content fingerprint moved, so
1693
+ * without `force` the memo could hand back pre-edit rules to be persisted
1620
1694
  * under the fresh fingerprint (#878).
1621
1695
  */
1622
1696
  async loadQueries(rootDir = process.cwd(), options = {}) {
1623
1697
  const resolvedRoot = path3.resolve(rootDir);
1624
- if (!options.force && this.loaded && this.loadedRoot === resolvedRoot) {
1698
+ const ruleFingerprint = ruleCorpusFingerprintForCycle("tree-sitter", resolvedRoot, computeMutableRuleFingerprint, options.force);
1699
+ if (!options.force && this.loaded && this.loadedRoot === resolvedRoot && this.loadedRuleFingerprint === ruleFingerprint) {
1625
1700
  this.replayQueryParseFailures();
1626
1701
  return this.queries;
1627
1702
  }
@@ -1631,6 +1706,7 @@ var TreeSitterQueryLoader = class {
1631
1706
  const queryDirs = [
1632
1707
  .../* @__PURE__ */ new Set([
1633
1708
  path3.join(resolvedRoot, "rules", "tree-sitter-queries"),
1709
+ path3.join(getUserRuleRoot(), "tree-sitter-queries"),
1634
1710
  resolvePackagePath(import.meta.url, "rules", "tree-sitter-queries")
1635
1711
  ])
1636
1712
  ];
@@ -1649,7 +1725,9 @@ var TreeSitterQueryLoader = class {
1649
1725
  const filePath = path3.join(langDir, file);
1650
1726
  const query = this.parseQueryFile(filePath, languageKey);
1651
1727
  if (query) {
1652
- langQueries.push(query);
1728
+ if (!langQueries.some((existing) => existing.id === query.id)) {
1729
+ langQueries.push(query);
1730
+ }
1653
1731
  }
1654
1732
  }
1655
1733
  if (langQueries.length > 0) {
@@ -1660,6 +1738,7 @@ var TreeSitterQueryLoader = class {
1660
1738
  }
1661
1739
  this.loaded = true;
1662
1740
  this.loadedRoot = resolvedRoot;
1741
+ this.loadedRuleFingerprint = ruleFingerprint;
1663
1742
  this.parseFailuresReplayedGeneration = getDegradationLedgerGeneration();
1664
1743
  return this.queries;
1665
1744
  }
@@ -1945,6 +2024,7 @@ function classifyTreeSitterWasmError(thrown) {
1945
2024
  return WASM_TRAP_MESSAGES.some((trap) => message.includes(trap)) ? "trap" : void 0;
1946
2025
  }
1947
2026
  var WASM_TRAP_BUDGET = 3;
2027
+ var GRAMMAR_TRAP_LATCH_THRESHOLD = WASM_TRAP_BUDGET - 1;
1948
2028
  var RESOLUTION_ERROR_CODES = /* @__PURE__ */ new Set([
1949
2029
  "ERR_MODULE_NOT_FOUND",
1950
2030
  "MODULE_NOT_FOUND",
@@ -2127,6 +2207,12 @@ var TreeSitterClient = class _TreeSitterClient {
2127
2207
  queryCache = new BoundedFifoMap(_TreeSitterClient.QUERY_CACHE_MAX_ENTRIES);
2128
2208
  /** Combined multi-rule queries by language + rule-set identity (null = don't retry). */
2129
2209
  queryBatchCache = new BoundedFifoMap(_TreeSitterClient.QUERY_BATCH_CACHE_MAX_ENTRIES);
2210
+ /** Concurrent callers share one native batch build per cache key. */
2211
+ queryBatchBuilds = /* @__PURE__ */ new Map();
2212
+ /** Advances whenever a successful query input heal can invalidate a build. */
2213
+ queryBatchHealEpoch = 0;
2214
+ /** Raw and batch cache keys represented by each bounded entry (#3834). */
2215
+ queryBatchInputs = /* @__PURE__ */ new Map();
2130
2216
  queryCacheCap() {
2131
2217
  const value = Number.parseInt(process.env.PI_LENS_TREE_SITTER_QUERY_CACHE_CAP ?? "", 10);
2132
2218
  return Number.isSafeInteger(value) && value > 0 ? value : _TreeSitterClient.QUERY_CACHE_MAX_ENTRIES;
@@ -2143,12 +2229,63 @@ var TreeSitterClient = class _TreeSitterClient {
2143
2229
  for (const [, dropped] of evicted)
2144
2230
  dropped?.query?.delete?.();
2145
2231
  }
2146
- cacheQueryBatch(key, value) {
2232
+ cacheQueryBatch(key, value, inputKeys = []) {
2233
+ const replaced = this.queryBatchCache.get(key);
2147
2234
  this.queryBatchCache.delete(key);
2235
+ if (replaced)
2236
+ this.retireQueryBatch(replaced);
2148
2237
  const evicted = this.queryBatchCache.setMaxEntries(this.queryBatchCacheCap());
2149
2238
  evicted.push(...this.queryBatchCache.set(key, value));
2239
+ for (const [evictedKey] of evicted)
2240
+ this.queryBatchInputs.delete(evictedKey);
2241
+ this.queryBatchInputs.set(key, new Set(inputKeys));
2150
2242
  for (const [, dropped] of evicted)
2151
- dropped?.query?.delete?.();
2243
+ this.retireQueryBatch(dropped);
2244
+ }
2245
+ disposeQueryBatch(batch) {
2246
+ if (batch.disposed)
2247
+ return;
2248
+ batch.disposed = true;
2249
+ batch.query?.delete?.();
2250
+ }
2251
+ retireQueryBatch(batch) {
2252
+ if (!batch)
2253
+ return;
2254
+ batch.retired = true;
2255
+ if (batch.users === 0) {
2256
+ this.disposeQueryBatch(batch);
2257
+ } else {
2258
+ incrementDegradationCount({
2259
+ kind: "wasm-query-batch-disposal-deferred",
2260
+ subject: "web-tree-sitter",
2261
+ reason: "deferred batch disposal while a scan is active"
2262
+ });
2263
+ }
2264
+ }
2265
+ retainQueryBatch(batch) {
2266
+ batch.users++;
2267
+ }
2268
+ releaseQueryBatch(batch) {
2269
+ batch.users--;
2270
+ if (batch.retired && batch.users === 0)
2271
+ this.disposeQueryBatch(batch);
2272
+ }
2273
+ /**
2274
+ * Move the leases counted at join onto the batch they were built for, and
2275
+ * mark the build decided (#4207 F9). Runs in the same synchronous section
2276
+ * that publishes the batch, so a batch is never visible to a heal without
2277
+ * its consumers' leases: the heal then defers disposal to the last release
2278
+ * instead of deleting the native Query under scans that are about to run it
2279
+ * and silently report zero findings. A later joiner reads `lease.batch` and
2280
+ * retains directly, because the counter is drained.
2281
+ */
2282
+ takeQueryBatchLeases(lease, batch) {
2283
+ lease.batch = batch;
2284
+ if (!batch)
2285
+ return null;
2286
+ batch.users += lease.count;
2287
+ lease.count = 0;
2288
+ return batch;
2152
2289
  }
2153
2290
  /** Consecutive grammar-load failures per batch key — bounds load retries (#889). */
2154
2291
  queryBatchLoadFailures = /* @__PURE__ */ new Map();
@@ -2170,6 +2307,13 @@ var TreeSitterClient = class _TreeSitterClient {
2170
2307
  * a trap that spends budget (or escalates) adds an entry, so the map never
2171
2308
  * holds more than `WASM_TRAP_BUDGET + 1`. */
2172
2309
  trappedInputs = /* @__PURE__ */ new Map();
2310
+ /** Distinct input keys that trapped (first trap) and have not healed, by
2311
+ * language. Process-lifetime. A key enters only on a trap, a first trap
2312
+ * spends budget, and the budget aborts the process after `WASM_TRAP_BUDGET + 1`
2313
+ * of them, so at most that many keys exist across all languages. */
2314
+ grammarTrapInputs = /* @__PURE__ */ new Map();
2315
+ /** Grammars retired for the process after repeated scanner traps. */
2316
+ retiredGrammars = /* @__PURE__ */ new Map();
2173
2317
  /** The input `parseFileAndUse` is consuming. That region is synchronous, so
2174
2318
  * a report nested in it (the extractor's `queryMatches`) is charged to it. */
2175
2319
  activeWasmInput;
@@ -2217,6 +2361,7 @@ var TreeSitterClient = class _TreeSitterClient {
2217
2361
  }
2218
2362
  if (input) {
2219
2363
  const key = this.wasmInputKey(input);
2364
+ this.countGrammarTrapInput(input.languageId, key);
2220
2365
  const entry = this.trappedInputs.get(key);
2221
2366
  if (entry) {
2222
2367
  entry.traps++;
@@ -2227,7 +2372,11 @@ var TreeSitterClient = class _TreeSitterClient {
2227
2372
  });
2228
2373
  return false;
2229
2374
  }
2230
- this.trappedInputs.set(key, { traps: 1, by: input.caller });
2375
+ this.trappedInputs.set(key, {
2376
+ traps: 1,
2377
+ by: input.caller,
2378
+ source: input.languageId === "query" ? input.source : void 0
2379
+ });
2231
2380
  }
2232
2381
  if (++this.wasmTraps <= WASM_TRAP_BUDGET) {
2233
2382
  incrementDegradationCount({
@@ -2251,8 +2400,29 @@ var TreeSitterClient = class _TreeSitterClient {
2251
2400
  }
2252
2401
  return true;
2253
2402
  }
2403
+ /**
2404
+ * Count `key` as a distinct trapping input of `languageId`'s grammar and
2405
+ * retire the grammar at {@link GRAMMAR_TRAP_LATCH_THRESHOLD} of them (#4010).
2406
+ * The first trap of an input is what counts: most surfaces parse fresh bytes
2407
+ * per edit, so waiting for a retry would let distinct bad files spend the
2408
+ * whole budget first. A repeat trap of one input adds nothing (set), and
2409
+ * `clearWasmInput` removes the key when the trapper's own parse succeeds.
2410
+ */
2411
+ countGrammarTrapInput(languageId, key) {
2412
+ const grammarFile = LANGUAGE_TO_GRAMMAR[languageId];
2413
+ if (!grammarFile)
2414
+ return;
2415
+ let inputs = this.grammarTrapInputs.get(languageId);
2416
+ if (!inputs)
2417
+ this.grammarTrapInputs.set(languageId, inputs = /* @__PURE__ */ new Set());
2418
+ inputs.add(key);
2419
+ if (inputs.size >= GRAMMAR_TRAP_LATCH_THRESHOLD) {
2420
+ this.retiredGrammars.set(languageId, grammarFile);
2421
+ this.recordGrammarBlocked(grammarFile);
2422
+ }
2423
+ }
2254
2424
  wasmInputKey(input) {
2255
- input.key ??= crypto2.createHash("sha256").update(input.languageId).update("\0").update(input.source).digest("hex");
2425
+ input.key ??= crypto3.createHash("sha256").update(input.languageId).update("\0").update(input.source).digest("hex");
2256
2426
  return input.key;
2257
2427
  }
2258
2428
  /** Traps charged to `input` so far; no hash while nothing has trapped. */
@@ -2270,12 +2440,25 @@ var TreeSitterClient = class _TreeSitterClient {
2270
2440
  * Only a success by the entry's first trapper decays it (#3678 F2, F4): a
2271
2441
  * healthy consumer says nothing about another consumer's trap.
2272
2442
  */
2273
- clearWasmInput(input) {
2443
+ clearWasmInput(input, internalBatchHeal = false) {
2274
2444
  if (!input || this.trappedInputs.size === 0)
2275
2445
  return;
2276
2446
  const key = this.wasmInputKey(input);
2277
- if (this.trappedInputs.get(key)?.by === input.caller) {
2447
+ const entry = this.trappedInputs.get(key);
2448
+ const source = entry?.source;
2449
+ if (entry?.by === input.caller) {
2278
2450
  this.trappedInputs.delete(key);
2451
+ this.grammarTrapInputs.get(input.languageId)?.delete(key);
2452
+ if (!internalBatchHeal)
2453
+ this.queryBatchHealEpoch++;
2454
+ for (const [batchKey, batch] of this.queryBatchCache) {
2455
+ const inputs = this.queryBatchInputs.get(batchKey);
2456
+ if (!source || !inputs?.has(source))
2457
+ continue;
2458
+ this.queryBatchCache.delete(batchKey);
2459
+ this.queryBatchInputs.delete(batchKey);
2460
+ this.retireQueryBatch(batch);
2461
+ }
2279
2462
  }
2280
2463
  }
2281
2464
  /** The not-parsed outcome for `thrown` on `input` (#3605). */
@@ -2519,6 +2702,16 @@ var TreeSitterClient = class _TreeSitterClient {
2519
2702
  this.grammarLastNotifiedDelayMs.clear();
2520
2703
  this.poisonedGrammarPaths.clear();
2521
2704
  this.staleReportedGrammarPaths.clear();
2705
+ for (const grammarFile of this.retiredGrammars.values()) {
2706
+ this.recordGrammarBlocked(grammarFile);
2707
+ }
2708
+ }
2709
+ recordGrammarBlocked(grammarFile) {
2710
+ recordDegradationOnce({
2711
+ kind: "grammar-blocked",
2712
+ subject: grammarFile,
2713
+ reason: `grammar retired after ${GRAMMAR_TRAP_LATCH_THRESHOLD} distinct WASM traps; structural analysis is unavailable for this language until restart`
2714
+ });
2522
2715
  }
2523
2716
  /**
2524
2717
  * Log + record a grammar file on disk that isn't a wasm module, once per
@@ -2942,12 +3135,15 @@ var TreeSitterClient = class _TreeSitterClient {
2942
3135
  */
2943
3136
  resetLoadStateForSession() {
2944
3137
  this.webTreeSitterLoadFailed = false;
3138
+ this.refreshGrammarSessionLatches();
2945
3139
  }
2946
3140
  /** Load language grammar */
2947
3141
  async loadLanguage(languageId) {
2948
3142
  if (this.wasmAborted)
2949
3143
  return null;
2950
3144
  this.dbg(`Loading language: ${languageId}`);
3145
+ if (this.retiredGrammars.has(languageId))
3146
+ return null;
2951
3147
  if (this.languages.has(languageId)) {
2952
3148
  this.dbg(`Language ${languageId} already loaded`);
2953
3149
  return this.languages.get(languageId);
@@ -3151,7 +3347,7 @@ var TreeSitterClient = class _TreeSitterClient {
3151
3347
  }
3152
3348
  /** Get loaded language for symbol extraction */
3153
3349
  getLanguage(languageId) {
3154
- if (this.wasmAborted)
3350
+ if (this.wasmAborted || this.retiredGrammars.has(languageId))
3155
3351
  return null;
3156
3352
  return this.languages.get(languageId) || null;
3157
3353
  }
@@ -3234,7 +3430,7 @@ var TreeSitterClient = class _TreeSitterClient {
3234
3430
  return [];
3235
3431
  }
3236
3432
  const maxResults = options.maxResults ?? 50;
3237
- const batch = await this.compileQueryBatch(queryDefs, languageId);
3433
+ const batch = await this.compileQueryBatch(queryDefs, languageId, true);
3238
3434
  if (!batch) {
3239
3435
  const results2 = [];
3240
3436
  for (const queryDef of queryDefs) {
@@ -3296,7 +3492,7 @@ var TreeSitterClient = class _TreeSitterClient {
3296
3492
  // #3678 F4: the scanner and the dispatch runner run different rule
3297
3493
  // sets under this one call site.
3298
3494
  `runQueriesOnFile\0${batch.key}`
3299
- );
3495
+ ).finally(() => this.releaseQueryBatch(batch));
3300
3496
  const results = [];
3301
3497
  for (let i = 0; i < batch.entries.length; i++) {
3302
3498
  for (const match of perQuery.get(i) ?? []) {
@@ -3309,26 +3505,65 @@ var TreeSitterClient = class _TreeSitterClient {
3309
3505
  * Compile `queryDefs` into one multi-pattern Query for `languageId`, with a
3310
3506
  * pattern-index → rule map. Cached per language + rule-set identity.
3311
3507
  */
3312
- async compileQueryBatch(queryDefs, languageId) {
3313
- const identity = crypto2.createHash("sha256").update(JSON.stringify(queryDefs)).digest("hex");
3508
+ async compileQueryBatch(queryDefs, languageId, retain = false) {
3509
+ const identity = crypto3.createHash("sha256").update(JSON.stringify(queryDefs)).digest("hex");
3314
3510
  const cacheKey = this.getQueryCacheKey(`batch:${identity}`, languageId);
3315
3511
  const cached = this.queryBatchCache.get(cacheKey);
3316
3512
  if (cached !== void 0) {
3317
3513
  this.queryBatchCache.delete(cacheKey);
3318
3514
  this.queryBatchCache.set(cacheKey, cached);
3515
+ if (retain && cached)
3516
+ this.retainQueryBatch(cached);
3319
3517
  return cached;
3320
3518
  }
3519
+ const inFlight = this.queryBatchBuilds.get(cacheKey);
3520
+ if (inFlight) {
3521
+ if (retain) {
3522
+ const decided = inFlight.lease.batch;
3523
+ if (decided === void 0)
3524
+ inFlight.lease.count++;
3525
+ else if (decided)
3526
+ this.retainQueryBatch(decided);
3527
+ }
3528
+ return inFlight.promise;
3529
+ }
3530
+ const lease = { count: retain ? 1 : 0, batch: void 0 };
3531
+ const promise = this.compileQueryBatchOnce(queryDefs, languageId, lease);
3532
+ const build = { promise, lease };
3533
+ this.queryBatchBuilds.set(cacheKey, build);
3534
+ try {
3535
+ return await promise;
3536
+ } finally {
3537
+ if (this.queryBatchBuilds.get(cacheKey) === build) {
3538
+ this.queryBatchBuilds.delete(cacheKey);
3539
+ }
3540
+ }
3541
+ }
3542
+ async compileQueryBatchOnce(queryDefs, languageId, lease) {
3543
+ const identity = crypto3.createHash("sha256").update(JSON.stringify(queryDefs)).digest("hex");
3544
+ const cacheKey = this.getQueryCacheKey(`batch:${identity}`, languageId);
3545
+ const inputKeys = [
3546
+ cacheKey,
3547
+ ...queryDefs.map((queryDef) => this.getQueryCacheKey(`raw:${queryDef.id}:${queryDef.query}`, languageId))
3548
+ ];
3549
+ const cached = this.queryBatchCache.get(cacheKey);
3550
+ if (cached !== void 0) {
3551
+ this.queryBatchCache.delete(cacheKey);
3552
+ this.queryBatchCache.set(cacheKey, cached);
3553
+ return this.takeQueryBatchLeases(lease, cached);
3554
+ }
3555
+ const healEpoch = this.queryBatchHealEpoch;
3321
3556
  const language = await this.loadLanguage(languageId);
3322
3557
  if (!language) {
3323
3558
  const failures = (this.queryBatchLoadFailures.get(cacheKey) ?? 0) + 1;
3324
3559
  if (failures >= QUERY_BATCH_MAX_LOAD_FAILURES) {
3325
3560
  this.dbg(`Batch: grammar for ${languageId} failed to load ${failures} times \u2014 caching miss`);
3326
3561
  this.queryBatchLoadFailures.delete(cacheKey);
3327
- this.cacheQueryBatch(cacheKey, null);
3562
+ this.cacheQueryBatch(cacheKey, null, inputKeys);
3328
3563
  } else {
3329
3564
  this.queryBatchLoadFailures.set(cacheKey, failures);
3330
3565
  }
3331
- return null;
3566
+ return this.takeQueryBatchLeases(lease, null);
3332
3567
  }
3333
3568
  this.queryBatchLoadFailures.delete(cacheKey);
3334
3569
  let trapped = false;
@@ -3351,7 +3586,7 @@ var TreeSitterClient = class _TreeSitterClient {
3351
3586
  const probe = new Query(language, queryDef.query);
3352
3587
  patternCount = probe.patternCount();
3353
3588
  probe.delete?.();
3354
- this.clearWasmInput(probeInput);
3589
+ this.clearWasmInput(probeInput, true);
3355
3590
  } catch (err) {
3356
3591
  if (this.reportWasmAbort(err, probeInput))
3357
3592
  return null;
@@ -3380,8 +3615,16 @@ var TreeSitterClient = class _TreeSitterClient {
3380
3615
  this.dbg(`Batch pattern count mismatch for ${languageId} (${query.patternCount()} vs ${ownerOfPattern.length}) \u2014 falling back`);
3381
3616
  return null;
3382
3617
  }
3383
- this.clearWasmInput(batchInput);
3384
- return { query, entries, ownerOfPattern, key: cacheKey };
3618
+ this.clearWasmInput(batchInput, true);
3619
+ return {
3620
+ query,
3621
+ entries,
3622
+ ownerOfPattern,
3623
+ key: cacheKey,
3624
+ users: 0,
3625
+ retired: false,
3626
+ disposed: false
3627
+ };
3385
3628
  } catch (err) {
3386
3629
  if (this.reportWasmAbort(err, batchInput))
3387
3630
  return null;
@@ -3392,8 +3635,13 @@ var TreeSitterClient = class _TreeSitterClient {
3392
3635
  }
3393
3636
  };
3394
3637
  const batch = await build();
3395
- if (!trapped)
3396
- this.cacheQueryBatch(cacheKey, batch);
3638
+ const published = !trapped && this.queryBatchHealEpoch === healEpoch;
3639
+ this.takeQueryBatchLeases(lease, batch);
3640
+ if (published) {
3641
+ this.cacheQueryBatch(cacheKey, batch, inputKeys);
3642
+ } else {
3643
+ this.retireQueryBatch(batch);
3644
+ }
3397
3645
  return batch;
3398
3646
  }
3399
3647
  /**
@@ -5544,6 +5792,7 @@ export {
5544
5792
  getBundledQueriesRootHealth,
5545
5793
  ruleSourceLanguages,
5546
5794
  ruleFilesForLanguage,
5795
+ computeRuleFilesFingerprint,
5547
5796
  queriesForLanguage,
5548
5797
  isDisabledQueryFilePath,
5549
5798
  queryLoader,
@@ -4,7 +4,7 @@ import {
4
4
  } from "./chunk-ABBOA7UD.js";
5
5
  import {
6
6
  normalizeMapKey
7
- } from "./chunk-Q5U6FMDI.js";
7
+ } from "./chunk-G3RLJYA2.js";
8
8
 
9
9
  // dist/clients/dispatch/fact-store.js
10
10
  var capacityEvictionReporter;
@@ -3,31 +3,31 @@ import {
3
3
  shouldRecurseIntoDir,
4
4
  walkTreeRecursiveSync,
5
5
  walkTreeStackAsync
6
- } from "./chunk-VHQLPIRJ.js";
6
+ } from "./chunk-H5EV3VMF.js";
7
7
  import {
8
8
  getProjectIgnoreMatcher
9
- } from "./chunk-VN2AXLEX.js";
9
+ } from "./chunk-T54VJRAD.js";
10
10
  import {
11
11
  KIND_EXTENSIONS,
12
12
  isCodeKindFile
13
- } from "./chunk-5ZEJHV35.js";
13
+ } from "./chunk-64LU2OVH.js";
14
14
  import {
15
15
  classifyGeneratedOrArtifactDetailed,
16
16
  isDeclarationFile
17
- } from "./chunk-DQ2NZ7C4.js";
17
+ } from "./chunk-N2IRDBZI.js";
18
18
  import {
19
19
  logLatency
20
- } from "./chunk-5THXD6X5.js";
20
+ } from "./chunk-3PNFWVHT.js";
21
21
  import {
22
22
  toPositiveFinite
23
- } from "./chunk-UK3CMEAL.js";
23
+ } from "./chunk-VSMJK3ZJ.js";
24
24
  import {
25
25
  BoundedLruCache
26
26
  } from "./chunk-ABBOA7UD.js";
27
27
  import {
28
28
  normalizeEphemeralMapKey,
29
29
  normalizeFilePath
30
- } from "./chunk-Q5U6FMDI.js";
30
+ } from "./chunk-G3RLJYA2.js";
31
31
 
32
32
  // dist/clients/source-filter.js
33
33
  import * as fs2 from "node:fs";