@humain/terminal 0.0.5 → 0.0.7

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 (476) hide show
  1. package/CHANGELOG.md +62 -0
  2. package/README.md +10 -4
  3. package/dist/bundle/chunks/anthropic-messages-GDMGYAZB.js +6 -0
  4. package/dist/bundle/chunks/anthropic.js +75 -0
  5. package/dist/bundle/chunks/azure-openai-responses-ZN52D6YC.js +2 -0
  6. package/dist/bundle/chunks/bedrock-converse-stream.js +77 -0
  7. package/dist/bundle/chunks/chunk-3D3G2X5U.js +6 -0
  8. package/dist/bundle/chunks/chunk-3VI4HD7D.js +31 -0
  9. package/dist/bundle/chunks/chunk-6R7UI4IY.js +2 -0
  10. package/dist/bundle/chunks/chunk-72KO4OMP.js +2 -0
  11. package/dist/bundle/chunks/chunk-7DDKXS2Q.js +2 -0
  12. package/dist/bundle/chunks/chunk-ARF4OE6X.js +105 -0
  13. package/dist/bundle/chunks/chunk-BOW22LW6.js +42 -0
  14. package/dist/bundle/chunks/chunk-BZQ53VGE.js +70 -0
  15. package/dist/bundle/chunks/chunk-CBHC6EL7.js +133 -0
  16. package/dist/bundle/chunks/chunk-D7XAASZM.js +4 -0
  17. package/dist/bundle/chunks/chunk-ECWELYBH.js +17 -0
  18. package/dist/bundle/chunks/chunk-GMWCTUPB.js +2 -0
  19. package/dist/bundle/chunks/chunk-H2O6VOXT.js +11 -0
  20. package/dist/bundle/chunks/chunk-HNVPY4LZ.js +5995 -0
  21. package/dist/bundle/chunks/chunk-JUUC5AZY.js +2 -0
  22. package/dist/bundle/chunks/chunk-JXWJOIH4.js +2 -0
  23. package/dist/bundle/chunks/chunk-L2ZPNLYD.js +2 -0
  24. package/dist/bundle/chunks/chunk-LVVZS2NO.js +12 -0
  25. package/dist/bundle/chunks/chunk-M2GYSCCG.js +44 -0
  26. package/dist/bundle/chunks/chunk-MA4UUCYX.js +18 -0
  27. package/dist/bundle/chunks/chunk-PGXDEOVV.js +2 -0
  28. package/dist/bundle/chunks/chunk-PJACZCIR.js +2 -0
  29. package/dist/bundle/chunks/chunk-PRRNXB7S.js +2 -0
  30. package/dist/bundle/chunks/chunk-SGTGQNNP.js +4 -0
  31. package/dist/bundle/chunks/chunk-TEPMHNKQ.js +2 -0
  32. package/dist/bundle/chunks/chunk-TXBQIIIO.js +2 -0
  33. package/dist/bundle/chunks/chunk-WJZ4KLGL.js +2 -0
  34. package/dist/bundle/chunks/chunk-XNGRGP62.js +2 -0
  35. package/dist/bundle/chunks/dist-7DSXV2TY.js +9 -0
  36. package/dist/bundle/chunks/dist-BXEVYJIO.js +7 -0
  37. package/dist/bundle/chunks/es-P2KNSZYR.js +9 -0
  38. package/dist/bundle/chunks/es5-FGTJ7ZFW.js +2 -0
  39. package/dist/bundle/chunks/event-streams-JOSQQSII.js +2 -0
  40. package/dist/bundle/chunks/extract-2L7ZVN7F.js +106 -0
  41. package/dist/bundle/chunks/github-copilot.js +2 -0
  42. package/dist/bundle/chunks/google-generative-ai-XT7NQJ2E.js +2 -0
  43. package/dist/bundle/chunks/google-vertex-IDQ6Z53W.js +2 -0
  44. package/dist/bundle/chunks/image-resize-worker.js +2 -0
  45. package/dist/bundle/chunks/kimi-coding.js +2 -0
  46. package/dist/bundle/chunks/mistral-conversations-HHDZ4FHR.js +5 -0
  47. package/dist/bundle/chunks/multipart-parser-FMGQ7342.js +3 -0
  48. package/dist/bundle/chunks/node-XY3CBY3C.js +294 -0
  49. package/dist/bundle/chunks/node-ZHY4LHC7.js +15 -0
  50. package/dist/bundle/chunks/openai-codex-responses-HRVCDY54.js +8 -0
  51. package/dist/bundle/chunks/openai-codex.js +75 -0
  52. package/dist/bundle/chunks/openai-completions-6QBYTBXY.js +7 -0
  53. package/dist/bundle/chunks/openai-responses-4MWLJHIK.js +2 -0
  54. package/dist/bundle/chunks/openrouter-images-Y2PCWAQH.js +2 -0
  55. package/dist/bundle/chunks/openrouter.js +75 -0
  56. package/dist/bundle/chunks/pdfjs-UKQT3OWY.js +107 -0
  57. package/dist/bundle/chunks/pi-messages-57K43J6J.js +8 -0
  58. package/dist/bundle/chunks/promise-J5TGSM32.js +2 -0
  59. package/dist/bundle/chunks/radius.js +75 -0
  60. package/dist/bundle/chunks/src-QKGKDFSU.js +4 -0
  61. package/dist/bundle/chunks/undici-D6ABF53Q.js +2 -0
  62. package/dist/bundle/chunks/webapi-AFS5FDJJ.js +5 -0
  63. package/dist/bundle/chunks/xai.js +2 -0
  64. package/dist/bundle/cli.js +3 -0
  65. package/dist/bundle/client.js +2 -0
  66. package/dist/bundle/index.js +2 -0
  67. package/dist/bundle/rpc-entry.js +3 -0
  68. package/dist/cli/args.d.ts +1 -0
  69. package/dist/cli/args.d.ts.map +1 -1
  70. package/dist/cli/args.js +29 -9
  71. package/dist/cli/args.js.map +1 -1
  72. package/dist/cli/file-processor.d.ts.map +1 -1
  73. package/dist/cli/file-processor.js +2 -1
  74. package/dist/cli/file-processor.js.map +1 -1
  75. package/dist/config.d.ts +1 -0
  76. package/dist/config.d.ts.map +1 -1
  77. package/dist/config.js +19 -11
  78. package/dist/config.js.map +1 -1
  79. package/dist/core/agent-session.d.ts +50 -14
  80. package/dist/core/agent-session.d.ts.map +1 -1
  81. package/dist/core/agent-session.js +163 -95
  82. package/dist/core/agent-session.js.map +1 -1
  83. package/dist/core/auth-storage.d.ts.map +1 -1
  84. package/dist/core/auth-storage.js +6 -7
  85. package/dist/core/auth-storage.js.map +1 -1
  86. package/dist/core/compaction/branch-summarization.d.ts.map +1 -1
  87. package/dist/core/compaction/branch-summarization.js +3 -0
  88. package/dist/core/compaction/branch-summarization.js.map +1 -1
  89. package/dist/core/compaction/compaction.d.ts +4 -3
  90. package/dist/core/compaction/compaction.d.ts.map +1 -1
  91. package/dist/core/compaction/compaction.js +41 -32
  92. package/dist/core/compaction/compaction.js.map +1 -1
  93. package/dist/core/defaults.d.ts +1 -0
  94. package/dist/core/defaults.d.ts.map +1 -1
  95. package/dist/core/defaults.js +9 -0
  96. package/dist/core/defaults.js.map +1 -1
  97. package/dist/core/extensions/index.d.ts +2 -2
  98. package/dist/core/extensions/index.d.ts.map +1 -1
  99. package/dist/core/extensions/index.js +1 -1
  100. package/dist/core/extensions/index.js.map +1 -1
  101. package/dist/core/extensions/loader.d.ts.map +1 -1
  102. package/dist/core/extensions/loader.js +115 -48
  103. package/dist/core/extensions/loader.js.map +1 -1
  104. package/dist/core/extensions/types.d.ts +38 -9
  105. package/dist/core/extensions/types.d.ts.map +1 -1
  106. package/dist/core/extensions/types.js +3 -0
  107. package/dist/core/extensions/types.js.map +1 -1
  108. package/dist/core/footer-data-provider.d.ts +1 -1
  109. package/dist/core/footer-data-provider.js +1 -1
  110. package/dist/core/footer-data-provider.js.map +1 -1
  111. package/dist/core/keybindings.d.ts +20 -19
  112. package/dist/core/keybindings.d.ts.map +1 -1
  113. package/dist/core/keybindings.js +26 -5
  114. package/dist/core/keybindings.js.map +1 -1
  115. package/dist/core/model-config.d.ts +5 -0
  116. package/dist/core/model-config.d.ts.map +1 -1
  117. package/dist/core/model-config.js +3 -1
  118. package/dist/core/model-config.js.map +1 -1
  119. package/dist/core/model-resolver.d.ts +1 -0
  120. package/dist/core/model-resolver.d.ts.map +1 -1
  121. package/dist/core/model-resolver.js +18 -8
  122. package/dist/core/model-resolver.js.map +1 -1
  123. package/dist/core/models-store.d.ts.map +1 -1
  124. package/dist/core/models-store.js +2 -1
  125. package/dist/core/models-store.js.map +1 -1
  126. package/dist/core/package-manager.d.ts.map +1 -1
  127. package/dist/core/package-manager.js +22 -14
  128. package/dist/core/package-manager.js.map +1 -1
  129. package/dist/core/pi-manifest.d.ts.map +1 -1
  130. package/dist/core/pi-manifest.js +2 -1
  131. package/dist/core/pi-manifest.js.map +1 -1
  132. package/dist/core/remote-catalog-provider.d.ts.map +1 -1
  133. package/dist/core/remote-catalog-provider.js +2 -1
  134. package/dist/core/remote-catalog-provider.js.map +1 -1
  135. package/dist/core/resource-loader.d.ts.map +1 -1
  136. package/dist/core/resource-loader.js +3 -2
  137. package/dist/core/resource-loader.js.map +1 -1
  138. package/dist/core/sdk.d.ts +2 -2
  139. package/dist/core/sdk.d.ts.map +1 -1
  140. package/dist/core/sdk.js +10 -3
  141. package/dist/core/sdk.js.map +1 -1
  142. package/dist/core/session-export.d.ts +4 -0
  143. package/dist/core/session-export.d.ts.map +1 -0
  144. package/dist/core/session-export.js +32 -0
  145. package/dist/core/session-export.js.map +1 -0
  146. package/dist/core/session-manager.d.ts.map +1 -1
  147. package/dist/core/session-manager.js +2 -1
  148. package/dist/core/session-manager.js.map +1 -1
  149. package/dist/core/settings-diagnostics.d.ts +9 -0
  150. package/dist/core/settings-diagnostics.d.ts.map +1 -0
  151. package/dist/core/settings-diagnostics.js +21 -0
  152. package/dist/core/settings-diagnostics.js.map +1 -0
  153. package/dist/core/settings-manager.d.ts +9 -0
  154. package/dist/core/settings-manager.d.ts.map +1 -1
  155. package/dist/core/settings-manager.js +51 -10
  156. package/dist/core/settings-manager.js.map +1 -1
  157. package/dist/core/skills.d.ts.map +1 -1
  158. package/dist/core/skills.js +51 -33
  159. package/dist/core/skills.js.map +1 -1
  160. package/dist/core/slash-commands.d.ts.map +1 -1
  161. package/dist/core/slash-commands.js +2 -1
  162. package/dist/core/slash-commands.js.map +1 -1
  163. package/dist/core/system-prompt.d.ts.map +1 -1
  164. package/dist/core/system-prompt.js +11 -2
  165. package/dist/core/system-prompt.js.map +1 -1
  166. package/dist/core/tools/bash.d.ts +16 -3
  167. package/dist/core/tools/bash.d.ts.map +1 -1
  168. package/dist/core/tools/bash.js +62 -29
  169. package/dist/core/tools/bash.js.map +1 -1
  170. package/dist/core/tools/edit-diff.d.ts +0 -5
  171. package/dist/core/tools/edit-diff.d.ts.map +1 -1
  172. package/dist/core/tools/edit-diff.js +2 -5
  173. package/dist/core/tools/edit-diff.js.map +1 -1
  174. package/dist/core/tools/edit.d.ts.map +1 -1
  175. package/dist/core/tools/edit.js +20 -4
  176. package/dist/core/tools/edit.js.map +1 -1
  177. package/dist/core/tools/index.d.ts +4 -1
  178. package/dist/core/tools/index.d.ts.map +1 -1
  179. package/dist/core/tools/index.js +19 -1
  180. package/dist/core/tools/index.js.map +1 -1
  181. package/dist/core/tools/powershell.d.ts +16 -0
  182. package/dist/core/tools/powershell.d.ts.map +1 -0
  183. package/dist/core/tools/powershell.js +39 -0
  184. package/dist/core/tools/powershell.js.map +1 -0
  185. package/dist/core/tools/subagent.d.ts.map +1 -1
  186. package/dist/core/tools/subagent.js +21 -28
  187. package/dist/core/tools/subagent.js.map +1 -1
  188. package/dist/core/trust-manager.d.ts.map +1 -1
  189. package/dist/core/trust-manager.js +2 -1
  190. package/dist/core/trust-manager.js.map +1 -1
  191. package/dist/extensions/llama/index.d.ts.map +1 -1
  192. package/dist/extensions/llama/index.js +2 -0
  193. package/dist/extensions/llama/index.js.map +1 -1
  194. package/dist/extensions/llama/provider.d.ts.map +1 -1
  195. package/dist/extensions/llama/provider.js +6 -2
  196. package/dist/extensions/llama/provider.js.map +1 -1
  197. package/dist/humain/agent-execution-protocol.d.ts +1 -217
  198. package/dist/humain/agent-execution-protocol.d.ts.map +1 -1
  199. package/dist/humain/agent-execution-protocol.js +1 -203
  200. package/dist/humain/agent-execution-protocol.js.map +1 -1
  201. package/dist/humain/bedrock-provider/vendor/index.bundle.mjs +107 -16
  202. package/dist/humain/mcp-adapter/vendor/CHANGELOG.md +82 -0
  203. package/dist/humain/mcp-adapter/vendor/README.md +47 -15
  204. package/dist/humain/mcp-adapter/vendor/cli.js +4 -4
  205. package/dist/humain/mcp-adapter/vendor/commands.ts +5 -3
  206. package/dist/humain/mcp-adapter/vendor/config.ts +46 -5
  207. package/dist/humain/mcp-adapter/vendor/direct-tools.ts +103 -92
  208. package/dist/humain/mcp-adapter/vendor/dist/agent-dir.d.ts +10 -0
  209. package/dist/humain/mcp-adapter/vendor/dist/agent-dir.js +63 -0
  210. package/dist/humain/mcp-adapter/vendor/dist/agent-dir.js.map +1 -0
  211. package/dist/humain/mcp-adapter/vendor/dist/agent-plugin-loader.d.ts +8 -0
  212. package/dist/humain/mcp-adapter/vendor/dist/agent-plugin-loader.js +356 -0
  213. package/dist/humain/mcp-adapter/vendor/dist/agent-plugin-loader.js.map +1 -0
  214. package/dist/humain/mcp-adapter/vendor/dist/config.d.ts +123 -0
  215. package/dist/humain/mcp-adapter/vendor/dist/config.js +1088 -0
  216. package/dist/humain/mcp-adapter/vendor/dist/config.js.map +1 -0
  217. package/dist/humain/mcp-adapter/vendor/dist/mcp-bearer-store.d.ts +24 -0
  218. package/dist/humain/mcp-adapter/vendor/dist/mcp-bearer-store.js +336 -0
  219. package/dist/humain/mcp-adapter/vendor/dist/mcp-bearer-store.js.map +1 -0
  220. package/dist/humain/mcp-adapter/vendor/dist/metadata-cache.d.ts +19 -0
  221. package/dist/humain/mcp-adapter/vendor/dist/metadata-cache.js +319 -0
  222. package/dist/humain/mcp-adapter/vendor/dist/metadata-cache.js.map +1 -0
  223. package/dist/humain/mcp-adapter/vendor/dist/package-mcp-loader.d.ts +2 -0
  224. package/dist/humain/mcp-adapter/vendor/dist/package-mcp-loader.js +156 -0
  225. package/dist/humain/mcp-adapter/vendor/dist/package-mcp-loader.js.map +1 -0
  226. package/dist/humain/mcp-adapter/vendor/dist/resource-tools.d.ts +1 -0
  227. package/dist/humain/mcp-adapter/vendor/dist/resource-tools.js +15 -0
  228. package/dist/humain/mcp-adapter/vendor/dist/resource-tools.js.map +1 -0
  229. package/dist/humain/mcp-adapter/vendor/dist/types.d.ts +566 -0
  230. package/dist/humain/mcp-adapter/vendor/dist/types.js +287 -0
  231. package/dist/humain/mcp-adapter/vendor/dist/types.js.map +1 -0
  232. package/dist/humain/mcp-adapter/vendor/dist/ui-app-bridge-helpers.d.ts +6 -0
  233. package/dist/humain/mcp-adapter/vendor/dist/ui-app-bridge-helpers.js +37 -0
  234. package/dist/humain/mcp-adapter/vendor/dist/ui-app-bridge-helpers.js.map +1 -0
  235. package/dist/humain/mcp-adapter/vendor/dist/ui-stream-types.d.ts +104 -0
  236. package/dist/humain/mcp-adapter/vendor/dist/ui-stream-types.js +59 -0
  237. package/dist/humain/mcp-adapter/vendor/dist/ui-stream-types.js.map +1 -0
  238. package/dist/humain/mcp-adapter/vendor/dist/ui-tool-visibility.d.ts +4 -0
  239. package/dist/humain/mcp-adapter/vendor/dist/ui-tool-visibility.js +27 -0
  240. package/dist/humain/mcp-adapter/vendor/dist/ui-tool-visibility.js.map +1 -0
  241. package/dist/humain/mcp-adapter/vendor/dist/utils.d.ts +32 -0
  242. package/dist/humain/mcp-adapter/vendor/dist/utils.js +338 -0
  243. package/dist/humain/mcp-adapter/vendor/dist/utils.js.map +1 -0
  244. package/dist/humain/mcp-adapter/vendor/failure-backoff.ts +23 -0
  245. package/dist/humain/mcp-adapter/vendor/index.bundle.mjs +4870 -3878
  246. package/dist/humain/mcp-adapter/vendor/index.ts +294 -88
  247. package/dist/humain/mcp-adapter/vendor/init.ts +41 -30
  248. package/dist/humain/mcp-adapter/vendor/lifecycle.ts +16 -8
  249. package/dist/humain/mcp-adapter/vendor/mcp-auth-flow.ts +124 -32
  250. package/dist/humain/mcp-adapter/vendor/mcp-bearer-store.ts +0 -2
  251. package/dist/humain/mcp-adapter/vendor/mcp-code.ts +2 -0
  252. package/dist/humain/mcp-adapter/vendor/mcp-oauth-provider.ts +155 -16
  253. package/dist/humain/mcp-adapter/vendor/mcp-output-guard.ts +95 -7
  254. package/dist/humain/mcp-adapter/vendor/mcp-probe.ts +18 -4
  255. package/dist/humain/mcp-adapter/vendor/mcp-references.ts +376 -0
  256. package/dist/humain/mcp-adapter/vendor/mcp-status.ts +8 -19
  257. package/dist/humain/mcp-adapter/vendor/metadata-cache.ts +20 -12
  258. package/dist/humain/mcp-adapter/vendor/namespace-tools.ts +276 -0
  259. package/dist/humain/mcp-adapter/vendor/package.json +26 -8
  260. package/dist/humain/mcp-adapter/vendor/proxy-modes.ts +128 -32
  261. package/dist/humain/mcp-adapter/vendor/request-headers-command.ts +1 -1
  262. package/dist/humain/mcp-adapter/vendor/search-ranking.ts +2 -0
  263. package/dist/humain/mcp-adapter/vendor/server-manager.ts +69 -12
  264. package/dist/humain/mcp-adapter/vendor/state.ts +1 -3
  265. package/dist/humain/mcp-adapter/vendor/tool-result-renderer.ts +16 -2
  266. package/dist/humain/mcp-adapter/vendor/types.ts +51 -2
  267. package/dist/humain/mcp-adapter/vendor/ui-server.ts +3 -19
  268. package/dist/humain/mcp-adapter/vendor/ui-session.ts +2 -1
  269. package/dist/humain/mcp-adapter/vendor/utils.ts +21 -19
  270. package/dist/humain/mcp-adapter.d.ts.map +1 -1
  271. package/dist/humain/mcp-adapter.js +4 -0
  272. package/dist/humain/mcp-adapter.js.map +1 -1
  273. package/dist/humain/web-access/vendor/chrome-cookies.d.ts +14 -0
  274. package/dist/humain/web-access/vendor/chrome-cookies.d.ts.map +1 -1
  275. package/dist/humain/web-access/vendor/chrome-cookies.js +85 -33
  276. package/dist/humain/web-access/vendor/chrome-cookies.js.map +1 -1
  277. package/dist/humain/web-access/vendor/credential-source.d.ts +1 -1
  278. package/dist/humain/web-access/vendor/credential-source.d.ts.map +1 -1
  279. package/dist/humain/web-access/vendor/credential-source.js +3 -1
  280. package/dist/humain/web-access/vendor/credential-source.js.map +1 -1
  281. package/dist/humain/web-access/vendor/curator-page.d.ts +2 -29
  282. package/dist/humain/web-access/vendor/curator-page.d.ts.map +1 -1
  283. package/dist/humain/web-access/vendor/curator-page.js +10 -1
  284. package/dist/humain/web-access/vendor/curator-page.js.map +1 -1
  285. package/dist/humain/web-access/vendor/curator-server.d.ts +2 -29
  286. package/dist/humain/web-access/vendor/curator-server.d.ts.map +1 -1
  287. package/dist/humain/web-access/vendor/curator-server.js +4 -0
  288. package/dist/humain/web-access/vendor/curator-server.js.map +1 -1
  289. package/dist/humain/web-access/vendor/extract.d.ts +11 -0
  290. package/dist/humain/web-access/vendor/extract.d.ts.map +1 -1
  291. package/dist/humain/web-access/vendor/extract.js +163 -20
  292. package/dist/humain/web-access/vendor/extract.js.map +1 -1
  293. package/dist/humain/web-access/vendor/fetch-params.d.ts +2 -0
  294. package/dist/humain/web-access/vendor/fetch-params.d.ts.map +1 -1
  295. package/dist/humain/web-access/vendor/fetch-params.js +11 -0
  296. package/dist/humain/web-access/vendor/fetch-params.js.map +1 -1
  297. package/dist/humain/web-access/vendor/gemini-adc.d.ts +10 -0
  298. package/dist/humain/web-access/vendor/gemini-adc.d.ts.map +1 -0
  299. package/dist/humain/web-access/vendor/gemini-adc.js +268 -0
  300. package/dist/humain/web-access/vendor/gemini-adc.js.map +1 -0
  301. package/dist/humain/web-access/vendor/gemini-api.d.ts +7 -1
  302. package/dist/humain/web-access/vendor/gemini-api.d.ts.map +1 -1
  303. package/dist/humain/web-access/vendor/gemini-api.js +51 -15
  304. package/dist/humain/web-access/vendor/gemini-api.js.map +1 -1
  305. package/dist/humain/web-access/vendor/gemini-search.d.ts +9 -4
  306. package/dist/humain/web-access/vendor/gemini-search.d.ts.map +1 -1
  307. package/dist/humain/web-access/vendor/gemini-search.js +63 -21
  308. package/dist/humain/web-access/vendor/gemini-search.js.map +1 -1
  309. package/dist/humain/web-access/vendor/gemini-url-context.d.ts.map +1 -1
  310. package/dist/humain/web-access/vendor/gemini-url-context.js +3 -2
  311. package/dist/humain/web-access/vendor/gemini-url-context.js.map +1 -1
  312. package/dist/humain/web-access/vendor/gemini-web-config.d.ts +8 -1
  313. package/dist/humain/web-access/vendor/gemini-web-config.d.ts.map +1 -1
  314. package/dist/humain/web-access/vendor/gemini-web-config.js +49 -4
  315. package/dist/humain/web-access/vendor/gemini-web-config.js.map +1 -1
  316. package/dist/humain/web-access/vendor/gemini-web.d.ts +2 -1
  317. package/dist/humain/web-access/vendor/gemini-web.d.ts.map +1 -1
  318. package/dist/humain/web-access/vendor/gemini-web.js +8 -3
  319. package/dist/humain/web-access/vendor/gemini-web.js.map +1 -1
  320. package/dist/humain/web-access/vendor/github-api.d.ts +1 -1
  321. package/dist/humain/web-access/vendor/github-api.d.ts.map +1 -1
  322. package/dist/humain/web-access/vendor/github-api.js +6 -4
  323. package/dist/humain/web-access/vendor/github-api.js.map +1 -1
  324. package/dist/humain/web-access/vendor/github-extract.d.ts.map +1 -1
  325. package/dist/humain/web-access/vendor/github-extract.js +50 -3
  326. package/dist/humain/web-access/vendor/github-extract.js.map +1 -1
  327. package/dist/humain/web-access/vendor/github-issue-pr.d.ts +27 -0
  328. package/dist/humain/web-access/vendor/github-issue-pr.d.ts.map +1 -0
  329. package/dist/humain/web-access/vendor/github-issue-pr.js +701 -0
  330. package/dist/humain/web-access/vendor/github-issue-pr.js.map +1 -0
  331. package/dist/humain/web-access/vendor/index.d.ts +3 -31
  332. package/dist/humain/web-access/vendor/index.d.ts.map +1 -1
  333. package/dist/humain/web-access/vendor/index.js +643 -530
  334. package/dist/humain/web-access/vendor/index.js.map +1 -1
  335. package/dist/humain/web-access/vendor/kimi-search.d.ts +5 -0
  336. package/dist/humain/web-access/vendor/kimi-search.d.ts.map +1 -0
  337. package/dist/humain/web-access/vendor/kimi-search.js +228 -0
  338. package/dist/humain/web-access/vendor/kimi-search.js.map +1 -0
  339. package/dist/humain/web-access/vendor/openai-search.d.ts +3 -0
  340. package/dist/humain/web-access/vendor/openai-search.d.ts.map +1 -1
  341. package/dist/humain/web-access/vendor/openai-search.js +89 -16
  342. package/dist/humain/web-access/vendor/openai-search.js.map +1 -1
  343. package/dist/humain/web-access/vendor/page-query.d.ts.map +1 -1
  344. package/dist/humain/web-access/vendor/page-query.js +56 -8
  345. package/dist/humain/web-access/vendor/page-query.js.map +1 -1
  346. package/dist/humain/web-access/vendor/ssrf-protection.js +6 -1
  347. package/dist/humain/web-access/vendor/ssrf-protection.js.map +1 -1
  348. package/dist/humain/web-access/vendor/utils.d.ts +12 -0
  349. package/dist/humain/web-access/vendor/utils.d.ts.map +1 -1
  350. package/dist/humain/web-access/vendor/utils.js +343 -1
  351. package/dist/humain/web-access/vendor/utils.js.map +1 -1
  352. package/dist/humain/web-access/vendor/xcrawl.d.ts +4 -0
  353. package/dist/humain/web-access/vendor/xcrawl.d.ts.map +1 -0
  354. package/dist/humain/web-access/vendor/xcrawl.js +251 -0
  355. package/dist/humain/web-access/vendor/xcrawl.js.map +1 -0
  356. package/dist/humain/web-access/vendor/youtube-extract.js +2 -2
  357. package/dist/humain/web-access/vendor/youtube-extract.js.map +1 -1
  358. package/dist/index.d.ts +5 -5
  359. package/dist/index.d.ts.map +1 -1
  360. package/dist/index.js +4 -4
  361. package/dist/index.js.map +1 -1
  362. package/dist/main.d.ts +3 -0
  363. package/dist/main.d.ts.map +1 -1
  364. package/dist/main.js +17 -14
  365. package/dist/main.js.map +1 -1
  366. package/dist/migrations.d.ts.map +1 -1
  367. package/dist/migrations.js +4 -3
  368. package/dist/migrations.js.map +1 -1
  369. package/dist/modes/interactive/components/model-selector.d.ts +9 -3
  370. package/dist/modes/interactive/components/model-selector.d.ts.map +1 -1
  371. package/dist/modes/interactive/components/model-selector.js +53 -10
  372. package/dist/modes/interactive/components/model-selector.js.map +1 -1
  373. package/dist/modes/interactive/components/settings-selector.d.ts +7 -2
  374. package/dist/modes/interactive/components/settings-selector.d.ts.map +1 -1
  375. package/dist/modes/interactive/components/settings-selector.js +118 -55
  376. package/dist/modes/interactive/components/settings-selector.js.map +1 -1
  377. package/dist/modes/interactive/components/settings-submenu.d.ts +72 -0
  378. package/dist/modes/interactive/components/settings-submenu.d.ts.map +1 -0
  379. package/dist/modes/interactive/components/settings-submenu.js +151 -0
  380. package/dist/modes/interactive/components/settings-submenu.js.map +1 -0
  381. package/dist/modes/interactive/components/thinking-selector.d.ts +15 -3
  382. package/dist/modes/interactive/components/thinking-selector.d.ts.map +1 -1
  383. package/dist/modes/interactive/components/thinking-selector.js +68 -17
  384. package/dist/modes/interactive/components/thinking-selector.js.map +1 -1
  385. package/dist/modes/interactive/external-editor.d.ts.map +1 -1
  386. package/dist/modes/interactive/external-editor.js +2 -1
  387. package/dist/modes/interactive/external-editor.js.map +1 -1
  388. package/dist/modes/interactive/interactive-mode.d.ts +11 -0
  389. package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
  390. package/dist/modes/interactive/interactive-mode.js +176 -106
  391. package/dist/modes/interactive/interactive-mode.js.map +1 -1
  392. package/dist/modes/interactive/session-share.d.ts +16 -0
  393. package/dist/modes/interactive/session-share.d.ts.map +1 -0
  394. package/dist/modes/interactive/session-share.js +188 -0
  395. package/dist/modes/interactive/session-share.js.map +1 -0
  396. package/dist/modes/interactive/theme/theme.d.ts.map +1 -1
  397. package/dist/modes/interactive/theme/theme.js +6 -5
  398. package/dist/modes/interactive/theme/theme.js.map +1 -1
  399. package/dist/modes/json-event.d.ts +16 -13
  400. package/dist/modes/json-event.d.ts.map +1 -1
  401. package/dist/modes/json-event.js +20 -6
  402. package/dist/modes/json-event.js.map +1 -1
  403. package/dist/modes/rpc/rpc-client.d.ts.map +1 -1
  404. package/dist/modes/rpc/rpc-client.js +3 -2
  405. package/dist/modes/rpc/rpc-client.js.map +1 -1
  406. package/dist/modes/rpc/rpc-types.d.ts +2 -7
  407. package/dist/modes/rpc/rpc-types.d.ts.map +1 -1
  408. package/dist/modes/rpc/rpc-types.js.map +1 -1
  409. package/dist/package-manager-cli.d.ts +1 -0
  410. package/dist/package-manager-cli.d.ts.map +1 -1
  411. package/dist/package-manager-cli.js +189 -3
  412. package/dist/package-manager-cli.js.map +1 -1
  413. package/dist/utils/changelog.d.ts +1 -1
  414. package/dist/utils/changelog.d.ts.map +1 -1
  415. package/dist/utils/changelog.js +12 -2
  416. package/dist/utils/changelog.js.map +1 -1
  417. package/dist/utils/frontmatter.d.ts.map +1 -1
  418. package/dist/utils/frontmatter.js +2 -1
  419. package/dist/utils/frontmatter.js.map +1 -1
  420. package/dist/utils/management-http.d.ts +5 -3
  421. package/dist/utils/management-http.d.ts.map +1 -1
  422. package/dist/utils/management-http.js +14 -10
  423. package/dist/utils/management-http.js.map +1 -1
  424. package/dist/utils/shell.d.ts +3 -0
  425. package/dist/utils/shell.d.ts.map +1 -1
  426. package/dist/utils/shell.js +17 -5
  427. package/dist/utils/shell.js.map +1 -1
  428. package/dist/utils/syntax-highlight.d.ts +1 -0
  429. package/dist/utils/syntax-highlight.d.ts.map +1 -1
  430. package/dist/utils/syntax-highlight.js +64 -1
  431. package/dist/utils/syntax-highlight.js.map +1 -1
  432. package/dist/utils/text.d.ts +8 -0
  433. package/dist/utils/text.d.ts.map +1 -0
  434. package/dist/utils/text.js +9 -0
  435. package/dist/utils/text.js.map +1 -0
  436. package/dist/utils/version-check.js +4 -4
  437. package/dist/utils/version-check.js.map +1 -1
  438. package/docs/compaction.md +15 -0
  439. package/docs/custom-provider.md +5 -2
  440. package/docs/environment-variables.md +7 -7
  441. package/docs/extensions.md +17 -7
  442. package/docs/json.md +7 -2
  443. package/docs/keybindings.md +8 -8
  444. package/docs/llama-cpp.md +2 -0
  445. package/docs/models.md +8 -2
  446. package/docs/packages.md +2 -2
  447. package/docs/rpc.md +9 -3
  448. package/docs/sdk.md +7 -2
  449. package/docs/settings.md +11 -3
  450. package/docs/skills.md +3 -2
  451. package/docs/terminal-setup.md +8 -0
  452. package/docs/usage.md +10 -7
  453. package/docs/windows.md +15 -1
  454. package/examples/extensions/border-status-editor.ts +1 -1
  455. package/examples/extensions/custom-provider-anthropic/package-lock.json +70 -8
  456. package/examples/extensions/custom-provider-anthropic/package.json +2 -2
  457. package/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
  458. package/examples/extensions/git-checkpoint.ts +2 -2
  459. package/examples/extensions/gondolin/package-lock.json +2 -2
  460. package/examples/extensions/gondolin/package.json +1 -1
  461. package/examples/extensions/notify.ts +3 -1
  462. package/examples/extensions/sandbox/package-lock.json +14 -40
  463. package/examples/extensions/sandbox/package.json +2 -2
  464. package/examples/extensions/titlebar-spinner.ts +1 -1
  465. package/examples/extensions/with-deps/package-lock.json +4 -4
  466. package/examples/extensions/with-deps/package.json +1 -1
  467. package/examples/rpc-extension-ui.ts +1 -1
  468. package/examples/sdk/06-extensions.ts +1 -1
  469. package/examples/sdk/README.md +1 -1
  470. package/npm-shrinkwrap.json +293 -221
  471. package/package.json +21 -18
  472. package/src/humain/mcp-adapter/UPSTREAM.md +15 -5
  473. package/src/humain/mcp-adapter/upstream.json +4 -3
  474. package/src/humain/mcp-adapter/vendor/CHANGELOG.md +82 -0
  475. package/src/humain/web-access/UPSTREAM.md +1 -1
  476. package/src/humain/web-access/upstream.json +6 -4
@@ -42,6 +42,16 @@ export const KNOWN_SERVER_PRESETS: readonly KnownServerPreset[] = [
42
42
  summary: "Look up current library documentation and examples.",
43
43
  entry: { url: "https://mcp.context7.com/mcp", protocolVersion: "auto" },
44
44
  },
45
+ {
46
+ id: "parallel-search",
47
+ name: "Parallel Search",
48
+ summary: "Search the web and fetch pages without an API key.",
49
+ entry: {
50
+ url: "https://search.parallel.ai/mcp",
51
+ protocolVersion: "auto",
52
+ directTools: true,
53
+ },
54
+ },
45
55
  {
46
56
  id: "notion",
47
57
  name: "Notion",
@@ -190,6 +200,7 @@ export function getConfigDiscoveryPaths(overridePath?: string, cwd = process.cwd
190
200
  }
191
201
 
192
202
  export function findAvailableImportConfigs(cwd = process.cwd()): DiscoveredImportConfig[] {
203
+ if (isExclusiveConfigMode()) return [];
193
204
  const discovered: DiscoveredImportConfig[] = [];
194
205
 
195
206
  for (const importKind of Object.keys(IMPORT_PATHS) as ImportKind[]) {
@@ -235,8 +246,11 @@ export function getMcpDiscoverySummary(
235
246
  const sources = getConfigSourceSummaries(sourceSpecs);
236
247
  const includeHostConfigs = options.includeHostConfigs !== false;
237
248
 
249
+ const importKinds = isExclusiveConfigMode()
250
+ ? (readValidatedConfig(getEffectivePiGlobalConfigPath(overridePath), "MCP exclusive config")?.imports ?? [])
251
+ : (Object.keys(IMPORT_PATHS) as ImportKind[]);
238
252
  const imports = includeHostConfigs
239
- ? (Object.keys(IMPORT_PATHS) as ImportKind[])
253
+ ? importKinds
240
254
  .map((kind) => {
241
255
  const imported = loadImportedConfig(kind, cwd, `Failed to inspect imported MCP config from ${kind}:`);
242
256
  if (!imported) return null;
@@ -248,10 +262,14 @@ export function getMcpDiscoverySummary(
248
262
  })
249
263
  .filter((value): value is ImportConfigSummary => value !== null)
250
264
  : [];
251
- const hostConfigDiscovery = getConfiguredHostConfigDiscovery(overridePath, cwd);
265
+ const hostConfigDiscovery = isExclusiveConfigMode()
266
+ ? "off"
267
+ : getConfiguredHostConfigDiscovery(overridePath, cwd);
252
268
  const hostConfigs = imports.map((entry) => ({ ...entry, active: hostConfigDiscovery === "on" }));
253
269
  const settings = getMergedSettings(overridePath, cwd);
254
- const agentPlugins = getAgentPluginSummaries(settings?.agentPluginPaths, cwd);
270
+ const agentPlugins = isExclusiveConfigMode()
271
+ ? []
272
+ : getAgentPluginSummaries(settings?.agentPluginPaths, cwd);
255
273
  const totalServerCount = sources.reduce((sum, source) => sum + source.serverCount, 0) + agentPlugins.reduce((sum, plugin) => sum + plugin.serverCount, 0);
256
274
  const hasSharedServers = sources.some((source) => source.kind === "shared" && source.serverCount > 0) || agentPlugins.some(plugin => plugin.serverCount > 0);
257
275
  const hasPiOwnedServers = sources.some((source) => source.kind === "pi" && source.serverCount > 0);
@@ -297,7 +315,7 @@ export function loadMcpConfig(overridePath?: string, cwd = process.cwd()): McpCo
297
315
  // Host files are a lower-precedence fallback. This ordering means an opt-in
298
316
  // discovery cannot override a shared or Pi-owned definition, and all normal
299
317
  // URL-bound credential stripping remains in mergeServerMaps.
300
- let config: McpConfig = hostConfigDiscovery === "on"
318
+ let config: McpConfig = !isExclusiveConfigMode() && hostConfigDiscovery === "on"
301
319
  ? loadDiscoveredHostConfigs(cwd)
302
320
  : { mcpServers: {} };
303
321
 
@@ -307,6 +325,8 @@ export function loadMcpConfig(overridePath?: string, cwd = process.cwd()): McpCo
307
325
  config = mergeConfigs(config, expandImports(loaded, cwd));
308
326
  }
309
327
 
328
+ if (isExclusiveConfigMode()) return config;
329
+
310
330
  const packageConfig = loadPackageMcpConfigs(cwd);
311
331
  const pluginConfig = loadAgentPluginConfigs(config.settings?.agentPluginPaths, cwd);
312
332
  const packageServers = Object.fromEntries(
@@ -392,11 +412,23 @@ function getConfigConflicts(
392
412
  }
393
413
 
394
414
  function getConfigSources(overridePath?: string, cwd = process.cwd()): ConfigSourceSpec[] {
395
- const userPath = getPiGlobalConfigPath(overridePath);
415
+ const userPath = getEffectivePiGlobalConfigPath(overridePath);
396
416
  const projectPath = getProjectConfigPath(cwd);
397
417
  const projectPiPath = getProjectPiConfigPath(cwd);
398
418
  const sources: ConfigSourceSpec[] = [];
399
419
 
420
+ if (isExclusiveConfigMode()) {
421
+ return [{
422
+ id: "pi-global",
423
+ label: "Pi exclusive config",
424
+ readPath: userPath,
425
+ writePath: userPath,
426
+ kind: "user",
427
+ shared: false,
428
+ scope: "global",
429
+ }];
430
+ }
431
+
400
432
  if (GENERIC_GLOBAL_CONFIG_PATH !== userPath) {
401
433
  sources.push({
402
434
  id: "shared-global",
@@ -461,6 +493,14 @@ function getConfigSources(overridePath?: string, cwd = process.cwd()): ConfigSou
461
493
  return sources;
462
494
  }
463
495
 
496
+ function isExclusiveConfigMode(): boolean {
497
+ return process.env.PI_MCP_CONFIG_MODE?.trim().toLowerCase() === "exclusive";
498
+ }
499
+
500
+ function getEffectivePiGlobalConfigPath(overridePath?: string): string {
501
+ return getPiGlobalConfigPath(isExclusiveConfigMode() ? undefined : overridePath);
502
+ }
503
+
464
504
  function mergeConfigs(base: McpConfig, next: McpConfig): McpConfig {
465
505
  const imports = mergeImports(base.imports, next.imports);
466
506
  const settings = next.settings ? { ...base.settings, ...next.settings } : base.settings;
@@ -805,6 +845,7 @@ function extractServers(config: unknown, kind: ImportKind): Record<string, Serve
805
845
  ...(typeof oauth.clientId === "string" ? { clientId: oauth.clientId } : {}),
806
846
  ...(typeof oauth.clientSecret === "string" ? { clientSecret: oauth.clientSecret } : {}),
807
847
  ...(typeof oauth.scope === "string" ? { scope: oauth.scope } : {}),
848
+ ...(typeof oauth.authServerMetadataUrl === "string" ? { authServerMetadataUrl: oauth.authServerMetadataUrl } : {}),
808
849
  ...(typeof oauth.skipIssuerMetadataValidation === "boolean"
809
850
  ? { skipIssuerMetadataValidation: oauth.skipIssuerMetadataValidation }
810
851
  : {}),
@@ -15,16 +15,16 @@ import { createToolSelectorCandidateIndex, formatToolName, getToolNameCandidates
15
15
  import { isUiToolVisibleToModel } from "./ui-tool-visibility.ts";
16
16
  import { resourceNameToToolName } from "./resource-tools.ts";
17
17
  import { authenticate, supportsOAuth } from "./mcp-auth-flow.ts";
18
- import { formatAuthRequiredMessage, normalizeToolArguments, resolveServerUrl, truncateAtWord } from "./utils.ts";
18
+ import { formatAuthRequiredMessage, normalizeToolArguments, resolveServerUrl } from "./utils.ts";
19
19
  import { SessionRecoveryAuthRequiredError, withSessionRecovery } from "./session-recovery.ts";
20
20
  import { combineAbortSignals, isAbortError } from "./runtime-owner.ts";
21
21
  import { ensureToolCallApproved } from "./tool-approval.ts";
22
+ import { Check, Errors } from "typebox/value";
22
23
 
23
24
  type ClientCallToolResult = Awaited<ReturnType<Client["callTool"]>>;
24
25
  type ClientReadResourceResult = Awaited<ReturnType<Client["readResource"]>>;
25
26
 
26
27
  const BUILTIN_NAMES = new Set(["read", "bash", "edit", "write", "grep", "find", "ls", "mcp"]);
27
- const INSTRUCTIONS_SNIPPET_LENGTH = 150;
28
28
  export const DIRECT_TOOLS_ADVISORY_THRESHOLD = 75;
29
29
 
30
30
  type DirectAutoAuthResult =
@@ -32,6 +32,58 @@ type DirectAutoAuthResult =
32
32
  | { status: "success" }
33
33
  | { status: "failed"; message: string };
34
34
 
35
+ /**
36
+ * Recover one model-emitted JSON layer for schema-declared object and array
37
+ * properties, then validate the complete input against the same schema.
38
+ */
39
+ export function prepareDirectToolArguments(inputSchema: unknown, args: unknown): unknown {
40
+ if (!inputSchema || typeof inputSchema !== "object" || Array.isArray(inputSchema)) return args;
41
+ const schema = inputSchema as Record<string, unknown>;
42
+ if (schema.type !== "object") return args;
43
+ const input = args && typeof args === "object" && !Array.isArray(args)
44
+ ? args as Record<string, unknown>
45
+ : null;
46
+ const properties = schema.properties;
47
+ let prepared: Record<string, unknown> | undefined;
48
+
49
+ if (input && properties && typeof properties === "object" && !Array.isArray(properties)) {
50
+ for (const [name, propertySchema] of Object.entries(properties)) {
51
+ if (!Object.hasOwn(input, name) || typeof input[name] !== "string"
52
+ || !propertySchema || typeof propertySchema !== "object" || Array.isArray(propertySchema)) continue;
53
+ const expectedType = (propertySchema as Record<string, unknown>).type;
54
+ if (expectedType !== "object" && expectedType !== "array") continue;
55
+ try {
56
+ const parsed: unknown = JSON.parse(input[name] as string);
57
+ const matches = expectedType === "array"
58
+ ? Array.isArray(parsed)
59
+ : parsed !== null && typeof parsed === "object" && !Array.isArray(parsed);
60
+ if (matches) {
61
+ prepared ??= { ...input };
62
+ prepared[name] = parsed;
63
+ }
64
+ } catch {
65
+ // Validation below reports malformed or shape-incompatible values.
66
+ }
67
+ }
68
+ }
69
+
70
+ const candidate = prepared ?? args;
71
+ if (!Check(inputSchema as never, candidate)) {
72
+ const errors = Errors(inputSchema as never, candidate);
73
+ const issues = errors.slice(0, 8).map((error) => ({
74
+ instancePath: error.instancePath || "/",
75
+ keyword: error.keyword,
76
+ message: error.message,
77
+ }));
78
+ throw new TypeError(`MCP direct tool arguments do not match the advertised input schema: ${JSON.stringify({
79
+ issues,
80
+ total: errors.length,
81
+ truncated: errors.length > issues.length,
82
+ })}`);
83
+ }
84
+ return candidate;
85
+ }
86
+
35
87
  function getDirectAuthRequiredMessage(
36
88
  state: McpExtensionState,
37
89
  serverName: string,
@@ -117,6 +169,8 @@ export function resolveDirectTools(
117
169
  cache: MetadataCache | null,
118
170
  prefix: ToolPrefix,
119
171
  envOverride?: string[],
172
+ unavailableServers: ReadonlySet<string> = new Set(),
173
+ reservedNames?: Set<string>,
120
174
  ): DirectToolSpec[] {
121
175
  const specs: DirectToolSpec[] = [];
122
176
  if (!cache) return specs;
@@ -224,82 +278,33 @@ export function resolveDirectTools(
224
278
  }
225
279
  }
226
280
 
227
- if (config.settings?.warnOnLargeDirectTools !== false && specs.length >= DIRECT_TOOLS_ADVISORY_THRESHOLD) {
228
- console.warn(`MCP: ${specs.length} direct tools resolved. Each direct tool adds prompt context; README guidance recommends targeted sets of 5-20 tools and using the proxy or an explicit string[] when 75+ direct tools would be registered.`);
281
+ for (const spec of specs) reservedNames?.add(spec.prefixedName);
282
+
283
+ const emittedSpecs = unavailableServers.size === 0
284
+ ? specs
285
+ : specs.filter((spec) => !unavailableServers.has(spec.serverName));
286
+
287
+ if (config.settings?.warnOnLargeDirectTools !== false && emittedSpecs.length >= DIRECT_TOOLS_ADVISORY_THRESHOLD) {
288
+ console.warn(`MCP: ${emittedSpecs.length} direct tools resolved. Each direct tool adds prompt context; README guidance recommends targeted sets of 5-20 tools and using the proxy or an explicit string[] when 75+ direct tools would be registered. Set settings.warnOnLargeDirectTools to false to hide this advisory.`);
229
289
  }
230
290
 
231
- return specs;
291
+ return emittedSpecs;
232
292
  }
233
293
 
234
- export function buildProxyDescription(
235
- config: McpConfig,
236
- cache: MetadataCache | null,
237
- directSpecs: DirectToolSpec[],
238
- ): string {
239
- const prefix = config.settings?.toolPrefix ?? "server";
294
+ /**
295
+ * Pure function of config: the description must stay byte-stable across
296
+ * runtime metadata changes (tool counts, instructions, connection state) so
297
+ * re-registering the proxy tool never rewrites the cached prompt prefix.
298
+ * Live counts/status belong to `mcp({ })`, full instructions to
299
+ * `mcp({ instructions })`.
300
+ */
301
+ export function buildProxyDescription(config: McpConfig): string {
240
302
  let desc = `MCP gateway — server status, tool search/describe, auth, and single MCP tool calls. When one request needs several MCP calls with logic between them, use mcpScript. Non-MCP Pi tools should be called directly, not through mcp.\n`;
241
303
 
242
- const directByServer = new Map<string, number>();
243
- for (const spec of directSpecs) {
244
- directByServer.set(spec.serverName, (directByServer.get(spec.serverName) ?? 0) + 1);
245
- }
246
- if (directByServer.size > 0) {
247
- const parts = [...directByServer.entries()].map(
248
- ([server, count]) => `${server} (${count})`,
249
- );
250
- desc += `\nDirect tools available (call as normal tools): ${parts.join(", ")}\n`;
251
- }
252
-
253
- const serverSummaries: string[] = [];
254
- for (const serverName of Object.keys(config.mcpServers)) {
255
- const definition = config.mcpServers[serverName];
256
- if (!definition || isServerDisabled(definition)) continue;
257
- const cachedEntry = cache?.servers?.[serverName];
258
- const entry = cachedEntry && isServerCacheValid(cachedEntry, definition) ? cachedEntry : undefined;
259
- const effectivePrefix = resolveToolPrefix(definition, prefix);
260
- const hasToolFilters =
261
- (Array.isArray(definition.includeTools) && definition.includeTools.length > 0) ||
262
- (Array.isArray(definition.excludeTools) && definition.excludeTools.length > 0);
263
- const selectorCandidateIndex = hasToolFilters && cache ? (() => {
264
- const candidates = new Set<string>();
265
- for (const [otherServerName, otherDefinition] of Object.entries(config.mcpServers)) {
266
- const otherEntry = cache.servers[otherServerName];
267
- if (!otherEntry || !isServerCacheValid(otherEntry, otherDefinition) || isServerDisabled(otherDefinition)) continue;
268
- const otherPrefix = resolveToolPrefix(otherDefinition, prefix);
269
- for (const otherTool of otherEntry.tools ?? []) {
270
- if (!isUiToolVisibleToModel(otherTool.uiVisibility)) continue;
271
- for (const candidate of getToolNameCandidates(otherTool.name, otherServerName, otherPrefix, false)) candidates.add(candidate);
272
- }
273
- if (otherDefinition.exposeResources !== false) {
274
- for (const resource of otherEntry.resources ?? []) {
275
- const baseName = `read_${resourceNameToToolName(resource.name)}`;
276
- for (const candidate of getToolNameCandidates(baseName, otherServerName, otherPrefix, false)) candidates.add(candidate);
277
- }
278
- }
279
- }
280
- return createToolSelectorCandidateIndex(candidates);
281
- })() : undefined;
282
- const toolCount = (entry?.tools ?? []).filter(
283
- (tool) => isUiToolVisibleToModel(tool.uiVisibility)
284
- && isToolAllowed(tool.name, serverName, effectivePrefix, definition.includeTools, definition.excludeTools, selectorCandidateIndex),
285
- ).length;
286
- const resourceCount = definition?.exposeResources !== false
287
- ? (entry?.resources ?? []).filter((resource) => {
288
- const baseName = `read_${resourceNameToToolName(resource.name)}`;
289
- return isToolAllowed(baseName, serverName, effectivePrefix, definition.includeTools, definition.excludeTools, selectorCandidateIndex);
290
- }).length
291
- : 0;
292
- const totalItems = toolCount + resourceCount;
293
- if (totalItems === 0) continue;
294
- const directCount = directByServer.get(serverName) ?? 0;
295
- const proxyCount = totalItems - directCount;
296
- if (proxyCount > 0) {
297
- serverSummaries.push(`${serverName} (${proxyCount} tools)`);
298
- }
299
- }
300
-
301
- if (serverSummaries.length > 0) {
302
- desc += `\nServers: ${serverSummaries.join(", ")}\n`;
304
+ const serverNames = Object.keys(config.mcpServers)
305
+ .filter((serverName) => !isServerDisabled(config.mcpServers[serverName]));
306
+ if (serverNames.length > 0) {
307
+ desc += `\nServers: ${serverNames.join(", ")}\n`;
303
308
  }
304
309
 
305
310
  const disabledServers = Object.entries(config.mcpServers)
@@ -309,22 +314,8 @@ export function buildProxyDescription(
309
314
  desc += `\nDisabled servers (enable with /mcp enable <server> and /reload): ${disabledServers.join(", ")}\n`;
310
315
  }
311
316
 
312
- const instructionSummaries: string[] = [];
313
- for (const serverName of Object.keys(config.mcpServers)) {
314
- if (isServerDisabled(config.mcpServers[serverName])) continue;
315
- const definition = config.mcpServers[serverName];
316
- const entry = definition && cache?.servers?.[serverName];
317
- const instructions = entry && definition && isServerCacheValid(entry, definition) ? entry.instructions : undefined;
318
- if (!instructions) continue;
319
- const snippet = truncateAtWord(instructions.replace(/\s+/g, " ").trim(), INSTRUCTIONS_SNIPPET_LENGTH);
320
- instructionSummaries.push(` ${serverName}: ${snippet}`);
321
- }
322
- if (instructionSummaries.length > 0) {
323
- desc += `\nServer instructions (truncated - full text via mcp({ instructions: "name" })):\n${instructionSummaries.join("\n")}\n`;
324
- }
325
-
326
317
  desc += `\nUsage:\n`;
327
- desc += ` mcp({ }) → Show server status\n`;
318
+ desc += ` mcp({ }) → Show server status and tool counts\n`;
328
319
  desc += ` mcp({ server: "name" }) → List tools from server\n`;
329
320
  desc += ` mcp({ search: "query" }) → Search MCP tools by name/description\n`;
330
321
  desc += ` mcp({ describe: "tool_name" }) → Show tool details and parameters\n`;
@@ -498,7 +489,10 @@ export function createDirectToolExecutor(
498
489
  (conn) => conn.client.readResource({ uri: spec.resourceUri! }, requestOptions),
499
490
  );
500
491
  const content = transformMcpResourceContents(result.contents ?? [], state.owner?.signal);
501
- const guarded = await guardMcpOutput(content.length > 0 ? content : [{ type: "text" as const, text: "(empty resource)" }], outputGuardOptions);
492
+ const guarded = await guardMcpOutput(content.length > 0 ? content : [{ type: "text" as const, text: "(empty resource)" }], {
493
+ ...outputGuardOptions,
494
+ ...(state.config.settings?.directToolResultDetails === "bounded" ? { rawMcpResult: result } : {}),
495
+ });
502
496
  return {
503
497
  content: guarded.content,
504
498
  details: { server: spec.serverName, resourceUri: spec.resourceUri, ...guardedMcpDetails(guarded) },
@@ -539,7 +533,13 @@ export function createDirectToolExecutor(
539
533
  const content = transformMcpContent(mcpContent, state.owner?.signal);
540
534
  const outputContent = content.length > 0 ? content : [{ type: "text" as const, text: "(empty result)" }];
541
535
  const schemaText = spec.inputSchema ? `\n\nExpected parameters:\n${formatSchema(spec.inputSchema)}` : "";
542
- const guarded = await guardMcpOutput(outputContent, { ...outputGuardOptions, prefix: "Error: ", suffix: schemaText, emptyTextFallback: "Tool execution failed" });
536
+ const guarded = await guardMcpOutput(outputContent, {
537
+ ...outputGuardOptions,
538
+ prefix: "Error: ",
539
+ suffix: schemaText,
540
+ emptyTextFallback: "Tool execution failed",
541
+ ...(state.config.settings?.directToolResultDetails === "bounded" ? { rawMcpResult: result } : {}),
542
+ });
543
543
  return {
544
544
  content: guarded.content,
545
545
  details: { error: "tool_error", server: spec.serverName, ...guardedMcpDetails(guarded) },
@@ -550,7 +550,11 @@ export function createDirectToolExecutor(
550
550
  const outputContent = content.length > 0 ? content : [{ type: "text" as const, text: "(empty result)" }];
551
551
  if (hasUi) {
552
552
  const uiSummary = summarizeUiSessionResult(uiSession);
553
- const guarded = await guardMcpOutput(outputContent, { ...outputGuardOptions, suffix: `\n\n${uiSummary.message}` });
553
+ const guarded = await guardMcpOutput(outputContent, {
554
+ ...outputGuardOptions,
555
+ suffix: `\n\n${uiSummary.message}`,
556
+ ...(state.config.settings?.directToolResultDetails === "bounded" ? { rawMcpResult: result } : {}),
557
+ });
554
558
  return {
555
559
  content: guarded.content,
556
560
  details: {
@@ -564,7 +568,10 @@ export function createDirectToolExecutor(
564
568
  };
565
569
  }
566
570
 
567
- const guarded = await guardMcpOutput(outputContent, { ...outputGuardOptions });
571
+ const guarded = await guardMcpOutput(outputContent, {
572
+ ...outputGuardOptions,
573
+ ...(state.config.settings?.directToolResultDetails === "bounded" ? { rawMcpResult: result } : {}),
574
+ });
568
575
  return {
569
576
  content: guarded.content,
570
577
  details: { server: spec.serverName, tool: spec.originalName, ...guardedMcpDetails(guarded) },
@@ -590,12 +597,16 @@ export function createDirectToolExecutor(
590
597
  };
591
598
  }
592
599
  const message = error instanceof Error ? error.message : String(error);
600
+ const aborted = isAbortError(error, ownedSignal);
601
+ if (!aborted) {
602
+ await state.manager.close(spec.serverName).catch(() => {});
603
+ }
593
604
  uiSession?.sendToolCancelled(message);
594
605
  const schemaText = spec.inputSchema ? `\n\nExpected parameters:\n${formatSchema(spec.inputSchema)}` : "";
595
606
  const guarded = await guardMcpOutput([{ type: "text" as const, text: message }], { ...outputGuardOptions, prefix: "Failed to call tool: ", suffix: schemaText });
596
607
  return {
597
608
  content: guarded.content,
598
- details: { error: isAbortError(error, ownedSignal) ? "aborted" : "call_failed", server: spec.serverName, ...guardedMcpDetails(guarded) },
609
+ details: { error: aborted ? "aborted" : "call_failed", server: spec.serverName, ...guardedMcpDetails(guarded) },
599
610
  };
600
611
  } finally {
601
612
  if (uiSession?.reused) {
@@ -0,0 +1,10 @@
1
+ export declare function getConfigDirName(): string;
2
+ export declare function getAgentDir(): string;
3
+ export declare function getAgentPath(...segments: string[]): string;
4
+ export declare function getAppName(): string;
5
+ /**
6
+ * Home page the host declares for itself, via `piConfig.clientUri` in the same
7
+ * manifest that carries `piConfig.name`. Only the distribution knows its own
8
+ * URL, so this is the one place it can come from without guessing.
9
+ */
10
+ export declare function getAppClientUri(): string | undefined;
@@ -0,0 +1,63 @@
1
+ import { readFileSync } from "node:fs";
2
+ import { homedir } from "node:os";
3
+ import { join, resolve } from "node:path";
4
+ export function getConfigDirName() {
5
+ const configDir = readPiConfig()?.configDir;
6
+ return typeof configDir === "string" && configDir.trim() ? configDir.trim() : ".pi";
7
+ }
8
+ export function getAgentDir() {
9
+ const piConfig = readPiConfig();
10
+ const name = piConfig?.name;
11
+ const appName = typeof name === "string" && name.trim() ? name.trim() : "pi";
12
+ const configured = process.env[`${appName.toUpperCase()}_CODING_AGENT_DIR`]?.trim();
13
+ if (!configured) {
14
+ return join(homedir(), getConfigDirName(), "agent");
15
+ }
16
+ if (configured === "~") {
17
+ return homedir();
18
+ }
19
+ if (configured.startsWith("~/")) {
20
+ return resolve(homedir(), configured.slice(2));
21
+ }
22
+ return resolve(configured);
23
+ }
24
+ export function getAgentPath(...segments) {
25
+ return join(getAgentDir(), ...segments);
26
+ }
27
+ /**
28
+ * What the host calls itself.
29
+ *
30
+ * pi supports rebranding through `piConfig.name` in the package.json that its
31
+ * `getPackageDir()` resolves, and distributions built on pi (arc, tau, …) point
32
+ * `PI_PACKAGE_DIR` at their own manifest. Read that manifest directly rather
33
+ * than importing pi: this package deliberately depends on pi-ai and pi-tui
34
+ * only, and `getAgentDir()` above reads its env var the same self-contained way.
35
+ *
36
+ * Falls back to "pi", which is what pi's own APP_NAME resolves to.
37
+ */
38
+ function readPiConfig() {
39
+ const dir = process.env.PI_PACKAGE_DIR?.trim();
40
+ if (!dir)
41
+ return undefined;
42
+ try {
43
+ const manifest = JSON.parse(readFileSync(join(resolve(dir), "package.json"), "utf8"));
44
+ return manifest.piConfig;
45
+ }
46
+ catch {
47
+ return undefined;
48
+ }
49
+ }
50
+ export function getAppName() {
51
+ const name = readPiConfig()?.name;
52
+ return typeof name === "string" && name.trim() ? name.trim() : "pi";
53
+ }
54
+ /**
55
+ * Home page the host declares for itself, via `piConfig.clientUri` in the same
56
+ * manifest that carries `piConfig.name`. Only the distribution knows its own
57
+ * URL, so this is the one place it can come from without guessing.
58
+ */
59
+ export function getAppClientUri() {
60
+ const uri = readPiConfig()?.clientUri;
61
+ return typeof uri === "string" && uri.trim() ? uri.trim() : undefined;
62
+ }
63
+ //# sourceMappingURL=agent-dir.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agent-dir.js","sourceRoot":"","sources":["../agent-dir.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAE1C,MAAM,UAAU,gBAAgB;IAC9B,MAAM,SAAS,GAAG,YAAY,EAAE,EAAE,SAAS,CAAC;IAC5C,OAAO,OAAO,SAAS,KAAK,QAAQ,IAAI,SAAS,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC;AACtF,CAAC;AAED,MAAM,UAAU,WAAW;IACzB,MAAM,QAAQ,GAAG,YAAY,EAAE,CAAC;IAChC,MAAM,IAAI,GAAG,QAAQ,EAAE,IAAI,CAAC;IAC5B,MAAM,OAAO,GAAG,OAAO,IAAI,KAAK,QAAQ,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;IAC7E,MAAM,UAAU,GAAG,OAAO,CAAC,GAAG,CAAC,GAAG,OAAO,CAAC,WAAW,EAAE,mBAAmB,CAAC,EAAE,IAAI,EAAE,CAAC;IACpF,IAAI,CAAC,UAAU,EAAE,CAAC;QAChB,OAAO,IAAI,CAAC,OAAO,EAAE,EAAE,gBAAgB,EAAE,EAAE,OAAO,CAAC,CAAC;IACtD,CAAC;IACD,IAAI,UAAU,KAAK,GAAG,EAAE,CAAC;QACvB,OAAO,OAAO,EAAE,CAAC;IACnB,CAAC;IACD,IAAI,UAAU,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC;QAChC,OAAO,OAAO,CAAC,OAAO,EAAE,EAAE,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;IACjD,CAAC;IACD,OAAO,OAAO,CAAC,UAAU,CAAC,CAAC;AAC7B,CAAC;AAED,MAAM,UAAU,YAAY,CAAC,GAAG,QAAkB;IAChD,OAAO,IAAI,CAAC,WAAW,EAAE,EAAE,GAAG,QAAQ,CAAC,CAAC;AAC1C,CAAC;AAED;;;;;;;;;;GAUG;AACH,SAAS,YAAY;IACnB,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC,cAAc,EAAE,IAAI,EAAE,CAAA;IAC9C,IAAI,CAAC,GAAG;QAAE,OAAO,SAAS,CAAA;IAC1B,IAAI,CAAC;QACH,MAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,cAAc,CAAC,EAAE,MAAM,CAAC,CAEnF,CAAA;QACD,OAAO,QAAQ,CAAC,QAAQ,CAAA;IAC1B,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,SAAS,CAAA;IAClB,CAAC;AACH,CAAC;AAED,MAAM,UAAU,UAAU;IACxB,MAAM,IAAI,GAAG,YAAY,EAAE,EAAE,IAAI,CAAA;IACjC,OAAO,OAAO,IAAI,KAAK,QAAQ,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,IAAI,CAAA;AACrE,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,eAAe;IAC7B,MAAM,GAAG,GAAG,YAAY,EAAE,EAAE,SAAS,CAAA;IACrC,OAAO,OAAO,GAAG,KAAK,QAAQ,IAAI,GAAG,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,SAAS,CAAA;AACvE,CAAC"}
@@ -0,0 +1,8 @@
1
+ import type { McpConfig } from "./types.ts";
2
+ export interface AgentPluginSummary {
3
+ path: string;
4
+ name?: string;
5
+ serverCount: number;
6
+ }
7
+ export declare function loadAgentPluginConfigs(paths: unknown, cwd?: string): McpConfig;
8
+ export declare function getAgentPluginSummaries(paths: unknown, cwd?: string): AgentPluginSummary[];