@ashx-j/lunr-dev 0.2.13-dev.7.1 → 0.2.16-dev.9.1

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 (384) hide show
  1. package/CHANGELOG.md +29 -1
  2. package/dist/builtin-extensions/ashxj-tui.d.ts +14 -0
  3. package/dist/builtin-extensions/ashxj-tui.d.ts.map +1 -1
  4. package/dist/builtin-extensions/ashxj-tui.js +37 -3
  5. package/dist/builtin-extensions/ashxj-tui.js.map +1 -1
  6. package/dist/builtin-extensions/index.d.ts +1 -15
  7. package/dist/builtin-extensions/index.d.ts.map +1 -1
  8. package/dist/builtin-extensions/index.js +7 -21
  9. package/dist/builtin-extensions/index.js.map +1 -1
  10. package/dist/builtin-extensions/narumiruna-pi-goal/src/goal.d.ts.map +1 -1
  11. package/dist/builtin-extensions/narumiruna-pi-goal/src/goal.js +6 -2
  12. package/dist/builtin-extensions/narumiruna-pi-goal/src/goal.js.map +1 -1
  13. package/dist/builtin-extensions/pi-lsp-extension/src/index.d.ts +4 -0
  14. package/dist/builtin-extensions/pi-lsp-extension/src/index.d.ts.map +1 -1
  15. package/dist/builtin-extensions/pi-lsp-extension/src/index.js +163 -169
  16. package/dist/builtin-extensions/pi-lsp-extension/src/index.js.map +1 -1
  17. package/dist/builtin-extensions/pi-lsp-extension/src/runtime.d.ts +46 -0
  18. package/dist/builtin-extensions/pi-lsp-extension/src/runtime.d.ts.map +1 -0
  19. package/dist/builtin-extensions/pi-lsp-extension/src/runtime.js +109 -0
  20. package/dist/builtin-extensions/pi-lsp-extension/src/runtime.js.map +1 -0
  21. package/dist/builtin-extensions/pi-mcp-adapter/direct-tool-executor.d.ts +7 -0
  22. package/dist/builtin-extensions/pi-mcp-adapter/direct-tool-executor.d.ts.map +1 -0
  23. package/dist/builtin-extensions/pi-mcp-adapter/direct-tool-executor.js +211 -0
  24. package/dist/builtin-extensions/pi-mcp-adapter/direct-tool-executor.js.map +1 -0
  25. package/dist/builtin-extensions/pi-mcp-adapter/direct-tools.d.ts +0 -5
  26. package/dist/builtin-extensions/pi-mcp-adapter/direct-tools.d.ts.map +1 -1
  27. package/dist/builtin-extensions/pi-mcp-adapter/direct-tools.js +0 -202
  28. package/dist/builtin-extensions/pi-mcp-adapter/direct-tools.js.map +1 -1
  29. package/dist/builtin-extensions/pi-mcp-adapter/index.d.ts.map +1 -1
  30. package/dist/builtin-extensions/pi-mcp-adapter/index.js +251 -94
  31. package/dist/builtin-extensions/pi-mcp-adapter/index.js.map +1 -1
  32. package/dist/builtin-extensions/pi-mcp-adapter/init.d.ts +4 -1
  33. package/dist/builtin-extensions/pi-mcp-adapter/init.d.ts.map +1 -1
  34. package/dist/builtin-extensions/pi-mcp-adapter/init.js +10 -3
  35. package/dist/builtin-extensions/pi-mcp-adapter/init.js.map +1 -1
  36. package/dist/builtin-extensions/pi-mcp-adapter/metadata-cache.d.ts.map +1 -1
  37. package/dist/builtin-extensions/pi-mcp-adapter/metadata-cache.js +6 -1
  38. package/dist/builtin-extensions/pi-mcp-adapter/metadata-cache.js.map +1 -1
  39. package/dist/builtin-extensions/pi-prompt-template-model/prompt-loader.d.ts.map +1 -1
  40. package/dist/builtin-extensions/pi-prompt-template-model/prompt-loader.js +2 -1
  41. package/dist/builtin-extensions/pi-prompt-template-model/prompt-loader.js.map +1 -1
  42. package/dist/builtin-extensions/pi-prompt-template-model/tool-manager.d.ts +1 -1
  43. package/dist/builtin-extensions/pi-prompt-template-model/tool-manager.d.ts.map +1 -1
  44. package/dist/builtin-extensions/pi-prompt-template-model/tool-manager.js +1 -1
  45. package/dist/builtin-extensions/pi-prompt-template-model/tool-manager.js.map +1 -1
  46. package/dist/builtin-extensions/pi-subagents/src/extension/index.d.ts +1 -1
  47. package/dist/builtin-extensions/pi-subagents/src/extension/index.d.ts.map +1 -1
  48. package/dist/builtin-extensions/pi-subagents/src/extension/index.js +38 -14
  49. package/dist/builtin-extensions/pi-subagents/src/extension/index.js.map +1 -1
  50. package/dist/builtin-extensions/pi-subagents/src/shared/fork-context.d.ts.map +1 -1
  51. package/dist/builtin-extensions/pi-subagents/src/shared/fork-context.js +1 -1
  52. package/dist/builtin-extensions/pi-subagents/src/shared/fork-context.js.map +1 -1
  53. package/dist/builtin-extensions/pi-subagents/src/slash/slash-commands.d.ts +1 -1
  54. package/dist/builtin-extensions/pi-subagents/src/slash/slash-commands.d.ts.map +1 -1
  55. package/dist/builtin-extensions/pi-subagents/src/slash/slash-commands.js +1 -1
  56. package/dist/builtin-extensions/pi-subagents/src/slash/slash-commands.js.map +1 -1
  57. package/dist/builtin-extensions/pi-subagents/src/tui/render.d.ts +1 -1
  58. package/dist/builtin-extensions/pi-subagents/src/tui/render.d.ts.map +1 -1
  59. package/dist/builtin-extensions/pi-subagents/src/tui/render.js +2 -1
  60. package/dist/builtin-extensions/pi-subagents/src/tui/render.js.map +1 -1
  61. package/dist/builtin-extensions/pi-subagents/src/watchdog/review.d.ts +1 -1
  62. package/dist/builtin-extensions/pi-subagents/src/watchdog/review.d.ts.map +1 -1
  63. package/dist/builtin-extensions/pi-subagents/src/watchdog/review.js +2 -1
  64. package/dist/builtin-extensions/pi-subagents/src/watchdog/review.js.map +1 -1
  65. package/dist/builtin-extensions/pi-web-access/extract.d.ts.map +1 -1
  66. package/dist/builtin-extensions/pi-web-access/extract.js +105 -54
  67. package/dist/builtin-extensions/pi-web-access/extract.js.map +1 -1
  68. package/dist/builtin-extensions/pi-web-access/gemini-search.d.ts +1 -1
  69. package/dist/builtin-extensions/pi-web-access/gemini-search.d.ts.map +1 -1
  70. package/dist/builtin-extensions/pi-web-access/gemini-search.js +82 -65
  71. package/dist/builtin-extensions/pi-web-access/gemini-search.js.map +1 -1
  72. package/dist/builtin-extensions/pi-web-access/github-extract.d.ts.map +1 -1
  73. package/dist/builtin-extensions/pi-web-access/github-extract.js +2 -0
  74. package/dist/builtin-extensions/pi-web-access/github-extract.js.map +1 -1
  75. package/dist/builtin-extensions/pi-web-access/index.d.ts.map +1 -1
  76. package/dist/builtin-extensions/pi-web-access/index.js +167 -77
  77. package/dist/builtin-extensions/pi-web-access/index.js.map +1 -1
  78. package/dist/builtin-extensions/pi-web-access/lazy.d.ts +18 -0
  79. package/dist/builtin-extensions/pi-web-access/lazy.d.ts.map +1 -0
  80. package/dist/builtin-extensions/pi-web-access/lazy.js +19 -0
  81. package/dist/builtin-extensions/pi-web-access/lazy.js.map +1 -0
  82. package/dist/builtin-extensions/pi-web-access/session-cleanup.d.ts +6 -0
  83. package/dist/builtin-extensions/pi-web-access/session-cleanup.d.ts.map +1 -0
  84. package/dist/builtin-extensions/pi-web-access/session-cleanup.js +17 -0
  85. package/dist/builtin-extensions/pi-web-access/session-cleanup.js.map +1 -0
  86. package/dist/catalog/models.json +1 -1
  87. package/dist/catalog/providers/amazon-bedrock.json +1 -1
  88. package/dist/catalog/providers/azure-openai-responses.json +1 -1
  89. package/dist/catalog/providers/fireworks.json +1 -1
  90. package/dist/catalog/providers/github-copilot.json +1 -1
  91. package/dist/catalog/providers/openai-codex.json +1 -1
  92. package/dist/catalog/providers/openai.json +1 -1
  93. package/dist/catalog/providers/opencode.json +1 -1
  94. package/dist/catalog/providers/openrouter.json +1 -1
  95. package/dist/catalog/providers/vercel-ai-gateway.json +1 -1
  96. package/dist/catalog/publication.json +131 -3
  97. package/dist/cli/list-models.d.ts.map +1 -1
  98. package/dist/cli/list-models.js +1 -0
  99. package/dist/cli/list-models.js.map +1 -1
  100. package/dist/cli-runtime.d.ts +3 -0
  101. package/dist/cli-runtime.d.ts.map +1 -0
  102. package/dist/cli-runtime.js +73 -0
  103. package/dist/cli-runtime.js.map +1 -0
  104. package/dist/cli.d.ts.map +1 -1
  105. package/dist/cli.js +14 -53
  106. package/dist/cli.js.map +1 -1
  107. package/dist/config.d.ts +1 -0
  108. package/dist/config.d.ts.map +1 -1
  109. package/dist/config.js +1 -0
  110. package/dist/config.js.map +1 -1
  111. package/dist/core/agent-session.d.ts +3 -0
  112. package/dist/core/agent-session.d.ts.map +1 -1
  113. package/dist/core/agent-session.js +56 -12
  114. package/dist/core/agent-session.js.map +1 -1
  115. package/dist/core/catalog-cache-scope.d.ts +3 -0
  116. package/dist/core/catalog-cache-scope.d.ts.map +1 -0
  117. package/dist/core/catalog-cache-scope.js +12 -0
  118. package/dist/core/catalog-cache-scope.js.map +1 -0
  119. package/dist/core/catalog-merge.d.ts +2 -0
  120. package/dist/core/catalog-merge.d.ts.map +1 -1
  121. package/dist/core/catalog-merge.js +29 -2
  122. package/dist/core/catalog-merge.js.map +1 -1
  123. package/dist/core/catalog-refresh-polling.d.ts +8 -0
  124. package/dist/core/catalog-refresh-polling.d.ts.map +1 -0
  125. package/dist/core/catalog-refresh-polling.js +30 -0
  126. package/dist/core/catalog-refresh-polling.js.map +1 -0
  127. package/dist/core/codex-catalog.d.ts +3 -0
  128. package/dist/core/codex-catalog.d.ts.map +1 -0
  129. package/dist/core/codex-catalog.js +15 -0
  130. package/dist/core/codex-catalog.js.map +1 -0
  131. package/dist/core/compaction/compaction.d.ts.map +1 -1
  132. package/dist/core/compaction/compaction.js +10 -5
  133. package/dist/core/compaction/compaction.js.map +1 -1
  134. package/dist/core/extensions/host-static.d.ts.map +1 -1
  135. package/dist/core/extensions/host-static.js +34 -12
  136. package/dist/core/extensions/host-static.js.map +1 -1
  137. package/dist/core/extensions/loader.d.ts +1 -2
  138. package/dist/core/extensions/loader.d.ts.map +1 -1
  139. package/dist/core/extensions/loader.js +10 -64
  140. package/dist/core/extensions/loader.js.map +1 -1
  141. package/dist/core/extensions/types.d.ts +2 -2
  142. package/dist/core/extensions/types.d.ts.map +1 -1
  143. package/dist/core/extensions/types.js.map +1 -1
  144. package/dist/core/footer-data-provider.d.ts.map +1 -1
  145. package/dist/core/footer-data-provider.js +2 -0
  146. package/dist/core/footer-data-provider.js.map +1 -1
  147. package/dist/core/live-catalog.d.ts +5 -2
  148. package/dist/core/live-catalog.d.ts.map +1 -1
  149. package/dist/core/live-catalog.js +108 -27
  150. package/dist/core/live-catalog.js.map +1 -1
  151. package/dist/core/model-runtime.d.ts +8 -0
  152. package/dist/core/model-runtime.d.ts.map +1 -1
  153. package/dist/core/model-runtime.js +64 -12
  154. package/dist/core/model-runtime.js.map +1 -1
  155. package/dist/core/official-catalog.d.ts +4 -0
  156. package/dist/core/official-catalog.d.ts.map +1 -1
  157. package/dist/core/official-catalog.js +86 -21
  158. package/dist/core/official-catalog.js.map +1 -1
  159. package/dist/core/permissions.d.ts +0 -2
  160. package/dist/core/permissions.d.ts.map +1 -1
  161. package/dist/core/permissions.js +10 -18
  162. package/dist/core/permissions.js.map +1 -1
  163. package/dist/core/sdk.d.ts +1 -1
  164. package/dist/core/sdk.d.ts.map +1 -1
  165. package/dist/core/sdk.js +1 -1
  166. package/dist/core/sdk.js.map +1 -1
  167. package/dist/core/slash-commands.d.ts.map +1 -1
  168. package/dist/core/slash-commands.js +0 -1
  169. package/dist/core/slash-commands.js.map +1 -1
  170. package/dist/core/timings.d.ts +2 -1
  171. package/dist/core/timings.d.ts.map +1 -1
  172. package/dist/core/timings.js +17 -2
  173. package/dist/core/timings.js.map +1 -1
  174. package/dist/gateway/commands.d.ts +1 -1
  175. package/dist/gateway/commands.d.ts.map +1 -1
  176. package/dist/gateway/commands.js +1 -18
  177. package/dist/gateway/commands.js.map +1 -1
  178. package/dist/main.d.ts +2 -2
  179. package/dist/main.d.ts.map +1 -1
  180. package/dist/main.js +66 -48
  181. package/dist/main.js.map +1 -1
  182. package/dist/modes/interactive/components/model-selector.d.ts.map +1 -1
  183. package/dist/modes/interactive/components/model-selector.js +4 -1
  184. package/dist/modes/interactive/components/model-selector.js.map +1 -1
  185. package/dist/modes/interactive/interactive-mode.d.ts +13 -22
  186. package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
  187. package/dist/modes/interactive/interactive-mode.js +141 -207
  188. package/dist/modes/interactive/interactive-mode.js.map +1 -1
  189. package/dist/modes/interactive/theme/theme.d.ts.map +1 -1
  190. package/dist/modes/interactive/theme/theme.js +95 -84
  191. package/dist/modes/interactive/theme/theme.js.map +1 -1
  192. package/dist/node-runtime/agent-session-services-IFJMSX7Z.js +36 -0
  193. package/dist/node-runtime/benchmark-request-UC7PD3V3.js +57 -0
  194. package/dist/node-runtime/brave-UWDA3I22.js +143 -0
  195. package/dist/node-runtime/builtin-extensions-LYZ3BFWQ.js +28 -0
  196. package/dist/node-runtime/chunk-2QKLKMKC.js +173 -0
  197. package/dist/node-runtime/chunk-3GHXVUAK.js +21 -0
  198. package/dist/node-runtime/chunk-3RCWXWAY.js +466 -0
  199. package/dist/node-runtime/chunk-3WFAEVKS.js +115 -0
  200. package/dist/node-runtime/chunk-3X3KZKMI.js +49 -0
  201. package/dist/node-runtime/chunk-4HXHDDCF.js +16 -0
  202. package/dist/node-runtime/chunk-4TLO4PO2.js +3427 -0
  203. package/dist/node-runtime/chunk-4ZWGEEAS.js +69 -0
  204. package/dist/node-runtime/chunk-53YJI7JU.js +137 -0
  205. package/dist/node-runtime/chunk-5P7PZMRU.js +610 -0
  206. package/dist/node-runtime/chunk-7N3YHTYF.js +26 -0
  207. package/dist/node-runtime/chunk-7NBZ5P7I.js +24 -0
  208. package/dist/node-runtime/chunk-A2KQXUJD.js +105 -0
  209. package/dist/node-runtime/chunk-AD6VXAO7.js +342 -0
  210. package/dist/node-runtime/chunk-AHSTJBIB.js +64 -0
  211. package/dist/node-runtime/chunk-AJX357CL.js +20211 -0
  212. package/dist/node-runtime/chunk-ARC4KOTI.js +11178 -0
  213. package/dist/node-runtime/chunk-AUXVGBO4.js +19 -0
  214. package/dist/node-runtime/chunk-AY6CAJSL.js +30 -0
  215. package/dist/node-runtime/chunk-BHO7O6E5.js +296 -0
  216. package/dist/node-runtime/chunk-BI3DHYCN.js +8845 -0
  217. package/dist/node-runtime/chunk-BR7YDUKA.js +109 -0
  218. package/dist/node-runtime/chunk-BRJX2PRC.js +53 -0
  219. package/dist/node-runtime/chunk-C4O2RSQQ.js +37 -0
  220. package/dist/node-runtime/chunk-CCZJ3PYY.js +17 -0
  221. package/dist/node-runtime/chunk-CDFZEWPU.js +8388 -0
  222. package/dist/node-runtime/chunk-CGBXPL3E.js +1171 -0
  223. package/dist/node-runtime/chunk-CJECDQKP.js +19 -0
  224. package/dist/node-runtime/chunk-DAPBPCBP.js +53 -0
  225. package/dist/node-runtime/chunk-DDGMHUOW.js +305 -0
  226. package/dist/node-runtime/chunk-DMMTJQMQ.js +43 -0
  227. package/dist/node-runtime/chunk-DVGWF6A2.js +1180 -0
  228. package/dist/node-runtime/chunk-ECD5L7YI.js +1369 -0
  229. package/dist/node-runtime/chunk-EDBJNRSM.js +46 -0
  230. package/dist/node-runtime/chunk-F4VQFJI2.js +1269 -0
  231. package/dist/node-runtime/chunk-FVDOXRUD.js +96 -0
  232. package/dist/node-runtime/chunk-GZQHMEWL.js +126 -0
  233. package/dist/node-runtime/chunk-H2EOZYMP.js +57 -0
  234. package/dist/node-runtime/chunk-HQCKFM2O.js +56 -0
  235. package/dist/node-runtime/chunk-HYHJIRDW.js +19 -0
  236. package/dist/node-runtime/chunk-I6R76AG7.js +22 -0
  237. package/dist/node-runtime/chunk-IPA627GP.js +296 -0
  238. package/dist/node-runtime/chunk-JHYKXIMM.js +378 -0
  239. package/dist/node-runtime/chunk-KKSIVROT.js +88 -0
  240. package/dist/node-runtime/chunk-LZAW4ZX3.js +633 -0
  241. package/dist/node-runtime/chunk-M3LZLQW2.js +98 -0
  242. package/dist/node-runtime/chunk-MGWCVY6Y.js +47 -0
  243. package/dist/node-runtime/chunk-MJQDX3BA.js +72 -0
  244. package/dist/node-runtime/chunk-MKKH27PH.js +8956 -0
  245. package/dist/node-runtime/chunk-MX3GJNXJ.js +986 -0
  246. package/dist/node-runtime/chunk-N77MY65L.js +966 -0
  247. package/dist/node-runtime/chunk-NUIFPZWX.js +209 -0
  248. package/dist/node-runtime/chunk-OBMWP3I5.js +68 -0
  249. package/dist/node-runtime/chunk-OR4L3IB2.js +42 -0
  250. package/dist/node-runtime/chunk-PBC2Y6GS.js +903 -0
  251. package/dist/node-runtime/chunk-PCGNAY2O.js +1324 -0
  252. package/dist/node-runtime/chunk-PCIGF2XK.js +250 -0
  253. package/dist/node-runtime/chunk-PGAJ5MO5.js +7558 -0
  254. package/dist/node-runtime/chunk-PL6JKXWI.js +3622 -0
  255. package/dist/node-runtime/chunk-PVCDKGR6.js +55 -0
  256. package/dist/node-runtime/chunk-Q4Q6D4IY.js +364 -0
  257. package/dist/node-runtime/chunk-Q5ZU2VRT.js +83 -0
  258. package/dist/node-runtime/chunk-QFWG2RVL.js +5477 -0
  259. package/dist/node-runtime/chunk-QH42CDX3.js +9451 -0
  260. package/dist/node-runtime/chunk-RQ2Q5IYR.js +72 -0
  261. package/dist/node-runtime/chunk-RQ5DNUNG.js +429 -0
  262. package/dist/node-runtime/chunk-RRIZE6QQ.js +17 -0
  263. package/dist/node-runtime/chunk-SN6G4OU6.js +4753 -0
  264. package/dist/node-runtime/chunk-SWSN6HAB.js +53 -0
  265. package/dist/node-runtime/chunk-TQNSPERU.js +949 -0
  266. package/dist/node-runtime/chunk-VRB2IYGG.js +53 -0
  267. package/dist/node-runtime/chunk-VSELYKWU.js +772 -0
  268. package/dist/node-runtime/chunk-W3CVH5RX.js +62 -0
  269. package/dist/node-runtime/chunk-WJVFOIB5.js +24921 -0
  270. package/dist/node-runtime/chunk-WOVTOV5P.js +5653 -0
  271. package/dist/node-runtime/chunk-XBWPBZBN.js +125 -0
  272. package/dist/node-runtime/chunk-XTHQ7XR7.js +509 -0
  273. package/dist/node-runtime/chunk-YF63P5ZT.js +864 -0
  274. package/dist/node-runtime/chunk-YSKSB3BJ.js +295 -0
  275. package/dist/node-runtime/chunk-ZCHMJ34K.js +130 -0
  276. package/dist/node-runtime/chunk-ZKMFUD3Q.js +2834 -0
  277. package/dist/node-runtime/cli-runtime.js +81 -0
  278. package/dist/node-runtime/clipboard-OZ63BBC6.js +12 -0
  279. package/dist/node-runtime/clipboard-image-7QR6GXVA.js +13 -0
  280. package/dist/node-runtime/command-L3LAHDIH.js +13 -0
  281. package/dist/node-runtime/commands-RL5YBW5I.js +291 -0
  282. package/dist/node-runtime/config-FMEOZSWE.js +77 -0
  283. package/dist/node-runtime/curator-server-XCM43VEF.js +3816 -0
  284. package/dist/node-runtime/customize-XEXL2DGQ.js +12 -0
  285. package/dist/node-runtime/direct-tool-executor-JVDXTO7A.js +188 -0
  286. package/dist/node-runtime/exa-LL64QZR2.js +329 -0
  287. package/dist/node-runtime/export-html-KR26FOUZ.js +150 -0
  288. package/dist/node-runtime/extension-input-RV5N6APL.js +14 -0
  289. package/dist/node-runtime/extension-selector-CPD5LWDD.js +14 -0
  290. package/dist/node-runtime/extract-XLQSJN4V.js +17 -0
  291. package/dist/node-runtime/file-sync-HCOP2QVF.js +117 -0
  292. package/dist/node-runtime/gateway-X2TI5X7F.js +2484 -0
  293. package/dist/node-runtime/gemini-api-QE7ANVDZ.js +29 -0
  294. package/dist/node-runtime/gemini-search-U7SUMPQA.js +330 -0
  295. package/dist/node-runtime/gemini-url-context-PXWCBQHK.js +103 -0
  296. package/dist/node-runtime/gemini-web-MM446SEH.js +14 -0
  297. package/dist/node-runtime/github-extract-F64RZOEA.js +619 -0
  298. package/dist/node-runtime/goal-CZQ7FFQJ.js +1831 -0
  299. package/dist/node-runtime/index.js +859 -0
  300. package/dist/node-runtime/init-NJV2T55N.js +28 -0
  301. package/dist/node-runtime/install-cli-TH7IJJQQ.js +308 -0
  302. package/dist/node-runtime/interactive-mode-KOM35YF2.js +56 -0
  303. package/dist/node-runtime/interactive-view-U6OILKF3.js +249 -0
  304. package/dist/node-runtime/lsp-manager-3ASUSO4T.js +1104 -0
  305. package/dist/node-runtime/lunr-cron-YJ5UHYRD.js +268 -0
  306. package/dist/node-runtime/main.js +54 -0
  307. package/dist/node-runtime/mcp-auth-flow-QIXHW6QN.js +32 -0
  308. package/dist/node-runtime/mcp-panel-IIGMXQGP.js +501 -0
  309. package/dist/node-runtime/mcp-setup-panel-FEK7663I.js +355 -0
  310. package/dist/node-runtime/memory-cap-3S4XRLNP.js +20 -0
  311. package/dist/node-runtime/model-tiers-NJLHUEGK.js +20 -0
  312. package/dist/node-runtime/openai-search-B3MSNCQA.js +288 -0
  313. package/dist/node-runtime/package-manager-cli-TZZHJCVI.js +749 -0
  314. package/dist/node-runtime/parallel-AI2MNSCU.js +265 -0
  315. package/dist/node-runtime/parser-manager-TQHWYDH7.js +152 -0
  316. package/dist/node-runtime/pdf-extract-IPE6H4HP.js +57 -0
  317. package/dist/node-runtime/perplexity-QVJW3I35.js +12 -0
  318. package/dist/node-runtime/pi-intercom-EEMBGQID.js +2215 -0
  319. package/dist/node-runtime/pi-mcp-adapter-QFB37AVN.js +422 -0
  320. package/dist/node-runtime/pi-ollama-cloud-4VZRMULP.js +1440 -0
  321. package/dist/node-runtime/pi-prompt-template-model-4QT4LLXF.js +3946 -0
  322. package/dist/node-runtime/pi-subagents-7XJ4H53P.js +6023 -0
  323. package/dist/node-runtime/pi-web-access-DPGAVKOA.js +1864 -0
  324. package/dist/node-runtime/print-mode-VWIRFDAC.js +12 -0
  325. package/dist/node-runtime/proxy-modes-HEEFK4KC.js +685 -0
  326. package/dist/node-runtime/rpc-entry.js +62 -0
  327. package/dist/node-runtime/rpc-mode-SJNSOA4G.js +13 -0
  328. package/dist/node-runtime/runtime-bridges-PPHNBFWL.js +14 -0
  329. package/dist/node-runtime/session-manager-MQNBYACL.js +35 -0
  330. package/dist/node-runtime/session-selector-5AZLJS6U.js +14 -0
  331. package/dist/node-runtime/settings-manager-5LF2VQWC.js +21 -0
  332. package/dist/node-runtime/src-Y7JSCK64.js +2407 -0
  333. package/dist/node-runtime/subagent-executor-5RNDEPIJ.js +8483 -0
  334. package/dist/node-runtime/summary-review-YSMXKITO.js +228 -0
  335. package/dist/node-runtime/tavily-WEZFVFP7.js +154 -0
  336. package/dist/node-runtime/timings-UAD5BEAS.js +16 -0
  337. package/dist/node-runtime/tool-renderer-MV5O452K.js +204 -0
  338. package/dist/node-runtime/update-cli-A253SZ7P.js +73 -0
  339. package/dist/node-runtime/v4-5MNC3H7G.js +424 -0
  340. package/dist/node-runtime/video-extract-OYT5WKS5.js +304 -0
  341. package/dist/node-runtime/workspace-index-6DBXSTJ6.js +163 -0
  342. package/dist/node-runtime/youtube-extract-TQYKGFGS.js +264 -0
  343. package/dist/startup/benchmark-request.d.ts +3 -0
  344. package/dist/startup/benchmark-request.d.ts.map +1 -0
  345. package/dist/startup/benchmark-request.js +65 -0
  346. package/dist/startup/benchmark-request.js.map +1 -0
  347. package/dist/startup/interactive-view.d.ts +55 -0
  348. package/dist/startup/interactive-view.d.ts.map +1 -0
  349. package/dist/startup/interactive-view.js +332 -0
  350. package/dist/startup/interactive-view.js.map +1 -0
  351. package/dist/startup/launch-routing.d.ts.map +1 -1
  352. package/dist/startup/launch-routing.js +9 -10
  353. package/dist/startup/launch-routing.js.map +1 -1
  354. package/dist/startup/startup-milestones.d.ts +1 -1
  355. package/dist/startup/startup-milestones.d.ts.map +1 -1
  356. package/dist/startup/startup-milestones.js +3 -2
  357. package/dist/startup/startup-milestones.js.map +1 -1
  358. package/dist/utils/await-with-abort.d.ts +2 -0
  359. package/dist/utils/await-with-abort.d.ts.map +1 -0
  360. package/dist/utils/await-with-abort.js +19 -0
  361. package/dist/utils/await-with-abort.js.map +1 -0
  362. package/dist/utils/syntax-highlight.d.ts.map +1 -1
  363. package/dist/utils/syntax-highlight.js +10 -4
  364. package/dist/utils/syntax-highlight.js.map +1 -1
  365. package/docs/compaction.md +5 -3
  366. package/docs/development.md +5 -1
  367. package/docs/features.md +0 -1
  368. package/docs/interactive-startup.md +98 -0
  369. package/docs/model-catalog.md +29 -0
  370. package/docs/usage.md +0 -1
  371. package/examples/extensions/custom-provider-anthropic/package-lock.json +2 -2
  372. package/examples/extensions/custom-provider-anthropic/package.json +1 -1
  373. package/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
  374. package/examples/extensions/gondolin/package-lock.json +2 -2
  375. package/examples/extensions/gondolin/package.json +1 -1
  376. package/examples/extensions/sandbox/package-lock.json +2 -2
  377. package/examples/extensions/sandbox/package.json +1 -1
  378. package/examples/extensions/with-deps/package-lock.json +2 -2
  379. package/examples/extensions/with-deps/package.json +1 -1
  380. package/package.json +20 -20
  381. package/dist/core/swarm.d.ts +0 -23
  382. package/dist/core/swarm.d.ts.map +0 -1
  383. package/dist/core/swarm.js +0 -45
  384. package/dist/core/swarm.js.map +0 -1
@@ -16,18 +16,18 @@
16
16
  * accept an optional `query` parameter as an alternative to line/character,
17
17
  * resolving a symbol name to its position automatically.
18
18
  *
19
+ * Tool schemas, commands, and hooks register immediately. Heavy managers
20
+ * (LspManager, FileSync, Tree-sitter/WASM, WorkspaceIndex) load on first use.
21
+ *
19
22
  * Usage:
20
23
  * 1. npm install in this directory
21
24
  * 2. Add to pi via settings.json extensions, or: pi -e ./src/index.ts
22
25
  * 3. LSP servers start lazily when you first use a tool on a file
23
26
  */
24
- import { isReadToolResult, isWriteToolResult, isEditToolResult, } from "@ashx-j/lunr-dev";
27
+ import { awaitWithAbort } from "../../../utils/await-with-abort.js";
28
+ import { isReadToolResult, isWriteToolResult, isEditToolResult, } from "../../../core/extensions/types.js";
25
29
  import { DiagnosticSeverity } from "vscode-languageserver-protocol";
26
- import { LspManager } from "./lsp-manager.js";
27
- import { FileSync } from "./file-sync.js";
28
- import { TreeSitterManager } from "./tree-sitter/parser-manager.js";
29
- import { WorkspaceIndex } from "./tree-sitter/workspace-index.js";
30
- import "./workspace-provider.js";
30
+ import { LspRuntimeHost } from "./runtime.js";
31
31
  import { createDiagnosticsTool } from "./tools/diagnostics.js";
32
32
  import { createHoverTool } from "./tools/hover.js";
33
33
  import { createDefinitionTool } from "./tools/definition.js";
@@ -42,7 +42,7 @@ import { createCodeActionsTool } from "./tools/code-actions.js";
42
42
  import { syntheticDotLocks } from "./tools/completions.js";
43
43
  import { relative } from "node:path";
44
44
  import { existsSync, readFileSync } from "node:fs";
45
- import { join } from "node:path";
45
+ import { join, resolve } from "node:path";
46
46
  import { DIAGNOSTIC_SETTLE_DELAY_MS } from "./shared/timing.js";
47
47
  /** Load .pi-lsp.json from a directory. Returns null if not found or invalid. */
48
48
  function loadProjectConfig(dir) {
@@ -60,6 +60,35 @@ function loadProjectConfig(dir) {
60
60
  return null;
61
61
  }
62
62
  }
63
+ function createServiceProxy(getTarget, label) {
64
+ return new Proxy({}, {
65
+ get(_target, prop, receiver) {
66
+ const service = getTarget();
67
+ if (!service) {
68
+ throw new Error(`${label} is not initialized`);
69
+ }
70
+ const value = Reflect.get(service, prop, service);
71
+ if (typeof value === "function") {
72
+ return value.bind(service);
73
+ }
74
+ return value;
75
+ },
76
+ });
77
+ }
78
+ function registerToolWithRuntime(pi, tool, ensure, host) {
79
+ pi.registerTool({
80
+ ...tool,
81
+ async execute(id, params, signal, onUpdate, ctx) {
82
+ const generation = host.getGeneration();
83
+ signal?.throwIfAborted();
84
+ await awaitWithAbort(ensure(), signal);
85
+ signal?.throwIfAborted();
86
+ if (host.getGeneration() !== generation)
87
+ throw new Error("LSP session changed before execution");
88
+ return tool.execute(id, params, signal, onUpdate, ctx);
89
+ },
90
+ });
91
+ }
63
92
  export default function lspExtension(pi) {
64
93
  // Prevent EPIPE errors from LSP server exits from crashing the host process.
65
94
  // When an LSP server exits unexpectedly, in-flight writes to its stdin pipe
@@ -75,15 +104,11 @@ export default function lspExtension(pi) {
75
104
  console.error("[LSP] Uncaught exception:", err);
76
105
  }
77
106
  });
78
- let manager = null;
79
- let fileSync = null;
80
- let treeSitter = null;
81
- let workspaceIndex = null;
107
+ const host = new LspRuntimeHost();
82
108
  let pendingProvider = null;
83
- // Store latest ctx for lifecycle callbacks (updated on each event)
84
109
  let latestCtx = null;
85
- // Project config — loaded on session_start, used by auto-injection guard
86
110
  let projectConfig = null;
111
+ let sessionCwd = process.cwd();
87
112
  /**
88
113
  * Run `fn` with the currently captured ctx, swallowing stale-ctx errors.
89
114
  *
@@ -109,16 +134,10 @@ export default function lspExtension(pi) {
109
134
  throw err;
110
135
  }
111
136
  };
112
- // Listen for external workspace providers (e.g. bemol extension).
113
- // Also check if one was already registered before we loaded (load order varies).
114
- // Store as pendingProvider so it's available when the manager is created later.
115
137
  const applyProvider = (data) => {
116
138
  const provider = data;
117
139
  pendingProvider = provider;
118
- if (manager) {
119
- manager.setWorkspaceProvider(provider);
120
- }
121
- // Update status if we have a UI context
140
+ host.setPendingProvider(provider);
122
141
  const statusText = provider.getStatusText();
123
142
  if (!statusText)
124
143
  return;
@@ -133,7 +152,6 @@ export default function lspExtension(pi) {
133
152
  const existing = pi.events["lsp:workspace-provider"];
134
153
  if (existing)
135
154
  applyProvider(existing);
136
- /** Build lifecycle callbacks that update UI status */
137
155
  const setLspStatus = (color, text) => {
138
156
  withLatestCtx((ctx) => {
139
157
  if (!ctx.ui?.theme)
@@ -172,165 +190,144 @@ export default function lspExtension(pi) {
172
190
  }
173
191
  },
174
192
  });
175
- // Create manager eagerly so tools can reference it, but servers start lazily
176
- const getManager = () => {
177
- if (!manager) {
178
- manager = new LspManager(process.cwd(), undefined, makeCallbacks(), undefined, pendingProvider ?? undefined);
179
- fileSync = new FileSync(manager);
180
- fileSync.setSyntheticDotChecker((uri) => syntheticDotLocks.has(uri));
181
- treeSitter = new TreeSitterManager();
182
- workspaceIndex = new WorkspaceIndex(process.cwd(), treeSitter);
183
- fileSync.setTreeSitter(treeSitter, workspaceIndex);
184
- }
185
- return manager;
186
- };
187
- const getFileSync = () => {
188
- if (!fileSync) {
189
- getManager(); // ensures fileSync is created
193
+ const applyProjectConfigToManager = (manager, config) => {
194
+ if (!config)
195
+ return;
196
+ if (config.servers) {
197
+ for (const [lang, serverConf] of Object.entries(config.servers)) {
198
+ manager.setServerConfig(lang, {
199
+ command: serverConf.command,
200
+ args: serverConf.args ?? [],
201
+ env: serverConf.env,
202
+ initializationOptions: serverConf.initializationOptions,
203
+ settings: serverConf.settings,
204
+ });
205
+ }
190
206
  }
191
- return fileSync;
192
- };
193
- const getTreeSitter = () => {
194
- if (!treeSitter) {
195
- getManager(); // ensures treeSitter is created
207
+ if (config.lombokJar && config.lombokJar !== "auto") {
208
+ manager.setLombokJar(config.lombokJar);
196
209
  }
197
- return treeSitter;
198
210
  };
199
- const getWorkspaceIndex = () => {
200
- if (!workspaceIndex) {
201
- getManager(); // ensures workspaceIndex is created
202
- }
203
- return workspaceIndex;
211
+ const buildBindOptions = (cwd) => ({
212
+ cwd,
213
+ callbacks: makeCallbacks(),
214
+ pendingProvider,
215
+ syntheticDotChecker: (uri) => syntheticDotLocks.has(uri),
216
+ configureManager: (manager) => {
217
+ applyProjectConfigToManager(manager, projectConfig);
218
+ },
219
+ });
220
+ const ensureRuntime = async () => {
221
+ return host.ensureServices(buildBindOptions(sessionCwd || process.cwd()));
204
222
  };
205
- // Initialize manager (uses cwd at session start time)
223
+ // session_start binds cwd/config only. Heavy managers load on first use,
224
+ // unless autoStart is configured (then ensure + startEagerly).
206
225
  pi.on("session_start", async (_event, ctx) => {
207
226
  latestCtx = ctx;
208
- // If manager was already created eagerly (e.g. by a tool before session_start),
209
- // shut it down so we can re-create with the correct ctx.cwd.
210
- if (manager) {
211
- await manager.shutdownAll().catch(() => { });
212
- if (treeSitter)
213
- treeSitter.shutdown();
214
- }
215
- manager = new LspManager(ctx.cwd, undefined, makeCallbacks(), undefined, pendingProvider ?? undefined);
216
- fileSync = new FileSync(manager);
217
- fileSync.setSyntheticDotChecker((uri) => syntheticDotLocks.has(uri));
218
- treeSitter = new TreeSitterManager();
219
- workspaceIndex = new WorkspaceIndex(ctx.cwd, treeSitter);
220
- fileSync.setTreeSitter(treeSitter, workspaceIndex);
221
- // Initialize tree-sitter in the background (don't block session start)
222
- treeSitter.init().catch((err) => {
223
- console.error(`[pi-lsp-extension] tree-sitter WASM init failed: ${err?.message ?? err}`);
224
- });
225
- // Show workspace provider status
226
- const wsProvider = manager.workspace;
227
- const statusText = wsProvider.getStatusText();
227
+ sessionCwd = ctx.cwd;
228
+ projectConfig = loadProjectConfig(ctx.cwd);
229
+ host.bindSession(buildBindOptions(ctx.cwd));
230
+ const statusText = pendingProvider?.getStatusText?.() ?? "";
228
231
  if (statusText) {
229
232
  ctx.ui.setStatus("lsp", ctx.ui.theme.fg("accent", `LSP: ${statusText}`));
230
233
  }
231
234
  else {
232
235
  ctx.ui.setStatus("lsp", ctx.ui.theme.fg("dim", "LSP: idle"));
233
236
  }
234
- // Load project config and apply settings
235
- projectConfig = loadProjectConfig(ctx.cwd);
236
- if (projectConfig) {
237
- // Apply custom server configs
238
- if (projectConfig.servers) {
239
- for (const [lang, serverConf] of Object.entries(projectConfig.servers)) {
240
- manager.setServerConfig(lang, {
241
- command: serverConf.command,
242
- args: serverConf.args ?? [],
243
- env: serverConf.env,
244
- initializationOptions: serverConf.initializationOptions,
245
- settings: serverConf.settings,
246
- });
247
- }
248
- }
249
- // Set Lombok jar path (explicit path or "auto" for auto-detection)
250
- if (projectConfig.lombokJar) {
251
- if (projectConfig.lombokJar !== "auto") {
252
- manager.setLombokJar(projectConfig.lombokJar);
253
- }
254
- // "auto" is the default behavior — findLombokJar() already auto-detects.
255
- // Setting it explicitly just confirms the user wants Lombok support.
256
- }
257
- // Auto-start configured languages in the background
258
- if (projectConfig.autoStart && projectConfig.autoStart.length > 0) {
259
- const langs = projectConfig.autoStart;
260
- const lombokNote = langs.includes("java") && manager.getLombokJar()
261
- ? ` (lombok: ${manager.getLombokJar()?.split("/").pop()})` : "";
237
+ if (projectConfig?.autoStart && projectConfig.autoStart.length > 0) {
238
+ const langs = projectConfig.autoStart;
239
+ const generation = host.getGeneration();
240
+ void ensureRuntime().then((services) => {
241
+ if (host.getGeneration() !== generation)
242
+ return;
243
+ const lombokJar = services.manager.getLombokJar?.() ?? null;
244
+ const lombokNote = langs.includes("java") && lombokJar
245
+ ? ` (lombok: ${String(lombokJar).split(/[/\\]/).pop()})`
246
+ : "";
262
247
  setLspStatus("warning", `LSP: auto-starting ${langs.join(", ")}${lombokNote}...`);
263
- manager.startEagerly(langs);
264
- }
248
+ services.manager.startEagerly(langs);
249
+ }).catch((error) => {
250
+ if (host.getGeneration() === generation)
251
+ setLspStatus("error", `LSP startup failed: ${String(error)}`);
252
+ });
265
253
  }
266
254
  });
267
- // Register all LSP tools
268
- // Tools call getManager() lazily so they work even if session_start hasn't fired
269
- const managerProxy = new Proxy({}, {
270
- get(_target, prop) {
271
- return getManager()[prop];
255
+ const managerProxy = createServiceProxy(() => host.getServicesIfReady()?.manager ?? null, "LSP manager");
256
+ const treeSitterProxy = createServiceProxy(() => host.getServicesIfReady()?.treeSitter ?? null, "Tree-sitter manager");
257
+ const workspaceIndexProxy = createServiceProxy(() => host.getServicesIfReady()?.workspaceIndex ?? null, "Workspace index");
258
+ registerToolWithRuntime(pi, createDiagnosticsTool(managerProxy, treeSitterProxy), ensureRuntime, host);
259
+ registerToolWithRuntime(pi, createHoverTool(managerProxy, treeSitterProxy), ensureRuntime, host);
260
+ registerToolWithRuntime(pi, createDefinitionTool(managerProxy, treeSitterProxy, workspaceIndexProxy), ensureRuntime, host);
261
+ registerToolWithRuntime(pi, createReferencesTool(managerProxy, treeSitterProxy), ensureRuntime, host);
262
+ registerToolWithRuntime(pi, createSymbolsTool(managerProxy, treeSitterProxy, workspaceIndexProxy), ensureRuntime, host);
263
+ registerToolWithRuntime(pi, createRenameTool(managerProxy, treeSitterProxy), ensureRuntime, host);
264
+ registerToolWithRuntime(pi, createCodeActionsTool(managerProxy, treeSitterProxy), ensureRuntime, host);
265
+ registerToolWithRuntime(pi, createCompletionsTool(managerProxy, {
266
+ getTrackedVersion: (uri) => {
267
+ const services = host.getServicesIfReady();
268
+ if (!services)
269
+ return null;
270
+ return services.fileSync.getTrackedVersion(uri);
272
271
  },
273
- });
274
- const treeSitterProxy = new Proxy({}, {
275
- get(_target, prop) {
276
- return getTreeSitter()[prop];
277
- },
278
- });
279
- const workspaceIndexProxy = new Proxy({}, {
280
- get(_target, prop) {
281
- return getWorkspaceIndex()[prop];
272
+ setTrackedVersion: (uri, v) => {
273
+ host.getServicesIfReady()?.fileSync.setTrackedVersion(uri, v);
282
274
  },
283
- });
284
- pi.registerTool(createDiagnosticsTool(managerProxy, treeSitterProxy));
285
- pi.registerTool(createHoverTool(managerProxy, treeSitterProxy));
286
- pi.registerTool(createDefinitionTool(managerProxy, treeSitterProxy, workspaceIndexProxy));
287
- pi.registerTool(createReferencesTool(managerProxy, treeSitterProxy));
288
- pi.registerTool(createSymbolsTool(managerProxy, treeSitterProxy, workspaceIndexProxy));
289
- pi.registerTool(createRenameTool(managerProxy, treeSitterProxy));
290
- pi.registerTool(createCodeActionsTool(managerProxy, treeSitterProxy));
291
- pi.registerTool(createCompletionsTool(managerProxy, {
292
- getTrackedVersion: (uri) => getFileSync().getTrackedVersion(uri),
293
- setTrackedVersion: (uri, v) => getFileSync().setTrackedVersion(uri, v),
294
275
  isSyntheticDotActive: (uri) => syntheticDotLocks.has(uri),
295
- }, treeSitterProxy));
296
- const getRootDir = () => manager?.resolvePath(".") ?? process.cwd();
297
- pi.registerTool(createCodeOverviewTool(getRootDir, treeSitterProxy, workspaceIndexProxy));
298
- pi.registerTool(createCodeSearchTool(getRootDir, treeSitterProxy));
299
- pi.registerTool(createCodeRewriteTool(getRootDir, treeSitterProxy, {
276
+ }, treeSitterProxy), ensureRuntime, host);
277
+ const getRootDir = () => {
278
+ const manager = host.getServicesIfReady()?.manager;
279
+ if (manager)
280
+ return manager.resolvePath(".");
281
+ return sessionCwd || process.cwd();
282
+ };
283
+ registerToolWithRuntime(pi, createCodeOverviewTool(getRootDir, treeSitterProxy, workspaceIndexProxy), ensureRuntime, host);
284
+ registerToolWithRuntime(pi, createCodeSearchTool(getRootDir, treeSitterProxy), ensureRuntime, host);
285
+ registerToolWithRuntime(pi, createCodeRewriteTool(getRootDir, treeSitterProxy, {
300
286
  onFileModified: (filePath) => {
301
- getFileSync().handleFileWrite(filePath).catch(() => { });
287
+ const services = host.getServicesIfReady();
288
+ if (!services)
289
+ return;
290
+ services.fileSync.handleFileWrite(filePath).catch(() => { });
302
291
  },
303
- }));
304
- pi.registerTool(createCodeActionsTool(managerProxy, treeSitterProxy));
305
- // File sync: track file reads/writes/edits
306
- // After writes/edits, append file-scoped error diagnostics to the tool result
292
+ }), ensureRuntime, host);
293
+ // File sync: track file reads/writes/edits without loading runtime on plain reads
294
+ // when LSP was never used. Writes may start a server (existing behavior) so they
295
+ // ensure runtime. After writes/edits, append file-scoped error diagnostics.
307
296
  pi.on("tool_result", async (event) => {
308
- const sync = getFileSync();
297
+ const generation = host.getGeneration();
309
298
  try {
310
299
  if (isReadToolResult(event) && !event.isError) {
311
- const path = event.input?.path;
312
- if (path)
313
- await sync.handleFileRead(path);
314
- }
315
- if (isWriteToolResult(event) && !event.isError) {
316
- const path = event.input?.path;
317
- if (path)
318
- await sync.handleFileWrite(path);
300
+ const services = host.getServicesIfReady();
301
+ if (services) {
302
+ const path = event.input?.path;
303
+ if (path)
304
+ await services.fileSync.handleFileRead(path);
305
+ if (host.getGeneration() !== generation)
306
+ return;
307
+ }
319
308
  }
320
- if (isEditToolResult(event) && !event.isError) {
309
+ if ((isWriteToolResult(event) || isEditToolResult(event)) && !event.isError) {
321
310
  const path = event.input?.path;
322
- if (path)
323
- await sync.handleFileWrite(path);
311
+ if (path) {
312
+ const services = await ensureRuntime();
313
+ if (host.getGeneration() !== generation)
314
+ return;
315
+ await services.fileSync.handleFileWrite(path);
316
+ }
324
317
  }
325
318
  }
326
319
  catch {
327
320
  // File sync errors are non-fatal
328
321
  }
322
+ if (host.getGeneration() !== generation)
323
+ return;
329
324
  // Auto-append diagnostics for the changed file (write/edit only)
330
- if ((isWriteToolResult(event) || isEditToolResult(event)) && !event.isError && manager) {
325
+ const services = host.getServicesIfReady();
326
+ if ((isWriteToolResult(event) || isEditToolResult(event)) && !event.isError && services) {
331
327
  const path = event.input?.path;
332
328
  if (!path)
333
329
  return;
330
+ const manager = services.manager;
334
331
  const languageId = manager.getLanguageId(path);
335
332
  if (!languageId)
336
333
  return;
@@ -345,6 +342,8 @@ export default function lspExtension(pi) {
345
342
  return;
346
343
  // Wait briefly for the LSP to publish updated diagnostics
347
344
  await new Promise((r) => setTimeout(r, DIAGNOSTIC_SETTLE_DELAY_MS));
345
+ if (host.getGeneration() !== generation)
346
+ return;
348
347
  const uri = manager.getFileUri(path);
349
348
  const diagnostics = client.getDiagnostics(uri);
350
349
  const errors = diagnostics.filter((d) => d.severity === DiagnosticSeverity.Error);
@@ -373,9 +372,10 @@ export default function lspExtension(pi) {
373
372
  // Update status after tool execution ends
374
373
  pi.on("tool_execution_end", async (_event, ctx) => {
375
374
  latestCtx = ctx;
376
- if (!manager)
375
+ const services = host.getServicesIfReady();
376
+ if (!services)
377
377
  return;
378
- const statuses = manager.getStatus();
378
+ const statuses = services.manager.getStatus();
379
379
  const running = statuses.filter((s) => s.running);
380
380
  if (running.length === 0) {
381
381
  ctx.ui.setStatus("lsp", ctx.ui.theme.fg("dim", "LSP: idle"));
@@ -394,11 +394,12 @@ export default function lspExtension(pi) {
394
394
  pi.registerCommand("lsp", {
395
395
  description: "Show LSP server status",
396
396
  handler: async (_args, ctx) => {
397
- if (!manager) {
397
+ const services = host.getServicesIfReady();
398
+ if (!services) {
398
399
  ctx.ui.notify("LSP manager not initialized", "warning");
399
400
  return;
400
401
  }
401
- const statuses = manager.getStatus();
402
+ const statuses = services.manager.getStatus();
402
403
  if (statuses.length === 0) {
403
404
  ctx.ui.notify("No LSP servers configured", "info");
404
405
  return;
@@ -416,14 +417,15 @@ export default function lspExtension(pi) {
416
417
  pi.registerCommand("lsp-restart", {
417
418
  description: "Restart an LSP server: /lsp-restart <language> (e.g. java, typescript)",
418
419
  handler: async (args, ctx) => {
419
- if (!manager) {
420
+ const services = host.getServicesIfReady();
421
+ if (!services) {
420
422
  ctx.ui.notify("LSP manager not initialized", "warning");
421
423
  return;
422
424
  }
423
425
  const languageId = args?.trim().toLowerCase();
424
426
  if (!languageId) {
425
427
  // Show running servers and usage
426
- const statuses = manager.getStatus().filter((s) => s.running);
428
+ const statuses = services.manager.getStatus().filter((s) => s.running);
427
429
  if (statuses.length === 0) {
428
430
  ctx.ui.notify("No LSP servers are running.\n\nUsage: /lsp-restart <language>", "info");
429
431
  }
@@ -436,8 +438,8 @@ export default function lspExtension(pi) {
436
438
  ctx.ui.setStatus("lsp", ctx.ui.theme.fg("warning", `LSP: restarting ${languageId}...`));
437
439
  ctx.ui.notify(`Restarting ${languageId} server (kills daemon if shared)...`, "info");
438
440
  try {
439
- await manager.restartServer(languageId);
440
- const lombokJar = languageId === "java" ? manager.getLombokJar() : null;
441
+ await services.manager.restartServer(languageId);
442
+ const lombokJar = languageId === "java" ? services.manager.getLombokJar() : null;
441
443
  const lombokNote = lombokJar ? `\nLombok: ${lombokJar}` : "";
442
444
  ctx.ui.notify(`${languageId} server restarted successfully.${lombokNote}`, "info");
443
445
  ctx.ui.setStatus("lsp", ctx.ui.theme.fg("accent", `LSP: ${languageId} ready`));
@@ -463,7 +465,8 @@ export default function lspExtension(pi) {
463
465
  }
464
466
  const [languageId, command, ...serverArgs] = parts;
465
467
  const config = { command, args: serverArgs };
466
- getManager().setServerConfig(languageId, config);
468
+ const services = await ensureRuntime();
469
+ services.manager.setServerConfig(languageId, config);
467
470
  ctx.ui.notify(`Configured LSP for ${languageId}: ${command} ${serverArgs.join(" ")}`, "info");
468
471
  },
469
472
  });
@@ -471,7 +474,8 @@ export default function lspExtension(pi) {
471
474
  pi.registerCommand("lsp-lombok", {
472
475
  description: "Set Lombok jar path for Java: /lsp-lombok <path-to-lombok.jar>",
473
476
  handler: async (args, ctx) => {
474
- const mgr = getManager();
477
+ const services = await ensureRuntime();
478
+ const mgr = services.manager;
475
479
  if (!args?.trim()) {
476
480
  const current = mgr.getLombokJar();
477
481
  if (current) {
@@ -486,8 +490,6 @@ export default function lspExtension(pi) {
486
490
  return;
487
491
  }
488
492
  const jarPath = args.trim();
489
- const { existsSync } = await import("node:fs");
490
- const { resolve } = await import("node:path");
491
493
  const resolved = resolve(ctx.cwd, jarPath);
492
494
  if (!existsSync(resolved)) {
493
495
  ctx.ui.notify(`File not found: ${resolved}`, "error");
@@ -500,22 +502,14 @@ export default function lspExtension(pi) {
500
502
  ctx.ui.notify(`Lombok jar set: ${resolved}`, "info");
501
503
  },
502
504
  });
503
- // Clean shutdown (includes workspace provider, all LSP servers, and tree-sitter)
505
+ // Clean shutdown never loads heavy modules if they were unused
504
506
  pi.on("session_shutdown", async () => {
505
507
  // Drop the captured ctx immediately — once shutdown fires, any late
506
508
  // LSP manager callback that reaches setLspStatus/applyProvider would
507
509
  // otherwise hit an invalidated ctx and throw an uncaught exception.
508
510
  latestCtx = null;
509
- if (manager) {
510
- await manager.shutdownAll();
511
- manager = null;
512
- fileSync = null;
513
- }
514
- if (treeSitter) {
515
- treeSitter.shutdown();
516
- treeSitter = null;
517
- }
518
- workspaceIndex = null;
511
+ await host.shutdown();
519
512
  });
520
513
  }
514
+ export { LspRuntimeHost } from "./runtime.js";
521
515
  //# sourceMappingURL=index.js.map