@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
@@ -0,0 +1,422 @@
1
+ import { createRequire as __lunrRequire } from "node:module"; const require = __lunrRequire(import.meta.url);
2
+ import {
3
+ abortable,
4
+ buildProxyDescription,
5
+ getConfigPathFromArgv,
6
+ getMetadataCachePath,
7
+ getMissingConfiguredDirectToolServers,
8
+ loadMcpConfig,
9
+ loadMetadataCache,
10
+ normalizeDirectToolInputSchema,
11
+ resolveDirectTools,
12
+ throwIfAborted,
13
+ truncateAtWord
14
+ } from "./chunk-VSELYKWU.js";
15
+ import "./chunk-4HXHDDCF.js";
16
+ import "./chunk-ARC4KOTI.js";
17
+ import "./chunk-BRJX2PRC.js";
18
+
19
+ // packages/coding-agent/dist/builtin-extensions/pi-mcp-adapter/index.js
20
+ import { existsSync } from "node:fs";
21
+ import { Type } from "typebox";
22
+
23
+ // packages/coding-agent/dist/builtin-extensions/pi-mcp-adapter/tool-result-renderer.js
24
+ import { Text } from "@ashx-j/lunr-tui";
25
+ var DEFAULT_MAX_CALL_INPUT_CHARS = 1500;
26
+ function truncateText(value, maxChars) {
27
+ return value.length <= maxChars ? value : `${value.slice(0, Math.max(0, maxChars - 1))}\u2026`;
28
+ }
29
+ function formatJsonish(value, maxChars) {
30
+ if (typeof value == "string")
31
+ try {
32
+ return truncateText(JSON.stringify(JSON.parse(value), null, 2), maxChars);
33
+ } catch {
34
+ return truncateText(value, maxChars);
35
+ }
36
+ try {
37
+ return truncateText(JSON.stringify(value, null, 2), maxChars);
38
+ } catch {
39
+ return truncateText(String(value), maxChars);
40
+ }
41
+ }
42
+ function hasUsefulObjectContent(value) {
43
+ return typeof value == "object" && value !== null && !Array.isArray(value) && Object.keys(value).length > 0;
44
+ }
45
+ function formatMcpProxyToolCallLines(args, maxInputChars = DEFAULT_MAX_CALL_INPUT_CHARS) {
46
+ if (args.action === "ui-messages")
47
+ return [`mcp ${args.action}`];
48
+ if (args.tool) {
49
+ let lines = [`mcp call ${args.server ? `${args.tool} @ ${args.server}` : args.tool}`];
50
+ return args.args && lines.push(formatJsonish(args.args, maxInputChars)), lines;
51
+ }
52
+ if (args.connect)
53
+ return [`mcp connect ${args.connect}`];
54
+ if (args.describe)
55
+ return [`mcp describe ${args.describe}`];
56
+ if (args.search) {
57
+ let line = `mcp search ${args.search}`;
58
+ return args.server && (line += ` @ ${args.server}`), args.regex === !0 && (line += " (regex)"), args.includeSchemas === !1 && (line += " (schemas hidden)"), [line];
59
+ }
60
+ return args.server ? [`mcp list ${args.server}`] : args.action ? [`mcp ${args.action}`] : ["mcp status"];
61
+ }
62
+ function formatMcpDirectToolCallLines(displayName, args, maxInputChars = DEFAULT_MAX_CALL_INPUT_CHARS) {
63
+ return hasUsefulObjectContent(args) ? [displayName, formatJsonish(args, maxInputChars)] : [displayName];
64
+ }
65
+ function renderToolCallLines(lines, theme) {
66
+ let [title = "mcp", ...rest] = lines, styledTitle = theme.fg("toolTitle", theme.bold ? theme.bold(title) : title), styledRest = rest.map((line) => theme.fg("muted", line));
67
+ return new Text([styledTitle, ...styledRest].join(`
68
+ `), 0, 0);
69
+ }
70
+ function renderMcpProxyToolCall(args, theme) {
71
+ return renderToolCallLines(formatMcpProxyToolCallLines(args), theme);
72
+ }
73
+ function createMcpDirectToolCallRenderer(displayName) {
74
+ return (args, theme) => renderToolCallLines(formatMcpDirectToolCallLines(displayName, args), theme);
75
+ }
76
+ function blockToLines(block) {
77
+ return block.type === "text" ? block.text.split(`
78
+ `) : [`[image: ${block.mimeType}]`];
79
+ }
80
+ function formatMcpToolResultLines(result, expanded, maxCollapsedLines = 3) {
81
+ let allLines = result.content.flatMap(blockToLines), lines = allLines.length > 0 ? allLines : ["(empty result)"];
82
+ return expanded || lines.length <= maxCollapsedLines ? { lines, truncated: !1 } : {
83
+ lines: [...lines.slice(0, maxCollapsedLines), "\u2026"],
84
+ truncated: !0
85
+ };
86
+ }
87
+ function renderMcpToolResult(result, options, theme, context) {
88
+ if (options.isPartial)
89
+ return new Text(theme.fg("warning", "Running MCP tool..."), 0, 0);
90
+ let hasErrorDetails = !!result.details.error, display = formatMcpToolResultLines(result, options.expanded || context?.isError === !0 || hasErrorDetails), output = display.lines.map((line) => line === "\u2026" ? theme.fg("muted", line) : theme.fg("toolOutput", line)).join(`
91
+ `), hint = display.truncated && !options.expanded ? `
92
+ ${theme.fg("muted", "(Ctrl+O to expand)")}` : "";
93
+ return new Text(`${output}${hint}`, 0, 0);
94
+ }
95
+
96
+ // packages/coding-agent/dist/builtin-extensions/pi-mcp-adapter/error-signal.js
97
+ function toolErrorOverride(details) {
98
+ if (details && typeof details == "object" && "error" in details) {
99
+ let code = details.error;
100
+ if (code === "tool_error" || code === "call_failed")
101
+ return { isError: !0 };
102
+ }
103
+ }
104
+
105
+ // packages/coding-agent/dist/builtin-extensions/pi-mcp-adapter/index.js
106
+ function shouldBackgroundAutostart(config, cache) {
107
+ let serverEntries = Object.entries(config.mcpServers);
108
+ if (serverEntries.length === 0)
109
+ return !1;
110
+ if (!existsSync(getMetadataCachePath()))
111
+ return !0;
112
+ for (let [, definition] of serverEntries) {
113
+ let mode = definition.lifecycle ?? "lazy";
114
+ if (mode === "keep-alive" || mode === "eager")
115
+ return !0;
116
+ }
117
+ return process.env.MCP_DIRECT_TOOLS === "__none__" ? !1 : getMissingConfiguredDirectToolServers(config, cache).length > 0;
118
+ }
119
+ function mcpAdapter(pi) {
120
+ let state = null, initPromise = null, lifecycleGeneration = 0, sessionAbort = new AbortController(), initializingStates = /* @__PURE__ */ new Set(), heavyModules = null, heavyModulesPromise = null, directExecutors = /* @__PURE__ */ new Map();
121
+ function loadHeavyModules() {
122
+ return heavyModules ? Promise.resolve(heavyModules) : (heavyModulesPromise || (heavyModulesPromise = (async () => {
123
+ let [init, authFlow, commands, proxyModes, directToolExecutor] = await Promise.all([
124
+ import("./init-NJV2T55N.js"),
125
+ import("./mcp-auth-flow-QIXHW6QN.js"),
126
+ import("./commands-RL5YBW5I.js"),
127
+ import("./proxy-modes-HEEFK4KC.js"),
128
+ import("./direct-tool-executor-JVDXTO7A.js")
129
+ ]), loaded = { init, authFlow, commands, proxyModes, directToolExecutor };
130
+ return heavyModules = loaded, loaded;
131
+ })().catch((error) => {
132
+ throw heavyModulesPromise = null, error;
133
+ })), heavyModulesPromise);
134
+ }
135
+ async function shutdownState(currentState, reason) {
136
+ if (!currentState)
137
+ return;
138
+ currentState.uiServer && (currentState.uiServer.close(reason), currentState.uiServer = null);
139
+ let flushError;
140
+ try {
141
+ heavyModules && heavyModules.init.flushMetadataCache(currentState);
142
+ } catch (error) {
143
+ flushError = error;
144
+ }
145
+ try {
146
+ await currentState.lifecycle.gracefulShutdown();
147
+ } catch (error) {
148
+ if (flushError)
149
+ console.error("MCP: graceful shutdown failed after metadata flush error", error);
150
+ else
151
+ throw error;
152
+ }
153
+ if (flushError)
154
+ throw flushError;
155
+ }
156
+ async function shutdownInitializingStates() {
157
+ let pending = [...initializingStates];
158
+ initializingStates.clear(), await Promise.all(pending.map((entry) => shutdownState(entry, "initialization_cancelled")));
159
+ }
160
+ async function shutdownLoadedRuntime() {
161
+ heavyModules && await heavyModules.authFlow.shutdownOAuth();
162
+ }
163
+ async function runInitialize(generation, sessionPi, ctx) {
164
+ let signal = sessionAbort.signal, heavy = await loadHeavyModules();
165
+ if (throwIfAborted(signal), generation !== lifecycleGeneration)
166
+ throw new Error("MCP initialization aborted (session changed)");
167
+ if (await heavy.authFlow.initializeOAuth().catch((err) => {
168
+ console.error("MCP OAuth initialization failed:", err);
169
+ }), generation !== lifecycleGeneration)
170
+ throw new Error("MCP initialization aborted (session changed)");
171
+ let partial;
172
+ try {
173
+ let initialized = await heavy.init.initializeMcp(sessionPi, ctx, {
174
+ signal,
175
+ onState: (entry) => {
176
+ partial = entry, initializingStates.add(entry);
177
+ }
178
+ });
179
+ return partial || (partial = initialized, initializingStates.add(initialized)), throwIfAborted(signal), initialized;
180
+ } catch (error) {
181
+ throw partial && initializingStates.delete(partial) && await shutdownState(partial, "initialization_failed"), error;
182
+ } finally {
183
+ partial && initializingStates.delete(partial);
184
+ }
185
+ }
186
+ function startSessionInit(generation, sessionPi, ctx) {
187
+ let promise = runInitialize(generation, sessionPi, ctx);
188
+ return initPromise = promise, promise.then(async (nextState) => {
189
+ if (generation !== lifecycleGeneration || initPromise !== promise) {
190
+ try {
191
+ await shutdownState(nextState, "stale_session_start");
192
+ } catch (error) {
193
+ console.error("MCP: failed to clean stale session state", error);
194
+ }
195
+ return;
196
+ }
197
+ state = nextState, heavyModules && heavyModules.init.updateStatusBar(nextState), initPromise = null;
198
+ }).catch((err) => {
199
+ generation === lifecycleGeneration && (initPromise !== promise && initPromise !== null || (console.error("MCP initialization failed:", err), initPromise = null));
200
+ }), promise;
201
+ }
202
+ async function ensureState(sessionPi, ctx, signal) {
203
+ if (throwIfAborted(signal), state)
204
+ return state;
205
+ let generation = lifecycleGeneration;
206
+ initPromise || startSessionInit(generation, sessionPi, ctx);
207
+ let promise = initPromise;
208
+ if (!promise)
209
+ throw new Error("MCP not initialized");
210
+ try {
211
+ let nextState = await abortable(promise, signal);
212
+ if (generation !== lifecycleGeneration)
213
+ throw new Error("MCP initialization aborted (session changed)");
214
+ return state || (state = nextState, initPromise === promise && (initPromise = null), state);
215
+ } catch (error) {
216
+ throw initPromise === promise && !signal?.aborted && (initPromise = null), error;
217
+ }
218
+ }
219
+ function assertCurrentState(currentState) {
220
+ if (currentState !== state)
221
+ throw new Error("MCP session changed before execution");
222
+ }
223
+ function createLazyDirectToolExecute(spec) {
224
+ return async function(toolCallId, params, incomingSignal, onUpdate, ctx) {
225
+ let signal = incomingSignal ? AbortSignal.any([incomingSignal, sessionAbort.signal]) : sessionAbort.signal, currentState;
226
+ try {
227
+ currentState = await ensureState(pi, ctx, signal);
228
+ } catch (error) {
229
+ let message = error instanceof Error ? error.message : String(error);
230
+ return {
231
+ content: [{ type: "text", text: `MCP initialization failed: ${message}` }],
232
+ details: { error: "init_failed", message }
233
+ };
234
+ }
235
+ let heavy = await loadHeavyModules();
236
+ throwIfAborted(signal), assertCurrentState(currentState);
237
+ let executor = directExecutors.get(spec.prefixedName);
238
+ return executor || (executor = heavy.directToolExecutor.createDirectToolExecutor(() => currentState, () => null, spec), directExecutors.set(spec.prefixedName, executor)), executor(toolCallId, params, signal, onUpdate, ctx);
239
+ };
240
+ }
241
+ let earlyConfigPath = getConfigPathFromArgv(), earlyConfig = loadMcpConfig(earlyConfigPath), earlyCache = loadMetadataCache(), prefix = earlyConfig.settings?.toolPrefix ?? "server", envRaw = process.env.MCP_DIRECT_TOOLS, directSpecs = envRaw === "__none__" ? [] : resolveDirectTools(earlyConfig, earlyCache, prefix, envRaw?.split(",").map((s) => s.trim()).filter(Boolean)), missingConfiguredDirectToolServers = getMissingConfiguredDirectToolServers(earlyConfig, earlyCache), shouldRegisterProxyTool = earlyConfig.settings?.disableProxyTool !== !0 || directSpecs.length === 0 || missingConfiguredDirectToolServers.length > 0;
242
+ for (let spec of directSpecs)
243
+ pi.registerTool({
244
+ name: spec.prefixedName,
245
+ label: `MCP: ${spec.originalName}`,
246
+ description: spec.description || "(no description)",
247
+ promptSnippet: truncateAtWord(spec.description, 100) || `MCP tool from ${spec.serverName}`,
248
+ parameters: Type.Unsafe(normalizeDirectToolInputSchema(spec.inputSchema)),
249
+ execute: createLazyDirectToolExecute(spec),
250
+ renderCall: createMcpDirectToolCallRenderer(spec.prefixedName),
251
+ renderResult: renderMcpToolResult
252
+ });
253
+ let getPiTools = () => pi.getAllTools();
254
+ pi.registerFlag("mcp-config", {
255
+ description: "Path to MCP config file",
256
+ type: "string"
257
+ }), pi.on("session_start", async (_event, ctx) => {
258
+ let generation = ++lifecycleGeneration;
259
+ sessionAbort.abort(new Error("MCP session changed")), sessionAbort = new AbortController();
260
+ let previousState = state;
261
+ state = null, initPromise = null, directExecutors.clear();
262
+ try {
263
+ await Promise.all([
264
+ shutdownState(previousState, "session_restart"),
265
+ shutdownInitializingStates(),
266
+ shutdownLoadedRuntime()
267
+ ]);
268
+ } catch (error) {
269
+ console.error("MCP: failed to shut down previous session state", error);
270
+ }
271
+ if (generation !== lifecycleGeneration)
272
+ return;
273
+ let configPath = pi.getFlag("mcp-config") ?? earlyConfigPath, sessionConfig = loadMcpConfig(configPath, ctx.cwd), sessionCache = loadMetadataCache();
274
+ shouldBackgroundAutostart(sessionConfig, sessionCache) && startSessionInit(generation, pi, ctx);
275
+ }), pi.on("session_shutdown", async () => {
276
+ ++lifecycleGeneration, sessionAbort.abort(new Error("MCP session ended"));
277
+ let currentState = state;
278
+ state = null, initPromise = null, directExecutors.clear();
279
+ try {
280
+ await Promise.all([
281
+ shutdownState(currentState, "session_shutdown"),
282
+ shutdownInitializingStates(),
283
+ shutdownLoadedRuntime()
284
+ ]);
285
+ } catch (error) {
286
+ console.error("MCP: session shutdown cleanup failed", error);
287
+ }
288
+ }), pi.on("tool_result", (event) => toolErrorOverride(event.details)), pi.registerCommand("mcp", {
289
+ description: "Show MCP server status",
290
+ handler: async (args, ctx) => {
291
+ let currentState;
292
+ try {
293
+ currentState = await ensureState(pi, ctx);
294
+ } catch (error) {
295
+ let message = error instanceof Error ? error.message : String(error);
296
+ ctx.hasUI && ctx.ui.notify(`MCP initialization failed: ${message}`, "error");
297
+ return;
298
+ }
299
+ let heavy = await loadHeavyModules();
300
+ assertCurrentState(currentState);
301
+ let parts = args?.trim()?.split(/\s+/) ?? [], subcommand = parts[0] ?? "", targetServer = parts[1], rest = parts.slice(1).join(" ");
302
+ switch (subcommand) {
303
+ case "reconnect":
304
+ await heavy.commands.reconnectServers(currentState, ctx, targetServer);
305
+ break;
306
+ case "tools":
307
+ await heavy.commands.showTools(currentState, ctx);
308
+ break;
309
+ case "setup": {
310
+ if ((await heavy.commands.openMcpSetup(currentState, pi, ctx, earlyConfigPath, "setup"))?.configChanged) {
311
+ await ctx.reload();
312
+ return;
313
+ }
314
+ break;
315
+ }
316
+ case "logout": {
317
+ let serverName = rest;
318
+ if (!serverName) {
319
+ ctx.hasUI && ctx.ui.notify("Usage: /mcp logout <server>", "error");
320
+ return;
321
+ }
322
+ await heavy.commands.logoutServer(serverName, currentState, ctx);
323
+ break;
324
+ }
325
+ default:
326
+ if (ctx.hasUI) {
327
+ if ((await heavy.commands.openMcpPanel(currentState, pi, ctx, earlyConfigPath))?.configChanged) {
328
+ await ctx.reload();
329
+ return;
330
+ }
331
+ } else
332
+ await heavy.commands.showStatus(currentState, ctx);
333
+ break;
334
+ }
335
+ }
336
+ }), pi.registerCommand("mcp-auth", {
337
+ description: "Authenticate with an MCP server (OAuth)",
338
+ handler: async (args, ctx) => {
339
+ let serverName = args?.trim();
340
+ if (!serverName && !ctx.hasUI)
341
+ return;
342
+ let currentState;
343
+ try {
344
+ currentState = await ensureState(pi, ctx);
345
+ } catch (error) {
346
+ let message = error instanceof Error ? error.message : String(error);
347
+ ctx.hasUI && ctx.ui.notify(`MCP initialization failed: ${message}`, "error");
348
+ return;
349
+ }
350
+ let heavy = await loadHeavyModules();
351
+ if (assertCurrentState(currentState), !serverName) {
352
+ await heavy.commands.openMcpAuthPanel(currentState, pi, ctx, earlyConfigPath);
353
+ return;
354
+ }
355
+ await heavy.commands.authenticateServer(serverName, currentState.config, ctx);
356
+ }
357
+ }), shouldRegisterProxyTool && pi.registerTool({
358
+ name: "mcp",
359
+ label: "MCP",
360
+ description: buildProxyDescription(earlyConfig, earlyCache, directSpecs),
361
+ promptSnippet: "MCP gateway - connect to MCP servers and call their tools",
362
+ renderCall: renderMcpProxyToolCall,
363
+ parameters: Type.Object({
364
+ tool: Type.Optional(Type.String({ description: "Tool name to call (e.g., 'xcodebuild_list_sims')" })),
365
+ args: Type.Optional(Type.String({ description: `Arguments as JSON string (e.g., '{"key": "value"}')` })),
366
+ connect: Type.Optional(Type.String({ description: "Server name to connect (lazy connect + metadata refresh)" })),
367
+ describe: Type.Optional(Type.String({ description: "Tool name to describe (shows parameters)" })),
368
+ search: Type.Optional(Type.String({ description: "Search tools by name/description" })),
369
+ regex: Type.Optional(Type.Boolean({ description: "Treat search as regex (default: substring match)" })),
370
+ includeSchemas: Type.Optional(Type.Boolean({ description: "Include parameter schemas in search results (default: true)" })),
371
+ server: Type.Optional(Type.String({ description: "Filter to specific server (also disambiguates tool calls)" })),
372
+ action: Type.Optional(Type.String({ description: "Action: 'ui-messages', 'auth-start', or 'auth-complete'" }))
373
+ }),
374
+ renderResult: renderMcpToolResult,
375
+ async execute(_toolCallId, params, incomingSignal, _onUpdate, ctx) {
376
+ let signal = incomingSignal ? AbortSignal.any([incomingSignal, sessionAbort.signal]) : sessionAbort.signal, parsedArgs;
377
+ if (params.args)
378
+ try {
379
+ if (parsedArgs = JSON.parse(params.args), typeof parsedArgs != "object" || parsedArgs === null || Array.isArray(parsedArgs)) {
380
+ let gotType = Array.isArray(parsedArgs) ? "array" : parsedArgs === null ? "null" : typeof parsedArgs;
381
+ throw new Error(`Invalid args: expected a JSON object, got ${gotType}`);
382
+ }
383
+ } catch (error) {
384
+ throw error instanceof SyntaxError ? new Error(`Invalid args JSON: ${error.message}`, { cause: error }) : error;
385
+ }
386
+ let currentState;
387
+ try {
388
+ currentState = await ensureState(pi, ctx, signal);
389
+ } catch (error) {
390
+ let message = error instanceof Error ? error.message : String(error);
391
+ return {
392
+ content: [{ type: "text", text: `MCP initialization failed: ${message}` }],
393
+ details: { error: "init_failed", message }
394
+ };
395
+ }
396
+ let heavy = await loadHeavyModules();
397
+ if (throwIfAborted(signal), assertCurrentState(currentState), params.action === "ui-messages")
398
+ return heavy.proxyModes.executeUiMessages(currentState);
399
+ if (params.action === "auth-start")
400
+ return params.server ? heavy.proxyModes.executeAuthStart(currentState, params.server) : {
401
+ content: [{ type: "text", text: 'auth-start requires `server`. Example: mcp({ action: "auth-start", server: "linear-server" })' }],
402
+ details: { mode: "auth-start", error: "missing_server" }
403
+ };
404
+ if (params.action === "auth-complete") {
405
+ if (!params.server)
406
+ return {
407
+ content: [{ type: "text", text: "auth-complete requires `server`." }],
408
+ details: { mode: "auth-complete", error: "missing_server" }
409
+ };
410
+ let input = parsedArgs?.redirectUrl ?? parsedArgs?.code ?? parsedArgs?.input;
411
+ return typeof input != "string" || input.trim().length === 0 ? {
412
+ content: [{ type: "text", text: "auth-complete requires args with `redirectUrl`, `code`, or `input`." }],
413
+ details: { mode: "auth-complete", error: "missing_input" }
414
+ } : heavy.proxyModes.executeAuthComplete(currentState, params.server, input);
415
+ }
416
+ return params.tool ? heavy.proxyModes.executeCall(currentState, params.tool, parsedArgs, params.server, getPiTools, signal) : params.connect ? heavy.proxyModes.executeConnect(currentState, params.connect, signal) : params.describe ? heavy.proxyModes.executeDescribe(currentState, params.describe) : params.search ? heavy.proxyModes.executeSearch(currentState, params.search, params.regex, params.server, params.includeSchemas) : params.server ? heavy.proxyModes.executeList(currentState, params.server) : heavy.proxyModes.executeStatus(currentState);
417
+ }
418
+ });
419
+ }
420
+ export {
421
+ mcpAdapter as default
422
+ };