@ashx-j/lunr-dev 0.2.13-dev.8.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 (339) 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/publication.json +12 -12
  87. package/dist/cli-runtime.d.ts +3 -0
  88. package/dist/cli-runtime.d.ts.map +1 -0
  89. package/dist/cli-runtime.js +73 -0
  90. package/dist/cli-runtime.js.map +1 -0
  91. package/dist/cli.d.ts.map +1 -1
  92. package/dist/cli.js +14 -53
  93. package/dist/cli.js.map +1 -1
  94. package/dist/config.d.ts +1 -0
  95. package/dist/config.d.ts.map +1 -1
  96. package/dist/config.js +1 -0
  97. package/dist/config.js.map +1 -1
  98. package/dist/core/agent-session.d.ts +3 -0
  99. package/dist/core/agent-session.d.ts.map +1 -1
  100. package/dist/core/agent-session.js +56 -12
  101. package/dist/core/agent-session.js.map +1 -1
  102. package/dist/core/compaction/compaction.d.ts.map +1 -1
  103. package/dist/core/compaction/compaction.js +10 -5
  104. package/dist/core/compaction/compaction.js.map +1 -1
  105. package/dist/core/extensions/host-static.d.ts.map +1 -1
  106. package/dist/core/extensions/host-static.js +34 -12
  107. package/dist/core/extensions/host-static.js.map +1 -1
  108. package/dist/core/extensions/loader.d.ts +1 -2
  109. package/dist/core/extensions/loader.d.ts.map +1 -1
  110. package/dist/core/extensions/loader.js +10 -64
  111. package/dist/core/extensions/loader.js.map +1 -1
  112. package/dist/core/extensions/types.d.ts +2 -2
  113. package/dist/core/extensions/types.d.ts.map +1 -1
  114. package/dist/core/extensions/types.js.map +1 -1
  115. package/dist/core/footer-data-provider.d.ts.map +1 -1
  116. package/dist/core/footer-data-provider.js +2 -0
  117. package/dist/core/footer-data-provider.js.map +1 -1
  118. package/dist/core/permissions.d.ts +0 -2
  119. package/dist/core/permissions.d.ts.map +1 -1
  120. package/dist/core/permissions.js +10 -18
  121. package/dist/core/permissions.js.map +1 -1
  122. package/dist/core/sdk.d.ts +1 -1
  123. package/dist/core/sdk.d.ts.map +1 -1
  124. package/dist/core/sdk.js +1 -1
  125. package/dist/core/sdk.js.map +1 -1
  126. package/dist/core/slash-commands.d.ts.map +1 -1
  127. package/dist/core/slash-commands.js +0 -1
  128. package/dist/core/slash-commands.js.map +1 -1
  129. package/dist/core/timings.d.ts +2 -1
  130. package/dist/core/timings.d.ts.map +1 -1
  131. package/dist/core/timings.js +17 -2
  132. package/dist/core/timings.js.map +1 -1
  133. package/dist/gateway/commands.d.ts +1 -1
  134. package/dist/gateway/commands.d.ts.map +1 -1
  135. package/dist/gateway/commands.js +1 -18
  136. package/dist/gateway/commands.js.map +1 -1
  137. package/dist/main.d.ts +2 -2
  138. package/dist/main.d.ts.map +1 -1
  139. package/dist/main.js +57 -48
  140. package/dist/main.js.map +1 -1
  141. package/dist/modes/interactive/interactive-mode.d.ts +12 -21
  142. package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
  143. package/dist/modes/interactive/interactive-mode.js +120 -144
  144. package/dist/modes/interactive/interactive-mode.js.map +1 -1
  145. package/dist/modes/interactive/theme/theme.d.ts.map +1 -1
  146. package/dist/modes/interactive/theme/theme.js +95 -84
  147. package/dist/modes/interactive/theme/theme.js.map +1 -1
  148. package/dist/node-runtime/agent-session-services-IFJMSX7Z.js +36 -0
  149. package/dist/node-runtime/benchmark-request-UC7PD3V3.js +57 -0
  150. package/dist/node-runtime/brave-UWDA3I22.js +143 -0
  151. package/dist/node-runtime/builtin-extensions-LYZ3BFWQ.js +28 -0
  152. package/dist/node-runtime/chunk-2QKLKMKC.js +173 -0
  153. package/dist/node-runtime/chunk-3GHXVUAK.js +21 -0
  154. package/dist/node-runtime/chunk-3RCWXWAY.js +466 -0
  155. package/dist/node-runtime/chunk-3WFAEVKS.js +115 -0
  156. package/dist/node-runtime/chunk-3X3KZKMI.js +49 -0
  157. package/dist/node-runtime/chunk-4HXHDDCF.js +16 -0
  158. package/dist/node-runtime/chunk-4TLO4PO2.js +3427 -0
  159. package/dist/node-runtime/chunk-4ZWGEEAS.js +69 -0
  160. package/dist/node-runtime/chunk-53YJI7JU.js +137 -0
  161. package/dist/node-runtime/chunk-5P7PZMRU.js +610 -0
  162. package/dist/node-runtime/chunk-7N3YHTYF.js +26 -0
  163. package/dist/node-runtime/chunk-7NBZ5P7I.js +24 -0
  164. package/dist/node-runtime/chunk-A2KQXUJD.js +105 -0
  165. package/dist/node-runtime/chunk-AD6VXAO7.js +342 -0
  166. package/dist/node-runtime/chunk-AHSTJBIB.js +64 -0
  167. package/dist/node-runtime/chunk-AJX357CL.js +20211 -0
  168. package/dist/node-runtime/chunk-ARC4KOTI.js +11178 -0
  169. package/dist/node-runtime/chunk-AUXVGBO4.js +19 -0
  170. package/dist/node-runtime/chunk-AY6CAJSL.js +30 -0
  171. package/dist/node-runtime/chunk-BHO7O6E5.js +296 -0
  172. package/dist/node-runtime/chunk-BI3DHYCN.js +8845 -0
  173. package/dist/node-runtime/chunk-BR7YDUKA.js +109 -0
  174. package/dist/node-runtime/chunk-BRJX2PRC.js +53 -0
  175. package/dist/node-runtime/chunk-C4O2RSQQ.js +37 -0
  176. package/dist/node-runtime/chunk-CCZJ3PYY.js +17 -0
  177. package/dist/node-runtime/chunk-CDFZEWPU.js +8388 -0
  178. package/dist/node-runtime/chunk-CGBXPL3E.js +1171 -0
  179. package/dist/node-runtime/chunk-CJECDQKP.js +19 -0
  180. package/dist/node-runtime/chunk-DAPBPCBP.js +53 -0
  181. package/dist/node-runtime/chunk-DDGMHUOW.js +305 -0
  182. package/dist/node-runtime/chunk-DMMTJQMQ.js +43 -0
  183. package/dist/node-runtime/chunk-DVGWF6A2.js +1180 -0
  184. package/dist/node-runtime/chunk-ECD5L7YI.js +1369 -0
  185. package/dist/node-runtime/chunk-EDBJNRSM.js +46 -0
  186. package/dist/node-runtime/chunk-F4VQFJI2.js +1269 -0
  187. package/dist/node-runtime/chunk-FVDOXRUD.js +96 -0
  188. package/dist/node-runtime/chunk-GZQHMEWL.js +126 -0
  189. package/dist/node-runtime/chunk-H2EOZYMP.js +57 -0
  190. package/dist/node-runtime/chunk-HQCKFM2O.js +56 -0
  191. package/dist/node-runtime/chunk-HYHJIRDW.js +19 -0
  192. package/dist/node-runtime/chunk-I6R76AG7.js +22 -0
  193. package/dist/node-runtime/chunk-IPA627GP.js +296 -0
  194. package/dist/node-runtime/chunk-JHYKXIMM.js +378 -0
  195. package/dist/node-runtime/chunk-KKSIVROT.js +88 -0
  196. package/dist/node-runtime/chunk-LZAW4ZX3.js +633 -0
  197. package/dist/node-runtime/chunk-M3LZLQW2.js +98 -0
  198. package/dist/node-runtime/chunk-MGWCVY6Y.js +47 -0
  199. package/dist/node-runtime/chunk-MJQDX3BA.js +72 -0
  200. package/dist/node-runtime/chunk-MKKH27PH.js +8956 -0
  201. package/dist/node-runtime/chunk-MX3GJNXJ.js +986 -0
  202. package/dist/node-runtime/chunk-N77MY65L.js +966 -0
  203. package/dist/node-runtime/chunk-NUIFPZWX.js +209 -0
  204. package/dist/node-runtime/chunk-OBMWP3I5.js +68 -0
  205. package/dist/node-runtime/chunk-OR4L3IB2.js +42 -0
  206. package/dist/node-runtime/chunk-PBC2Y6GS.js +903 -0
  207. package/dist/node-runtime/chunk-PCGNAY2O.js +1324 -0
  208. package/dist/node-runtime/chunk-PCIGF2XK.js +250 -0
  209. package/dist/node-runtime/chunk-PGAJ5MO5.js +7558 -0
  210. package/dist/node-runtime/chunk-PL6JKXWI.js +3622 -0
  211. package/dist/node-runtime/chunk-PVCDKGR6.js +55 -0
  212. package/dist/node-runtime/chunk-Q4Q6D4IY.js +364 -0
  213. package/dist/node-runtime/chunk-Q5ZU2VRT.js +83 -0
  214. package/dist/node-runtime/chunk-QFWG2RVL.js +5477 -0
  215. package/dist/node-runtime/chunk-QH42CDX3.js +9451 -0
  216. package/dist/node-runtime/chunk-RQ2Q5IYR.js +72 -0
  217. package/dist/node-runtime/chunk-RQ5DNUNG.js +429 -0
  218. package/dist/node-runtime/chunk-RRIZE6QQ.js +17 -0
  219. package/dist/node-runtime/chunk-SN6G4OU6.js +4753 -0
  220. package/dist/node-runtime/chunk-SWSN6HAB.js +53 -0
  221. package/dist/node-runtime/chunk-TQNSPERU.js +949 -0
  222. package/dist/node-runtime/chunk-VRB2IYGG.js +53 -0
  223. package/dist/node-runtime/chunk-VSELYKWU.js +772 -0
  224. package/dist/node-runtime/chunk-W3CVH5RX.js +62 -0
  225. package/dist/node-runtime/chunk-WJVFOIB5.js +24921 -0
  226. package/dist/node-runtime/chunk-WOVTOV5P.js +5653 -0
  227. package/dist/node-runtime/chunk-XBWPBZBN.js +125 -0
  228. package/dist/node-runtime/chunk-XTHQ7XR7.js +509 -0
  229. package/dist/node-runtime/chunk-YF63P5ZT.js +864 -0
  230. package/dist/node-runtime/chunk-YSKSB3BJ.js +295 -0
  231. package/dist/node-runtime/chunk-ZCHMJ34K.js +130 -0
  232. package/dist/node-runtime/chunk-ZKMFUD3Q.js +2834 -0
  233. package/dist/node-runtime/cli-runtime.js +81 -0
  234. package/dist/node-runtime/clipboard-OZ63BBC6.js +12 -0
  235. package/dist/node-runtime/clipboard-image-7QR6GXVA.js +13 -0
  236. package/dist/node-runtime/command-L3LAHDIH.js +13 -0
  237. package/dist/node-runtime/commands-RL5YBW5I.js +291 -0
  238. package/dist/node-runtime/config-FMEOZSWE.js +77 -0
  239. package/dist/node-runtime/curator-server-XCM43VEF.js +3816 -0
  240. package/dist/node-runtime/customize-XEXL2DGQ.js +12 -0
  241. package/dist/node-runtime/direct-tool-executor-JVDXTO7A.js +188 -0
  242. package/dist/node-runtime/exa-LL64QZR2.js +329 -0
  243. package/dist/node-runtime/export-html-KR26FOUZ.js +150 -0
  244. package/dist/node-runtime/extension-input-RV5N6APL.js +14 -0
  245. package/dist/node-runtime/extension-selector-CPD5LWDD.js +14 -0
  246. package/dist/node-runtime/extract-XLQSJN4V.js +17 -0
  247. package/dist/node-runtime/file-sync-HCOP2QVF.js +117 -0
  248. package/dist/node-runtime/gateway-X2TI5X7F.js +2484 -0
  249. package/dist/node-runtime/gemini-api-QE7ANVDZ.js +29 -0
  250. package/dist/node-runtime/gemini-search-U7SUMPQA.js +330 -0
  251. package/dist/node-runtime/gemini-url-context-PXWCBQHK.js +103 -0
  252. package/dist/node-runtime/gemini-web-MM446SEH.js +14 -0
  253. package/dist/node-runtime/github-extract-F64RZOEA.js +619 -0
  254. package/dist/node-runtime/goal-CZQ7FFQJ.js +1831 -0
  255. package/dist/node-runtime/index.js +859 -0
  256. package/dist/node-runtime/init-NJV2T55N.js +28 -0
  257. package/dist/node-runtime/install-cli-TH7IJJQQ.js +308 -0
  258. package/dist/node-runtime/interactive-mode-KOM35YF2.js +56 -0
  259. package/dist/node-runtime/interactive-view-U6OILKF3.js +249 -0
  260. package/dist/node-runtime/lsp-manager-3ASUSO4T.js +1104 -0
  261. package/dist/node-runtime/lunr-cron-YJ5UHYRD.js +268 -0
  262. package/dist/node-runtime/main.js +54 -0
  263. package/dist/node-runtime/mcp-auth-flow-QIXHW6QN.js +32 -0
  264. package/dist/node-runtime/mcp-panel-IIGMXQGP.js +501 -0
  265. package/dist/node-runtime/mcp-setup-panel-FEK7663I.js +355 -0
  266. package/dist/node-runtime/memory-cap-3S4XRLNP.js +20 -0
  267. package/dist/node-runtime/model-tiers-NJLHUEGK.js +20 -0
  268. package/dist/node-runtime/openai-search-B3MSNCQA.js +288 -0
  269. package/dist/node-runtime/package-manager-cli-TZZHJCVI.js +749 -0
  270. package/dist/node-runtime/parallel-AI2MNSCU.js +265 -0
  271. package/dist/node-runtime/parser-manager-TQHWYDH7.js +152 -0
  272. package/dist/node-runtime/pdf-extract-IPE6H4HP.js +57 -0
  273. package/dist/node-runtime/perplexity-QVJW3I35.js +12 -0
  274. package/dist/node-runtime/pi-intercom-EEMBGQID.js +2215 -0
  275. package/dist/node-runtime/pi-mcp-adapter-QFB37AVN.js +422 -0
  276. package/dist/node-runtime/pi-ollama-cloud-4VZRMULP.js +1440 -0
  277. package/dist/node-runtime/pi-prompt-template-model-4QT4LLXF.js +3946 -0
  278. package/dist/node-runtime/pi-subagents-7XJ4H53P.js +6023 -0
  279. package/dist/node-runtime/pi-web-access-DPGAVKOA.js +1864 -0
  280. package/dist/node-runtime/print-mode-VWIRFDAC.js +12 -0
  281. package/dist/node-runtime/proxy-modes-HEEFK4KC.js +685 -0
  282. package/dist/node-runtime/rpc-entry.js +62 -0
  283. package/dist/node-runtime/rpc-mode-SJNSOA4G.js +13 -0
  284. package/dist/node-runtime/runtime-bridges-PPHNBFWL.js +14 -0
  285. package/dist/node-runtime/session-manager-MQNBYACL.js +35 -0
  286. package/dist/node-runtime/session-selector-5AZLJS6U.js +14 -0
  287. package/dist/node-runtime/settings-manager-5LF2VQWC.js +21 -0
  288. package/dist/node-runtime/src-Y7JSCK64.js +2407 -0
  289. package/dist/node-runtime/subagent-executor-5RNDEPIJ.js +8483 -0
  290. package/dist/node-runtime/summary-review-YSMXKITO.js +228 -0
  291. package/dist/node-runtime/tavily-WEZFVFP7.js +154 -0
  292. package/dist/node-runtime/timings-UAD5BEAS.js +16 -0
  293. package/dist/node-runtime/tool-renderer-MV5O452K.js +204 -0
  294. package/dist/node-runtime/update-cli-A253SZ7P.js +73 -0
  295. package/dist/node-runtime/v4-5MNC3H7G.js +424 -0
  296. package/dist/node-runtime/video-extract-OYT5WKS5.js +304 -0
  297. package/dist/node-runtime/workspace-index-6DBXSTJ6.js +163 -0
  298. package/dist/node-runtime/youtube-extract-TQYKGFGS.js +264 -0
  299. package/dist/startup/benchmark-request.d.ts +3 -0
  300. package/dist/startup/benchmark-request.d.ts.map +1 -0
  301. package/dist/startup/benchmark-request.js +65 -0
  302. package/dist/startup/benchmark-request.js.map +1 -0
  303. package/dist/startup/interactive-view.d.ts +55 -0
  304. package/dist/startup/interactive-view.d.ts.map +1 -0
  305. package/dist/startup/interactive-view.js +332 -0
  306. package/dist/startup/interactive-view.js.map +1 -0
  307. package/dist/startup/launch-routing.d.ts.map +1 -1
  308. package/dist/startup/launch-routing.js +9 -10
  309. package/dist/startup/launch-routing.js.map +1 -1
  310. package/dist/startup/startup-milestones.d.ts +1 -1
  311. package/dist/startup/startup-milestones.d.ts.map +1 -1
  312. package/dist/startup/startup-milestones.js +3 -2
  313. package/dist/startup/startup-milestones.js.map +1 -1
  314. package/dist/utils/await-with-abort.d.ts +2 -0
  315. package/dist/utils/await-with-abort.d.ts.map +1 -0
  316. package/dist/utils/await-with-abort.js +19 -0
  317. package/dist/utils/await-with-abort.js.map +1 -0
  318. package/dist/utils/syntax-highlight.d.ts.map +1 -1
  319. package/dist/utils/syntax-highlight.js +10 -4
  320. package/dist/utils/syntax-highlight.js.map +1 -1
  321. package/docs/compaction.md +5 -3
  322. package/docs/development.md +5 -1
  323. package/docs/features.md +0 -1
  324. package/docs/interactive-startup.md +98 -0
  325. package/docs/usage.md +0 -1
  326. package/examples/extensions/custom-provider-anthropic/package-lock.json +2 -2
  327. package/examples/extensions/custom-provider-anthropic/package.json +1 -1
  328. package/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
  329. package/examples/extensions/gondolin/package-lock.json +2 -2
  330. package/examples/extensions/gondolin/package.json +1 -1
  331. package/examples/extensions/sandbox/package-lock.json +2 -2
  332. package/examples/extensions/sandbox/package.json +1 -1
  333. package/examples/extensions/with-deps/package-lock.json +2 -2
  334. package/examples/extensions/with-deps/package.json +1 -1
  335. package/package.json +20 -20
  336. package/dist/core/swarm.d.ts +0 -23
  337. package/dist/core/swarm.d.ts.map +0 -1
  338. package/dist/core/swarm.js +0 -45
  339. package/dist/core/swarm.js.map +0 -1
@@ -0,0 +1,501 @@
1
+ import { createRequire as __lunrRequire } from "node:module"; const require = __lunrRequire(import.meta.url);
2
+ import {
3
+ isToolExcluded,
4
+ resourceNameToToolName
5
+ } from "./chunk-ARC4KOTI.js";
6
+ import {
7
+ createPanelKeys
8
+ } from "./chunk-HYHJIRDW.js";
9
+ import "./chunk-BRJX2PRC.js";
10
+
11
+ // packages/coding-agent/dist/builtin-extensions/pi-mcp-adapter/mcp-panel.js
12
+ import { matchesKey, truncateToWidth, visibleWidth } from "@ashx-j/lunr-tui";
13
+ var DEFAULT_THEME = {
14
+ border: "2",
15
+ title: "2",
16
+ selected: "36",
17
+ direct: "32",
18
+ needsAuth: "33",
19
+ placeholder: "2;3",
20
+ description: "2",
21
+ hint: "2",
22
+ confirm: "32",
23
+ cancel: "31"
24
+ };
25
+ function fg(code, text) {
26
+ return code ? `\x1B[${code}m${text}\x1B[0m` : text;
27
+ }
28
+ var RAINBOW_COLORS = [
29
+ "38;2;178;129;214",
30
+ "38;2;215;135;175",
31
+ "38;2;254;188;56",
32
+ "38;2;228;192;15",
33
+ "38;2;137;210;129",
34
+ "38;2;0;175;175",
35
+ "38;2;23;143;185"
36
+ ];
37
+ function rainbowProgress(filled, total) {
38
+ let dots = [];
39
+ for (let i = 0; i < total; i++) {
40
+ let color = RAINBOW_COLORS[i % RAINBOW_COLORS.length];
41
+ dots.push(fg(color, i < filled ? "\u25CF" : "\u25CB"));
42
+ }
43
+ return dots.join(" ");
44
+ }
45
+ function fuzzyScore(query, text) {
46
+ let lq = query.toLowerCase(), lt = text.toLowerCase();
47
+ if (lt.includes(lq))
48
+ return 100 + lq.length / lt.length * 50;
49
+ let score = 0, qi = 0, consecutive = 0;
50
+ for (let i = 0; i < lt.length && qi < lq.length; i++)
51
+ lt[i] === lq[qi] ? (score += 10 + consecutive, consecutive += 5, qi++) : consecutive = 0;
52
+ return qi === lq.length ? score : 0;
53
+ }
54
+ function sanitizeDisplayText(text) {
55
+ return (text ?? "").replace(/(?:\x1b\][\s\S]*?(?:\x07|\x1b\\)|\x9d[\s\S]*?(?:\x07|\x1b\\|\x9c))/g, "").replace(/(?:\x1b\[[0-?]*[ -/]*[@-~]|\x1b[@-Z\\-_])/g, "").replace(/[\u0000-\u001f\u007f-\u009f]+/g, " ").replace(/\s+/g, " ").trim();
56
+ }
57
+ function sanitizeRowContent(content) {
58
+ let result = "", pendingSpace = !1;
59
+ for (let i = 0; i < content.length; i++) {
60
+ let rest = content.slice(i), osc = rest.match(/^(?:\x1b\][\s\S]*?(?:\x07|\x1b\\)|\x9d[\s\S]*?(?:\x07|\x1b\\|\x9c))/);
61
+ if (osc) {
62
+ i += osc[0].length - 1;
63
+ continue;
64
+ }
65
+ let ansi = rest.match(/^(?:\x1b\[[0-?]*[ -/]*[@-~]|\x1b[@-Z\\-_])/);
66
+ if (ansi) {
67
+ result += ansi[0], i += ansi[0].length - 1;
68
+ continue;
69
+ }
70
+ let code = content.charCodeAt(i);
71
+ if (code <= 31 || code === 127 || code >= 128 && code <= 159) {
72
+ pendingSpace = !0;
73
+ continue;
74
+ }
75
+ pendingSpace && result && !result.endsWith(" ") && (result += " "), pendingSpace = !1, result += content[i];
76
+ }
77
+ return result;
78
+ }
79
+ function estimateTokens(tool) {
80
+ let schemaLen = JSON.stringify(tool.inputSchema ?? {}).length, descLen = tool.description?.length ?? 0;
81
+ return Math.ceil((tool.name.length + descLen + schemaLen) / 4) + 10;
82
+ }
83
+ var McpPanel = class _McpPanel {
84
+ callbacks;
85
+ done;
86
+ noticeLines;
87
+ prefix;
88
+ servers = [];
89
+ cursorIndex = 0;
90
+ nameQuery = "";
91
+ descSearchActive = !1;
92
+ descQuery = "";
93
+ dirty = !1;
94
+ confirmingDiscard = !1;
95
+ discardSelected = 1;
96
+ importNotice = null;
97
+ authNotice = null;
98
+ authInFlight = null;
99
+ inactivityTimeout = null;
100
+ visibleItems = [];
101
+ tui;
102
+ t = DEFAULT_THEME;
103
+ authOnly;
104
+ keys;
105
+ static MAX_VISIBLE = 12;
106
+ static INACTIVITY_MS = 6e4;
107
+ constructor(config, cache, provenance, callbacks, tui, done, options = {}) {
108
+ this.callbacks = callbacks, this.done = done, this.tui = tui, this.noticeLines = options.noticeLines ?? [], this.authOnly = options.authOnly === !0, this.keys = createPanelKeys(options.keybindings), this.prefix = config.settings?.toolPrefix ?? "server";
109
+ for (let [serverName, definition] of Object.entries(config.mcpServers)) {
110
+ if (this.authOnly && !callbacks.canAuthenticate(serverName))
111
+ continue;
112
+ let prov = provenance.get(serverName), serverCache = cache?.servers?.[serverName], globalDirect = config.settings?.directTools, toolFilter = !1;
113
+ definition.directTools !== void 0 ? toolFilter = definition.directTools : globalDirect && (toolFilter = globalDirect);
114
+ let tools = [];
115
+ if (serverCache && !this.authOnly) {
116
+ for (let tool of serverCache.tools ?? []) {
117
+ if (isToolExcluded(tool.name, serverName, this.prefix, definition.excludeTools))
118
+ continue;
119
+ let isDirect = toolFilter === !0 || Array.isArray(toolFilter) && toolFilter.includes(tool.name);
120
+ tools.push({
121
+ name: tool.name,
122
+ description: tool.description ?? "",
123
+ isDirect,
124
+ wasDirect: isDirect,
125
+ estimatedTokens: estimateTokens(tool)
126
+ });
127
+ }
128
+ if (definition.exposeResources !== !1)
129
+ for (let resource of serverCache.resources ?? []) {
130
+ let baseName = `get_${resourceNameToToolName(resource.name)}`;
131
+ if (isToolExcluded(baseName, serverName, this.prefix, definition.excludeTools))
132
+ continue;
133
+ let isDirect = toolFilter === !0 || Array.isArray(toolFilter) && toolFilter.includes(baseName), ct = { name: baseName, description: resource.description };
134
+ tools.push({
135
+ name: baseName,
136
+ description: resource.description ?? `Read resource: ${resource.uri}`,
137
+ isDirect,
138
+ wasDirect: isDirect,
139
+ estimatedTokens: estimateTokens(ct)
140
+ });
141
+ }
142
+ }
143
+ let status = callbacks.getConnectionStatus(serverName);
144
+ this.servers.push({
145
+ name: serverName,
146
+ expanded: !1,
147
+ source: prov?.kind ?? "user",
148
+ importKind: prov?.importKind,
149
+ excludeTools: definition.excludeTools,
150
+ exposeResources: definition.exposeResources !== !1,
151
+ connectionStatus: status,
152
+ tools,
153
+ hasCachedData: !!serverCache
154
+ });
155
+ }
156
+ this.rebuildVisibleItems(), this.resetInactivityTimeout();
157
+ }
158
+ resetInactivityTimeout() {
159
+ this.inactivityTimeout && clearTimeout(this.inactivityTimeout), this.inactivityTimeout = setTimeout(() => {
160
+ this.cleanup(), this.done({ cancelled: !0, changes: /* @__PURE__ */ new Map() });
161
+ }, _McpPanel.INACTIVITY_MS);
162
+ }
163
+ cleanup() {
164
+ this.inactivityTimeout && (clearTimeout(this.inactivityTimeout), this.inactivityTimeout = null);
165
+ }
166
+ rebuildVisibleItems() {
167
+ let query = this.descSearchActive ? this.descQuery : this.nameQuery, mode = this.descSearchActive ? "desc" : "name";
168
+ this.visibleItems = [];
169
+ for (let si = 0; si < this.servers.length; si++) {
170
+ let server = this.servers[si];
171
+ if (query && this.authOnly) {
172
+ (mode === "name" ? fuzzyScore(query, server.name) : 0) > 0 && this.visibleItems.push({ type: "server", serverIndex: si });
173
+ continue;
174
+ }
175
+ if (this.visibleItems.push({ type: "server", serverIndex: si }), server.expanded || query)
176
+ for (let ti = 0; ti < server.tools.length; ti++) {
177
+ let tool = server.tools[ti];
178
+ query && (mode === "name" ? Math.max(fuzzyScore(query, tool.name), fuzzyScore(query, server.name) * 0.6) : fuzzyScore(query, tool.description)) === 0 || this.visibleItems.push({ type: "tool", serverIndex: si, toolIndex: ti });
179
+ }
180
+ }
181
+ query && !this.authOnly && (this.visibleItems = this.visibleItems.filter((item) => item.type === "server" ? this.visibleItems.some((other) => other.type === "tool" && other.serverIndex === item.serverIndex) : !0));
182
+ }
183
+ updateDirty() {
184
+ this.dirty = this.servers.some((s) => s.tools.some((t) => t.isDirect !== t.wasDirect));
185
+ }
186
+ buildResult() {
187
+ let changes = /* @__PURE__ */ new Map();
188
+ for (let server of this.servers) {
189
+ if (!server.tools.some((t) => t.isDirect !== t.wasDirect))
190
+ continue;
191
+ let directTools = server.tools.filter((t) => t.isDirect);
192
+ directTools.length === server.tools.length && server.tools.length > 0 ? changes.set(server.name, !0) : directTools.length === 0 ? changes.set(server.name, !1) : changes.set(server.name, directTools.map((t) => t.name));
193
+ }
194
+ return { changes, cancelled: !1 };
195
+ }
196
+ handleInput(data) {
197
+ if (this.resetInactivityTimeout(), this.importNotice = null, this.authInFlight || (this.authNotice = null), this.confirmingDiscard) {
198
+ this.handleDiscardInput(data);
199
+ return;
200
+ }
201
+ if (matchesKey(data, "ctrl+c")) {
202
+ this.cleanup(), this.done({ cancelled: !0, changes: /* @__PURE__ */ new Map() });
203
+ return;
204
+ }
205
+ if (matchesKey(data, "ctrl+s")) {
206
+ this.cleanup(), this.done(this.buildResult());
207
+ return;
208
+ }
209
+ if (this.descSearchActive) {
210
+ if (matchesKey(data, "escape") || this.keys.selectConfirm(data)) {
211
+ this.descSearchActive = !1, this.descQuery = "", this.rebuildVisibleItems(), this.cursorIndex = Math.min(this.cursorIndex, Math.max(0, this.visibleItems.length - 1));
212
+ return;
213
+ }
214
+ if (matchesKey(data, "backspace")) {
215
+ this.descQuery.length > 0 && (this.descQuery = this.descQuery.slice(0, -1), this.rebuildVisibleItems(), this.cursorIndex = Math.min(this.cursorIndex, Math.max(0, this.visibleItems.length - 1)));
216
+ return;
217
+ }
218
+ if (this.keys.selectUp(data)) {
219
+ this.moveCursor(-1);
220
+ return;
221
+ }
222
+ if (this.keys.selectDown(data)) {
223
+ this.moveCursor(1);
224
+ return;
225
+ }
226
+ if (matchesKey(data, "space")) {
227
+ let item = this.visibleItems[this.cursorIndex];
228
+ item && this.toggleItem(item);
229
+ return;
230
+ }
231
+ if (data.length === 1 && data.charCodeAt(0) >= 32) {
232
+ this.descQuery += data, this.rebuildVisibleItems(), this.cursorIndex = Math.min(this.cursorIndex, Math.max(0, this.visibleItems.length - 1));
233
+ return;
234
+ }
235
+ return;
236
+ }
237
+ if (matchesKey(data, "escape")) {
238
+ if (this.nameQuery) {
239
+ this.nameQuery = "", this.rebuildVisibleItems(), this.cursorIndex = Math.min(this.cursorIndex, Math.max(0, this.visibleItems.length - 1));
240
+ return;
241
+ }
242
+ if (this.dirty) {
243
+ this.confirmingDiscard = !0, this.discardSelected = 1;
244
+ return;
245
+ }
246
+ this.cleanup(), this.done({ cancelled: !0, changes: /* @__PURE__ */ new Map() });
247
+ return;
248
+ }
249
+ if (this.keys.selectUp(data)) {
250
+ this.moveCursor(-1);
251
+ return;
252
+ }
253
+ if (this.keys.selectDown(data)) {
254
+ this.moveCursor(1);
255
+ return;
256
+ }
257
+ if (matchesKey(data, "space")) {
258
+ let item = this.visibleItems[this.cursorIndex];
259
+ item && !this.authOnly && this.toggleItem(item);
260
+ return;
261
+ }
262
+ if (this.keys.selectConfirm(data)) {
263
+ let item = this.visibleItems[this.cursorIndex];
264
+ if (!item)
265
+ return;
266
+ let server = this.servers[item.serverIndex];
267
+ if (item.type === "server") {
268
+ if (this.authOnly || server.connectionStatus === "needs-auth") {
269
+ this.authenticateServer(server);
270
+ return;
271
+ }
272
+ server.expanded = !server.expanded, this.rebuildVisibleItems(), this.cursorIndex = Math.min(this.cursorIndex, Math.max(0, this.visibleItems.length - 1));
273
+ } else if (item.toolIndex !== void 0) {
274
+ let tool = server.tools[item.toolIndex];
275
+ tool.isDirect = !tool.isDirect, tool.isDirect && server.source === "import" && (this.importNotice = `Imported from ${sanitizeDisplayText(server.importKind ?? "external")} \u2014 will copy to user config on save`), this.updateDirty();
276
+ }
277
+ return;
278
+ }
279
+ if (matchesKey(data, "ctrl+a")) {
280
+ let item = this.visibleItems[this.cursorIndex];
281
+ item && this.authenticateSelectedServer(item);
282
+ return;
283
+ }
284
+ if (matchesKey(data, "ctrl+r")) {
285
+ let item = this.visibleItems[this.cursorIndex];
286
+ if (!item)
287
+ return;
288
+ let server = this.servers[item.serverIndex];
289
+ if (server.connectionStatus === "connecting")
290
+ return;
291
+ server.connectionStatus = "connecting", this.callbacks.reconnect(server.name).then(() => {
292
+ if (server.connectionStatus = this.callbacks.getConnectionStatus(server.name), server.connectionStatus === "connected") {
293
+ let entry = this.callbacks.refreshCacheAfterReconnect(server.name);
294
+ entry && this.rebuildServerTools(server, entry), server.hasCachedData = !0;
295
+ }
296
+ this.tui.requestRender();
297
+ }).catch((error) => {
298
+ server.connectionStatus = "failed";
299
+ let message = sanitizeDisplayText(error instanceof Error ? error.message : String(error)), serverName = sanitizeDisplayText(server.name);
300
+ this.authNotice = `Reconnect failed for ${serverName}: ${message}`, this.tui.requestRender();
301
+ });
302
+ return;
303
+ }
304
+ if (data === "?") {
305
+ if (this.authOnly)
306
+ return;
307
+ this.descSearchActive = !0, this.descQuery = "", this.rebuildVisibleItems(), this.cursorIndex = Math.min(this.cursorIndex, Math.max(0, this.visibleItems.length - 1));
308
+ return;
309
+ }
310
+ if (matchesKey(data, "backspace")) {
311
+ this.nameQuery.length > 0 && (this.nameQuery = this.nameQuery.slice(0, -1), this.rebuildVisibleItems(), this.cursorIndex = Math.min(this.cursorIndex, Math.max(0, this.visibleItems.length - 1)));
312
+ return;
313
+ }
314
+ if (data.length === 1 && data.charCodeAt(0) >= 32) {
315
+ this.nameQuery += data, this.rebuildVisibleItems(), this.cursorIndex = Math.min(this.cursorIndex, Math.max(0, this.visibleItems.length - 1));
316
+ return;
317
+ }
318
+ }
319
+ authenticateSelectedServer(item) {
320
+ this.authenticateServer(this.servers[item.serverIndex]);
321
+ }
322
+ authenticateServer(server) {
323
+ if (this.authInFlight)
324
+ return;
325
+ let serverName = sanitizeDisplayText(server.name);
326
+ if (!this.callbacks.canAuthenticate(server.name)) {
327
+ this.authNotice = `${serverName} does not use OAuth authentication.`;
328
+ return;
329
+ }
330
+ this.authInFlight = server.name, this.authNotice = `Authenticating ${serverName}...`, this.tui.requestRender(), this.callbacks.authenticate(server.name).then((result) => {
331
+ server.connectionStatus = this.callbacks.getConnectionStatus(server.name);
332
+ let message = sanitizeDisplayText(result.message);
333
+ this.authNotice = result.ok ? `OAuth finished for ${serverName}. Run reconnect if it is still idle.` : `OAuth failed for ${serverName}${message ? `: ${message}` : ". Check the notification for details."}`, this.authInFlight = null, this.tui.requestRender();
334
+ }).catch((error) => {
335
+ let message = sanitizeDisplayText(error instanceof Error ? error.message : String(error));
336
+ server.connectionStatus = this.callbacks.getConnectionStatus(server.name), this.authNotice = `OAuth failed for ${serverName}: ${message}`, this.authInFlight = null, this.tui.requestRender();
337
+ });
338
+ }
339
+ toggleItem(item) {
340
+ if (this.authOnly)
341
+ return;
342
+ let server = this.servers[item.serverIndex];
343
+ if (item.type === "server") {
344
+ let newState = !server.tools.every((t) => t.isDirect);
345
+ server.source === "import" && newState && (this.importNotice = `Imported from ${sanitizeDisplayText(server.importKind ?? "external")} \u2014 will copy to user config on save`);
346
+ for (let t of server.tools)
347
+ t.isDirect = newState;
348
+ } else if (item.toolIndex !== void 0) {
349
+ let tool = server.tools[item.toolIndex];
350
+ tool.isDirect = !tool.isDirect, tool.isDirect && server.source === "import" && (this.importNotice = `Imported from ${sanitizeDisplayText(server.importKind ?? "external")} \u2014 will copy to user config on save`);
351
+ }
352
+ this.updateDirty();
353
+ }
354
+ handleDiscardInput(data) {
355
+ if (matchesKey(data, "ctrl+c")) {
356
+ this.cleanup(), this.done({ cancelled: !0, changes: /* @__PURE__ */ new Map() });
357
+ return;
358
+ }
359
+ if (matchesKey(data, "escape") || data === "n" || data === "N") {
360
+ this.confirmingDiscard = !1;
361
+ return;
362
+ }
363
+ if (this.keys.selectConfirm(data)) {
364
+ this.cleanup(), this.discardSelected === 0 ? this.done({ cancelled: !0, changes: /* @__PURE__ */ new Map() }) : this.done(this.buildResult());
365
+ return;
366
+ }
367
+ if (data === "y" || data === "Y") {
368
+ this.cleanup(), this.done({ cancelled: !0, changes: /* @__PURE__ */ new Map() });
369
+ return;
370
+ }
371
+ (matchesKey(data, "left") || matchesKey(data, "right") || matchesKey(data, "tab")) && (this.discardSelected = this.discardSelected === 0 ? 1 : 0);
372
+ }
373
+ moveCursor(delta) {
374
+ this.visibleItems.length !== 0 && (this.cursorIndex = Math.max(0, Math.min(this.visibleItems.length - 1, this.cursorIndex + delta)));
375
+ }
376
+ rebuildServerTools(server, entry) {
377
+ let existingState = /* @__PURE__ */ new Map();
378
+ for (let t of server.tools)
379
+ existingState.set(t.name, t.isDirect);
380
+ let newTools = [];
381
+ for (let tool of entry.tools ?? []) {
382
+ if (isToolExcluded(tool.name, server.name, this.prefix, server.excludeTools))
383
+ continue;
384
+ let prev = existingState.get(tool.name), isDirect = prev !== void 0 ? prev : !1;
385
+ newTools.push({
386
+ name: tool.name,
387
+ description: tool.description ?? "",
388
+ isDirect,
389
+ wasDirect: prev !== void 0 ? server.tools.find((t) => t.name === tool.name)?.wasDirect ?? !1 : !1,
390
+ estimatedTokens: estimateTokens(tool)
391
+ });
392
+ }
393
+ if (server.exposeResources)
394
+ for (let resource of entry.resources ?? []) {
395
+ let baseName = `get_${resourceNameToToolName(resource.name)}`;
396
+ if (isToolExcluded(baseName, server.name, this.prefix, server.excludeTools))
397
+ continue;
398
+ let prev = existingState.get(baseName), isDirect = prev !== void 0 ? prev : !1, ct = { name: baseName, description: resource.description };
399
+ newTools.push({
400
+ name: baseName,
401
+ description: resource.description ?? `Read resource: ${resource.uri}`,
402
+ isDirect,
403
+ wasDirect: prev !== void 0 ? server.tools.find((t) => t.name === baseName)?.wasDirect ?? !1 : !1,
404
+ estimatedTokens: estimateTokens(ct)
405
+ });
406
+ }
407
+ server.tools = newTools, this.rebuildVisibleItems(), this.updateDirty();
408
+ }
409
+ render(width) {
410
+ let innerW = width - 2, lines = [], t = this.t, bold = (s) => `\x1B[1m${s}\x1B[22m`, italic = (s) => `\x1B[3m${s}\x1B[23m`, inverse = (s) => `\x1B[7m${s}\x1B[27m`, row = (content) => fg(t.border, "\u2502") + truncateToWidth(" " + sanitizeRowContent(content), innerW, "\u2026", !0) + fg(t.border, "\u2502"), emptyRow = () => fg(t.border, "\u2502") + " ".repeat(innerW) + fg(t.border, "\u2502"), divider = () => fg(t.border, "\u251C" + "\u2500".repeat(innerW) + "\u2524"), titleText = this.authOnly ? " MCP OAuth " : " MCP Servers ", borderLen = innerW - visibleWidth(titleText), leftB = Math.floor(borderLen / 2), rightB = borderLen - leftB;
411
+ lines.push(fg(t.border, "\u256D" + "\u2500".repeat(leftB)) + fg(t.title, titleText) + fg(t.border, "\u2500".repeat(rightB) + "\u256E")), lines.push(emptyRow());
412
+ let cursor = fg(t.selected, "\u2502"), searchIcon = fg(t.border, "\u25CE");
413
+ if (this.descSearchActive ? lines.push(row(`${searchIcon} ${fg(t.needsAuth, "desc:")} ${this.descQuery}${cursor}`)) : this.nameQuery ? lines.push(row(`${searchIcon} ${this.nameQuery}${cursor}`)) : lines.push(row(`${searchIcon} ${fg(t.placeholder, italic("search..."))}`)), lines.push(emptyRow()), this.noticeLines.length > 0) {
414
+ for (let notice of this.noticeLines)
415
+ lines.push(row(fg(t.hint, italic(sanitizeDisplayText(notice)))));
416
+ lines.push(emptyRow());
417
+ }
418
+ if (lines.push(divider()), this.servers.length === 0)
419
+ lines.push(emptyRow()), lines.push(row(fg(t.hint, italic(this.authOnly ? "No OAuth-capable MCP servers configured." : "No MCP servers configured.")))), lines.push(emptyRow());
420
+ else {
421
+ let maxVis = _McpPanel.MAX_VISIBLE, total = this.visibleItems.length, startIdx = Math.max(0, Math.min(this.cursorIndex - Math.floor(maxVis / 2), total - maxVis)), endIdx = Math.min(startIdx + maxVis, total);
422
+ lines.push(emptyRow());
423
+ for (let i = startIdx; i < endIdx; i++) {
424
+ let item = this.visibleItems[i], isCursor = i === this.cursorIndex, server = this.servers[item.serverIndex];
425
+ item.type === "server" ? lines.push(row(this.renderServerRow(server, isCursor))) : item.toolIndex !== void 0 && lines.push(row(this.renderToolRow(server.tools[item.toolIndex], isCursor, innerW)));
426
+ }
427
+ if (lines.push(emptyRow()), total > maxVis) {
428
+ let prog = Math.round((this.cursorIndex + 1) / total * 10);
429
+ lines.push(row(`${rainbowProgress(prog, 10)} ${fg(t.hint, `${this.cursorIndex + 1}/${total}`)}`)), lines.push(emptyRow());
430
+ }
431
+ this.importNotice && (lines.push(row(fg(t.needsAuth, italic(sanitizeDisplayText(this.importNotice))))), lines.push(emptyRow())), this.authNotice && (lines.push(row(fg(t.needsAuth, italic(sanitizeDisplayText(this.authNotice))))), lines.push(emptyRow()));
432
+ }
433
+ if (lines.push(divider()), lines.push(emptyRow()), this.confirmingDiscard) {
434
+ let discardBtn = this.discardSelected === 0 ? inverse(bold(fg(t.cancel, " Discard "))) : fg(t.hint, " Discard "), keepBtn = this.discardSelected === 1 ? inverse(bold(fg(t.confirm, " Keep & Close "))) : fg(t.hint, " Keep & Close ");
435
+ lines.push(row(`Discard unsaved changes? ${discardBtn} ${keepBtn}`));
436
+ } else if (this.authOnly)
437
+ lines.push(row(fg(t.description, "select a server to authenticate")));
438
+ else {
439
+ let directCount = this.servers.reduce((sum, s) => sum + s.tools.filter((t2) => t2.isDirect).length, 0), totalTokens = this.servers.reduce((sum, s) => sum + s.tools.filter((t2) => t2.isDirect).reduce((ts, t2) => ts + t2.estimatedTokens, 0), 0), stats = directCount > 0 ? `${directCount} direct ~${totalTokens.toLocaleString()} tokens` : "no direct tools";
440
+ lines.push(row(fg(t.description, stats + (this.dirty ? fg(t.needsAuth, " (unsaved)") : ""))));
441
+ }
442
+ lines.push(emptyRow());
443
+ let hints = this.authOnly ? [
444
+ italic("\u2191\u2193") + " navigate",
445
+ italic("\u23CE") + " auth",
446
+ italic("ctrl+a") + " auth",
447
+ italic("esc") + " clear/close",
448
+ italic("ctrl+c") + " quit"
449
+ ] : [
450
+ italic("\u2191\u2193") + " navigate",
451
+ italic("space") + " toggle",
452
+ italic("\u23CE") + " expand/auth",
453
+ italic("ctrl+a") + " auth",
454
+ italic("ctrl+r") + " reconnect",
455
+ italic("?") + " desc search",
456
+ italic("ctrl+s") + " save",
457
+ italic("esc") + " clear/close",
458
+ italic("ctrl+c") + " quit"
459
+ ], gap = " ", gapW = 2, maxW = innerW - 2, curLine = "", curW = 0;
460
+ for (let hint of hints) {
461
+ let hw = visibleWidth(hint), needed = curW === 0 ? hw : gapW + hw;
462
+ curW > 0 && curW + needed > maxW ? (lines.push(row(fg(t.hint, curLine))), curLine = hint, curW = hw) : (curLine += (curW > 0 ? gap : "") + hint, curW += needed);
463
+ }
464
+ return curLine && lines.push(row(fg(t.hint, curLine))), lines.push(fg(t.border, "\u2570" + "\u2500".repeat(innerW) + "\u256F")), lines;
465
+ }
466
+ renderServerRow(server, isCursor) {
467
+ let t = this.t, bold = (s) => `\x1B[1m${s}\x1B[22m`, expandIcon = server.expanded ? "\u25BE" : "\u25B8", prefix = isCursor ? fg(t.selected, expandIcon) : fg(t.border, server.expanded ? expandIcon : "\xB7"), serverName = sanitizeDisplayText(server.name), importKind = sanitizeDisplayText(server.importKind ?? "import"), nameStr = isCursor ? bold(fg(t.selected, serverName)) : serverName, importLabel = server.source === "import" ? fg(t.description, ` (${importKind})`) : "", statusLabel = this.renderConnectionStatus(server);
468
+ if (!server.hasCachedData && !this.authOnly)
469
+ return `${prefix} ${nameStr}${importLabel} ${fg(t.description, "(not cached)")}${statusLabel}`;
470
+ let directCount = server.tools.filter((t2) => t2.isDirect).length, totalCount = server.tools.length, toggleIcon = fg(t.description, "\u25CB");
471
+ directCount === totalCount && totalCount > 0 ? toggleIcon = fg(t.direct, "\u25CF") : directCount > 0 && (toggleIcon = fg(t.needsAuth, "\u25D0"));
472
+ let toolInfo = "";
473
+ if (totalCount > 0) {
474
+ if (toolInfo = `${directCount}/${totalCount}`, directCount > 0) {
475
+ let tokens = server.tools.filter((t2) => t2.isDirect).reduce((s, t2) => s + t2.estimatedTokens, 0);
476
+ toolInfo += ` ~${tokens.toLocaleString()}`;
477
+ }
478
+ toolInfo = fg(t.description, toolInfo);
479
+ }
480
+ return `${prefix} ${toggleIcon} ${nameStr}${importLabel} ${toolInfo}${statusLabel}`;
481
+ }
482
+ renderConnectionStatus(server) {
483
+ let t = this.t;
484
+ return this.authInFlight === server.name ? ` ${fg(t.needsAuth, "authenticating")}` : server.connectionStatus === "needs-auth" ? ` ${fg(t.needsAuth, "needs auth")}` : server.connectionStatus === "connecting" ? ` ${fg(t.needsAuth, "connecting")}` : server.connectionStatus === "failed" ? ` ${fg(t.cancel, "failed")}` : this.authOnly && server.connectionStatus === "connected" ? ` ${fg(t.direct, "connected")}` : this.authOnly ? ` ${fg(t.description, "idle")}` : "";
485
+ }
486
+ renderToolRow(tool, isCursor, innerW) {
487
+ let t = this.t, bold = (s) => `\x1B[1m${s}\x1B[22m`, toggleIcon = tool.isDirect ? fg(t.direct, "\u25CF") : fg(t.description, "\u25CB"), cursor = isCursor ? fg(t.selected, "\u25B8") : " ", toolName = sanitizeDisplayText(tool.name), description = sanitizeDisplayText(tool.description), nameStr = isCursor ? bold(fg(t.selected, toolName)) : toolName, prefixLen = 7 + visibleWidth(toolName), maxDescLen = Math.max(0, innerW - prefixLen - 8), descStr = maxDescLen > 5 && description ? fg(t.description, "\u2014 " + truncateToWidth(description, maxDescLen, "\u2026")) : "";
488
+ return ` ${cursor} ${toggleIcon} ${nameStr} ${descStr}`;
489
+ }
490
+ invalidate() {
491
+ }
492
+ dispose() {
493
+ this.cleanup();
494
+ }
495
+ };
496
+ function createMcpPanel(config, cache, provenance, callbacks, tui, done, options) {
497
+ return new McpPanel(config, cache, provenance, callbacks, tui, done, options ?? {});
498
+ }
499
+ export {
500
+ createMcpPanel
501
+ };