@herbertgao/pi-extensions 2026.9.16 → 2026.9.18

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 (267) hide show
  1. package/README.md +14 -15
  2. package/node_modules/@herbertgao/pi-bark/package.json +2 -2
  3. package/node_modules/@herbertgao/pi-cc-extensions/README.en.md +4 -1
  4. package/node_modules/@herbertgao/pi-cc-extensions/README.md +4 -1
  5. package/node_modules/@herbertgao/pi-cc-extensions/package.json +75 -75
  6. package/node_modules/@herbertgao/pi-subagents/CHANGELOG.md +6 -0
  7. package/node_modules/@herbertgao/pi-subagents/package.json +7 -7
  8. package/node_modules/@herbertgao/resume-from/package.json +4 -2
  9. package/node_modules/@herbertgao/sol-pi/package.json +6 -6
  10. package/node_modules/@herbertgao/sol-pi/src/sol-pi/extensions/online-context-compact/extension.ts +11 -53
  11. package/node_modules/@juicesharp/rpiv-ask-user-question/package.json +99 -99
  12. package/node_modules/@pi-plugins/fast-mode/package.json +1 -1
  13. package/node_modules/@tifan/pi-handoff/package.json +1 -1
  14. package/node_modules/@tifan/pi-handoff/src/index.ts +56 -26
  15. package/node_modules/@tifan/pi-mermaid-open/package.json +1 -1
  16. package/node_modules/@tifan/pi-preferred-thinking/package.json +1 -1
  17. package/node_modules/@tifan/pi-recap/package.json +1 -1
  18. package/node_modules/@tifan/pi-rename/package.json +1 -1
  19. package/node_modules/pi-antigravity/package.json +2 -2
  20. package/node_modules/pi-lens/package.json +158 -158
  21. package/node_modules/pi-multi-account/package.json +2 -2
  22. package/node_modules/pi-typesafe/README.md +1 -1
  23. package/node_modules/pi-typesafe/dist/auth.d.ts +9 -5
  24. package/node_modules/pi-typesafe/dist/auth.js +7 -3
  25. package/node_modules/pi-typesafe/dist/backends.d.ts +33 -3
  26. package/node_modules/pi-typesafe/dist/backends.js +95 -1
  27. package/node_modules/pi-typesafe/dist/client.d.ts +5 -5
  28. package/node_modules/pi-typesafe/dist/client.js +12 -9
  29. package/node_modules/pi-typesafe/dist/credentials.d.ts +14 -8
  30. package/node_modules/pi-typesafe/dist/credentials.js +10 -7
  31. package/node_modules/pi-typesafe/dist/errors.d.ts +2 -2
  32. package/node_modules/pi-typesafe/dist/index.d.ts +2 -2
  33. package/node_modules/pi-typesafe/dist/index.js +1 -1
  34. package/node_modules/pi-typesafe/dist/login.d.ts +2 -2
  35. package/node_modules/pi-typesafe/dist/login.js +2 -2
  36. package/node_modules/pi-typesafe/package.json +5 -5
  37. package/node_modules/pi-web-access/package.json +2 -2
  38. package/node_modules/remote-pi/package.json +5 -1
  39. package/package.json +16 -28
  40. package/node_modules/pi-mcp-adapter/CHANGELOG.md +0 -1013
  41. package/node_modules/pi-mcp-adapter/LICENSE +0 -21
  42. package/node_modules/pi-mcp-adapter/OAUTH.md +0 -369
  43. package/node_modules/pi-mcp-adapter/README.md +0 -1021
  44. package/node_modules/pi-mcp-adapter/abort.ts +0 -34
  45. package/node_modules/pi-mcp-adapter/agent-dir.ts +0 -68
  46. package/node_modules/pi-mcp-adapter/agent-plugin-loader.ts +0 -416
  47. package/node_modules/pi-mcp-adapter/agent-plugin-provenance.ts +0 -36
  48. package/node_modules/pi-mcp-adapter/app-bridge.bundle.js +0 -67
  49. package/node_modules/pi-mcp-adapter/banner.png +0 -0
  50. package/node_modules/pi-mcp-adapter/bearer-command-resolver.ts +0 -193
  51. package/node_modules/pi-mcp-adapter/claude-plugin-loader.ts +0 -365
  52. package/node_modules/pi-mcp-adapter/cli.js +0 -454
  53. package/node_modules/pi-mcp-adapter/commands.ts +0 -861
  54. package/node_modules/pi-mcp-adapter/config.ts +0 -1565
  55. package/node_modules/pi-mcp-adapter/consent-manager.ts +0 -95
  56. package/node_modules/pi-mcp-adapter/direct-tool-surface.ts +0 -244
  57. package/node_modules/pi-mcp-adapter/direct-tools.ts +0 -428
  58. package/node_modules/pi-mcp-adapter/dist/abort.d.ts +0 -2
  59. package/node_modules/pi-mcp-adapter/dist/abort.js +0 -36
  60. package/node_modules/pi-mcp-adapter/dist/abort.js.map +0 -1
  61. package/node_modules/pi-mcp-adapter/dist/agent-dir.d.ts +0 -10
  62. package/node_modules/pi-mcp-adapter/dist/agent-dir.js +0 -63
  63. package/node_modules/pi-mcp-adapter/dist/agent-dir.js.map +0 -1
  64. package/node_modules/pi-mcp-adapter/dist/agent-plugin-loader.d.ts +0 -8
  65. package/node_modules/pi-mcp-adapter/dist/agent-plugin-loader.js +0 -398
  66. package/node_modules/pi-mcp-adapter/dist/agent-plugin-loader.js.map +0 -1
  67. package/node_modules/pi-mcp-adapter/dist/agent-plugin-provenance.d.ts +0 -1
  68. package/node_modules/pi-mcp-adapter/dist/agent-plugin-provenance.js +0 -31
  69. package/node_modules/pi-mcp-adapter/dist/agent-plugin-provenance.js.map +0 -1
  70. package/node_modules/pi-mcp-adapter/dist/bearer-command-resolver.d.ts +0 -6
  71. package/node_modules/pi-mcp-adapter/dist/bearer-command-resolver.js +0 -194
  72. package/node_modules/pi-mcp-adapter/dist/bearer-command-resolver.js.map +0 -1
  73. package/node_modules/pi-mcp-adapter/dist/claude-plugin-loader.d.ts +0 -9
  74. package/node_modules/pi-mcp-adapter/dist/claude-plugin-loader.js +0 -362
  75. package/node_modules/pi-mcp-adapter/dist/claude-plugin-loader.js.map +0 -1
  76. package/node_modules/pi-mcp-adapter/dist/config.d.ts +0 -134
  77. package/node_modules/pi-mcp-adapter/dist/config.js +0 -1361
  78. package/node_modules/pi-mcp-adapter/dist/config.js.map +0 -1
  79. package/node_modules/pi-mcp-adapter/dist/consent-manager.d.ts +0 -18
  80. package/node_modules/pi-mcp-adapter/dist/consent-manager.js +0 -88
  81. package/node_modules/pi-mcp-adapter/dist/consent-manager.js.map +0 -1
  82. package/node_modules/pi-mcp-adapter/dist/elicitation-handler.d.ts +0 -17
  83. package/node_modules/pi-mcp-adapter/dist/elicitation-handler.js +0 -316
  84. package/node_modules/pi-mcp-adapter/dist/elicitation-handler.js.map +0 -1
  85. package/node_modules/pi-mcp-adapter/dist/errors.d.ts +0 -131
  86. package/node_modules/pi-mcp-adapter/dist/errors.js +0 -278
  87. package/node_modules/pi-mcp-adapter/dist/errors.js.map +0 -1
  88. package/node_modules/pi-mcp-adapter/dist/http-ca.d.ts +0 -8
  89. package/node_modules/pi-mcp-adapter/dist/http-ca.js +0 -88
  90. package/node_modules/pi-mcp-adapter/dist/http-ca.js.map +0 -1
  91. package/node_modules/pi-mcp-adapter/dist/jev-client.d.ts +0 -14
  92. package/node_modules/pi-mcp-adapter/dist/jev-client.js +0 -367
  93. package/node_modules/pi-mcp-adapter/dist/jev-client.js.map +0 -1
  94. package/node_modules/pi-mcp-adapter/dist/jev-contracts.d.ts +0 -77
  95. package/node_modules/pi-mcp-adapter/dist/jev-contracts.js +0 -2
  96. package/node_modules/pi-mcp-adapter/dist/jev-contracts.js.map +0 -1
  97. package/node_modules/pi-mcp-adapter/dist/jev-key-store.d.ts +0 -51
  98. package/node_modules/pi-mcp-adapter/dist/jev-key-store.js +0 -205
  99. package/node_modules/pi-mcp-adapter/dist/jev-key-store.js.map +0 -1
  100. package/node_modules/pi-mcp-adapter/dist/json-schema-validator.d.ts +0 -2
  101. package/node_modules/pi-mcp-adapter/dist/json-schema-validator.js +0 -68
  102. package/node_modules/pi-mcp-adapter/dist/json-schema-validator.js.map +0 -1
  103. package/node_modules/pi-mcp-adapter/dist/lifecycle.d.ts +0 -56
  104. package/node_modules/pi-mcp-adapter/dist/lifecycle.js +0 -410
  105. package/node_modules/pi-mcp-adapter/dist/lifecycle.js.map +0 -1
  106. package/node_modules/pi-mcp-adapter/dist/logger.d.ts +0 -51
  107. package/node_modules/pi-mcp-adapter/dist/logger.js +0 -131
  108. package/node_modules/pi-mcp-adapter/dist/logger.js.map +0 -1
  109. package/node_modules/pi-mcp-adapter/dist/mcp-auth-fetch.d.ts +0 -26
  110. package/node_modules/pi-mcp-adapter/dist/mcp-auth-fetch.js +0 -103
  111. package/node_modules/pi-mcp-adapter/dist/mcp-auth-fetch.js.map +0 -1
  112. package/node_modules/pi-mcp-adapter/dist/mcp-auth-flow.d.ts +0 -118
  113. package/node_modules/pi-mcp-adapter/dist/mcp-auth-flow.js +0 -1097
  114. package/node_modules/pi-mcp-adapter/dist/mcp-auth-flow.js.map +0 -1
  115. package/node_modules/pi-mcp-adapter/dist/mcp-auth.d.ts +0 -170
  116. package/node_modules/pi-mcp-adapter/dist/mcp-auth.js +0 -1142
  117. package/node_modules/pi-mcp-adapter/dist/mcp-auth.js.map +0 -1
  118. package/node_modules/pi-mcp-adapter/dist/mcp-bearer-store.d.ts +0 -24
  119. package/node_modules/pi-mcp-adapter/dist/mcp-bearer-store.js +0 -203
  120. package/node_modules/pi-mcp-adapter/dist/mcp-bearer-store.js.map +0 -1
  121. package/node_modules/pi-mcp-adapter/dist/mcp-callback-server.d.ts +0 -53
  122. package/node_modules/pi-mcp-adapter/dist/mcp-callback-server.js +0 -441
  123. package/node_modules/pi-mcp-adapter/dist/mcp-callback-server.js.map +0 -1
  124. package/node_modules/pi-mcp-adapter/dist/mcp-oauth-provider.d.ts +0 -148
  125. package/node_modules/pi-mcp-adapter/dist/mcp-oauth-provider.js +0 -689
  126. package/node_modules/pi-mcp-adapter/dist/mcp-oauth-provider.js.map +0 -1
  127. package/node_modules/pi-mcp-adapter/dist/mcp-probe.d.ts +0 -6
  128. package/node_modules/pi-mcp-adapter/dist/mcp-probe.js +0 -166
  129. package/node_modules/pi-mcp-adapter/dist/mcp-probe.js.map +0 -1
  130. package/node_modules/pi-mcp-adapter/dist/mcp-tasks.d.ts +0 -102
  131. package/node_modules/pi-mcp-adapter/dist/mcp-tasks.js +0 -369
  132. package/node_modules/pi-mcp-adapter/dist/mcp-tasks.js.map +0 -1
  133. package/node_modules/pi-mcp-adapter/dist/mcp-trace.d.ts +0 -95
  134. package/node_modules/pi-mcp-adapter/dist/mcp-trace.js +0 -242
  135. package/node_modules/pi-mcp-adapter/dist/mcp-trace.js.map +0 -1
  136. package/node_modules/pi-mcp-adapter/dist/metadata-cache.d.ts +0 -19
  137. package/node_modules/pi-mcp-adapter/dist/metadata-cache.js +0 -301
  138. package/node_modules/pi-mcp-adapter/dist/metadata-cache.js.map +0 -1
  139. package/node_modules/pi-mcp-adapter/dist/npx-resolver.d.ts +0 -6
  140. package/node_modules/pi-mcp-adapter/dist/npx-resolver.js +0 -505
  141. package/node_modules/pi-mcp-adapter/dist/npx-resolver.js.map +0 -1
  142. package/node_modules/pi-mcp-adapter/dist/package-mcp-loader.d.ts +0 -2
  143. package/node_modules/pi-mcp-adapter/dist/package-mcp-loader.js +0 -144
  144. package/node_modules/pi-mcp-adapter/dist/package-mcp-loader.js.map +0 -1
  145. package/node_modules/pi-mcp-adapter/dist/request-headers-command.d.ts +0 -10
  146. package/node_modules/pi-mcp-adapter/dist/request-headers-command.js +0 -312
  147. package/node_modules/pi-mcp-adapter/dist/request-headers-command.js.map +0 -1
  148. package/node_modules/pi-mcp-adapter/dist/resource-tools.d.ts +0 -1
  149. package/node_modules/pi-mcp-adapter/dist/resource-tools.js +0 -15
  150. package/node_modules/pi-mcp-adapter/dist/resource-tools.js.map +0 -1
  151. package/node_modules/pi-mcp-adapter/dist/runtime-owner.d.ts +0 -13
  152. package/node_modules/pi-mcp-adapter/dist/runtime-owner.js +0 -97
  153. package/node_modules/pi-mcp-adapter/dist/runtime-owner.js.map +0 -1
  154. package/node_modules/pi-mcp-adapter/dist/sampling-handler.d.ts +0 -17
  155. package/node_modules/pi-mcp-adapter/dist/sampling-handler.js +0 -203
  156. package/node_modules/pi-mcp-adapter/dist/sampling-handler.js.map +0 -1
  157. package/node_modules/pi-mcp-adapter/dist/secure-keyring.d.ts +0 -11
  158. package/node_modules/pi-mcp-adapter/dist/secure-keyring.js +0 -172
  159. package/node_modules/pi-mcp-adapter/dist/secure-keyring.js.map +0 -1
  160. package/node_modules/pi-mcp-adapter/dist/server-manager.d.ts +0 -157
  161. package/node_modules/pi-mcp-adapter/dist/server-manager.js +0 -1745
  162. package/node_modules/pi-mcp-adapter/dist/server-manager.js.map +0 -1
  163. package/node_modules/pi-mcp-adapter/dist/session-approvals.d.ts +0 -34
  164. package/node_modules/pi-mcp-adapter/dist/session-approvals.js +0 -140
  165. package/node_modules/pi-mcp-adapter/dist/session-approvals.js.map +0 -1
  166. package/node_modules/pi-mcp-adapter/dist/session-recovery.d.ts +0 -26
  167. package/node_modules/pi-mcp-adapter/dist/session-recovery.js +0 -142
  168. package/node_modules/pi-mcp-adapter/dist/session-recovery.js.map +0 -1
  169. package/node_modules/pi-mcp-adapter/dist/state.d.ts +0 -73
  170. package/node_modules/pi-mcp-adapter/dist/state.js +0 -2
  171. package/node_modules/pi-mcp-adapter/dist/state.js.map +0 -1
  172. package/node_modules/pi-mcp-adapter/dist/types.d.ts +0 -642
  173. package/node_modules/pi-mcp-adapter/dist/types.js +0 -331
  174. package/node_modules/pi-mcp-adapter/dist/types.js.map +0 -1
  175. package/node_modules/pi-mcp-adapter/dist/ui-app-bridge-helpers.d.ts +0 -6
  176. package/node_modules/pi-mcp-adapter/dist/ui-app-bridge-helpers.js +0 -37
  177. package/node_modules/pi-mcp-adapter/dist/ui-app-bridge-helpers.js.map +0 -1
  178. package/node_modules/pi-mcp-adapter/dist/ui-resource-handler.d.ts +0 -17
  179. package/node_modules/pi-mcp-adapter/dist/ui-resource-handler.js +0 -219
  180. package/node_modules/pi-mcp-adapter/dist/ui-resource-handler.js.map +0 -1
  181. package/node_modules/pi-mcp-adapter/dist/ui-stream-types.d.ts +0 -104
  182. package/node_modules/pi-mcp-adapter/dist/ui-stream-types.js +0 -59
  183. package/node_modules/pi-mcp-adapter/dist/ui-stream-types.js.map +0 -1
  184. package/node_modules/pi-mcp-adapter/dist/ui-tool-visibility.d.ts +0 -4
  185. package/node_modules/pi-mcp-adapter/dist/ui-tool-visibility.js +0 -27
  186. package/node_modules/pi-mcp-adapter/dist/ui-tool-visibility.js.map +0 -1
  187. package/node_modules/pi-mcp-adapter/dist/unix-socket-transport.d.ts +0 -15
  188. package/node_modules/pi-mcp-adapter/dist/unix-socket-transport.js +0 -85
  189. package/node_modules/pi-mcp-adapter/dist/unix-socket-transport.js.map +0 -1
  190. package/node_modules/pi-mcp-adapter/dist/utils.d.ts +0 -41
  191. package/node_modules/pi-mcp-adapter/dist/utils.js +0 -417
  192. package/node_modules/pi-mcp-adapter/dist/utils.js.map +0 -1
  193. package/node_modules/pi-mcp-adapter/elicitation-handler.ts +0 -358
  194. package/node_modules/pi-mcp-adapter/error-signal.ts +0 -32
  195. package/node_modules/pi-mcp-adapter/errors.ts +0 -364
  196. package/node_modules/pi-mcp-adapter/examples/jev-accessibility-loop.mjs +0 -85
  197. package/node_modules/pi-mcp-adapter/examples/jev-semantic-filter.mjs +0 -34
  198. package/node_modules/pi-mcp-adapter/failure-backoff.ts +0 -23
  199. package/node_modules/pi-mcp-adapter/glimpse-ui.ts +0 -80
  200. package/node_modules/pi-mcp-adapter/host-html-template.ts +0 -515
  201. package/node_modules/pi-mcp-adapter/http-ca.ts +0 -84
  202. package/node_modules/pi-mcp-adapter/index.ts +0 -2106
  203. package/node_modules/pi-mcp-adapter/init.ts +0 -721
  204. package/node_modules/pi-mcp-adapter/jev-client.ts +0 -300
  205. package/node_modules/pi-mcp-adapter/jev-contracts.ts +0 -53
  206. package/node_modules/pi-mcp-adapter/jev-key-store.ts +0 -192
  207. package/node_modules/pi-mcp-adapter/json-schema-validator.ts +0 -83
  208. package/node_modules/pi-mcp-adapter/lazy-loader.ts +0 -7
  209. package/node_modules/pi-mcp-adapter/lifecycle.ts +0 -457
  210. package/node_modules/pi-mcp-adapter/logger.ts +0 -169
  211. package/node_modules/pi-mcp-adapter/mcp-auth-fetch.ts +0 -113
  212. package/node_modules/pi-mcp-adapter/mcp-auth-flow.ts +0 -1296
  213. package/node_modules/pi-mcp-adapter/mcp-auth.ts +0 -1287
  214. package/node_modules/pi-mcp-adapter/mcp-bearer-store.ts +0 -250
  215. package/node_modules/pi-mcp-adapter/mcp-callback-server.ts +0 -534
  216. package/node_modules/pi-mcp-adapter/mcp-code.ts +0 -495
  217. package/node_modules/pi-mcp-adapter/mcp-install.ts +0 -60
  218. package/node_modules/pi-mcp-adapter/mcp-keyring-helper.cjs +0 -89
  219. package/node_modules/pi-mcp-adapter/mcp-oauth-provider.ts +0 -819
  220. package/node_modules/pi-mcp-adapter/mcp-output-guard.ts +0 -511
  221. package/node_modules/pi-mcp-adapter/mcp-panel-theme.ts +0 -104
  222. package/node_modules/pi-mcp-adapter/mcp-panel.ts +0 -1099
  223. package/node_modules/pi-mcp-adapter/mcp-probe.ts +0 -201
  224. package/node_modules/pi-mcp-adapter/mcp-references.ts +0 -373
  225. package/node_modules/pi-mcp-adapter/mcp-script-worker.mjs +0 -137
  226. package/node_modules/pi-mcp-adapter/mcp-setup-panel.ts +0 -747
  227. package/node_modules/pi-mcp-adapter/mcp-status.ts +0 -105
  228. package/node_modules/pi-mcp-adapter/mcp-tasks.ts +0 -467
  229. package/node_modules/pi-mcp-adapter/mcp-trace.ts +0 -306
  230. package/node_modules/pi-mcp-adapter/metadata-cache.ts +0 -362
  231. package/node_modules/pi-mcp-adapter/namespace-tools.ts +0 -334
  232. package/node_modules/pi-mcp-adapter/npx-resolver.ts +0 -543
  233. package/node_modules/pi-mcp-adapter/oauth-handler.ts +0 -30
  234. package/node_modules/pi-mcp-adapter/oauth.ts +0 -52
  235. package/node_modules/pi-mcp-adapter/onboarding-state.ts +0 -76
  236. package/node_modules/pi-mcp-adapter/package-mcp-loader.ts +0 -156
  237. package/node_modules/pi-mcp-adapter/package.json +0 -219
  238. package/node_modules/pi-mcp-adapter/panel-keys.ts +0 -53
  239. package/node_modules/pi-mcp-adapter/prompts.ts +0 -385
  240. package/node_modules/pi-mcp-adapter/proxy-modes.ts +0 -1735
  241. package/node_modules/pi-mcp-adapter/request-headers-command.ts +0 -333
  242. package/node_modules/pi-mcp-adapter/resource-tools.ts +0 -17
  243. package/node_modules/pi-mcp-adapter/runtime-owner.ts +0 -106
  244. package/node_modules/pi-mcp-adapter/sampling-handler.ts +0 -261
  245. package/node_modules/pi-mcp-adapter/sandbox-proxy-template.ts +0 -144
  246. package/node_modules/pi-mcp-adapter/search-ranking.ts +0 -309
  247. package/node_modules/pi-mcp-adapter/secure-keyring.ts +0 -170
  248. package/node_modules/pi-mcp-adapter/semantic-search.ts +0 -186
  249. package/node_modules/pi-mcp-adapter/server-manager.ts +0 -2088
  250. package/node_modules/pi-mcp-adapter/session-approvals.ts +0 -201
  251. package/node_modules/pi-mcp-adapter/session-recovery.ts +0 -158
  252. package/node_modules/pi-mcp-adapter/skills/mcp-scripting/SKILL.md +0 -49
  253. package/node_modules/pi-mcp-adapter/state.ts +0 -71
  254. package/node_modules/pi-mcp-adapter/tool-approval.ts +0 -205
  255. package/node_modules/pi-mcp-adapter/tool-metadata.ts +0 -302
  256. package/node_modules/pi-mcp-adapter/tool-registrar.ts +0 -255
  257. package/node_modules/pi-mcp-adapter/tool-result-renderer.ts +0 -573
  258. package/node_modules/pi-mcp-adapter/ts-shape.ts +0 -149
  259. package/node_modules/pi-mcp-adapter/types.ts +0 -1120
  260. package/node_modules/pi-mcp-adapter/ui-app-bridge-helpers.ts +0 -40
  261. package/node_modules/pi-mcp-adapter/ui-resource-handler.ts +0 -266
  262. package/node_modules/pi-mcp-adapter/ui-server.ts +0 -993
  263. package/node_modules/pi-mcp-adapter/ui-session.ts +0 -624
  264. package/node_modules/pi-mcp-adapter/ui-stream-types.ts +0 -89
  265. package/node_modules/pi-mcp-adapter/ui-tool-visibility.ts +0 -25
  266. package/node_modules/pi-mcp-adapter/unix-socket-transport.ts +0 -85
  267. package/node_modules/pi-mcp-adapter/utils.ts +0 -464
@@ -1,642 +0,0 @@
1
- import type { CallToolResult, ContentBlock as McpContentBlock, ListPromptsResult, ListResourcesResult, ListToolsResult, Transport as McpTransport } from "@modelcontextprotocol/client";
2
- import type { TextContent, ImageContent } from "@earendil-works/pi-ai";
3
- import type { UiStreamMode, UiStreamSummary } from "./ui-stream-types.ts";
4
- import type { UiToolVisibility } from "./ui-tool-visibility.ts";
5
- export type Transport = McpTransport;
6
- /** Versioned shared-event-bus channel for read-only MCP runtime snapshots. */
7
- export declare const MCP_STATUS_EVENT = "pi-mcp-adapter/status/v1";
8
- export declare const MCP_STATUS_SNAPSHOT_VERSION: 1;
9
- export type McpServerRuntimeStatus = "connected" | "cached" | "failed" | "needs-auth" | "not-connected" | "disabled";
10
- export type McpListenState = "active" | "dropped" | "re-establishing" | "legacy" | "not-listening" | "disconnected";
11
- export interface McpServerStatusSnapshot {
12
- readonly name: string;
13
- readonly status: McpServerRuntimeStatus;
14
- readonly toolCount: number;
15
- readonly directToolCount: number;
16
- readonly resourceCount?: number;
17
- readonly failedAgoSeconds?: number;
18
- readonly disabled: boolean;
19
- readonly listenState: McpListenState;
20
- readonly catalogStale?: boolean;
21
- }
22
- export interface McpStatusSnapshot {
23
- readonly version: typeof MCP_STATUS_SNAPSHOT_VERSION;
24
- readonly servers: ReadonlyArray<McpServerStatusSnapshot>;
25
- readonly totalTools: number;
26
- readonly totalResources: number;
27
- readonly connectedCount: number;
28
- readonly disabledCount: number;
29
- }
30
- /**
31
- * Minimal event-bus surface the status publisher needs. Lives here (leaf
32
- * module) so `state.ts` can reference it without importing `mcp-status.ts`,
33
- * which imports the state type back — an import cycle at type level.
34
- */
35
- export interface McpStatusEventBus {
36
- emit(channel: string, data: unknown): void;
37
- }
38
- export type ImportKind = "cursor" | "claude-code" | "claude-desktop" | "codex" | "opencode" | "windsurf" | "vscode";
39
- type SdkTool = ListToolsResult["tools"][number];
40
- type SdkResource = ListResourcesResult["resources"][number];
41
- type SdkPrompt = ListPromptsResult["prompts"][number];
42
- type SdkPromptArgument = NonNullable<SdkPrompt["arguments"]>[number];
43
- export interface McpTool {
44
- name: SdkTool["name"];
45
- title?: SdkTool["title"];
46
- description?: SdkTool["description"];
47
- inputSchema?: SdkTool["inputSchema"];
48
- outputSchema?: SdkTool["outputSchema"];
49
- _meta?: SdkTool["_meta"];
50
- }
51
- export interface McpResource {
52
- uri: SdkResource["uri"];
53
- name: SdkResource["name"];
54
- description?: SdkResource["description"];
55
- mimeType?: SdkResource["mimeType"];
56
- _meta?: SdkResource["_meta"];
57
- }
58
- export interface McpPromptArgument {
59
- name: SdkPromptArgument["name"];
60
- description?: SdkPromptArgument["description"];
61
- required?: SdkPromptArgument["required"];
62
- }
63
- export interface McpPrompt {
64
- name: SdkPrompt["name"];
65
- title?: SdkPrompt["title"];
66
- description?: SdkPrompt["description"];
67
- arguments?: SdkPrompt["arguments"];
68
- _meta?: SdkPrompt["_meta"];
69
- }
70
- export interface UiResourceMeta {
71
- csp?: UiResourceCsp;
72
- permissions?: UiResourcePermissions;
73
- domain?: string;
74
- prefersBorder?: boolean;
75
- }
76
- export interface UiResourceContent {
77
- uri: string;
78
- html: string;
79
- mimeType?: string;
80
- meta: UiResourceMeta;
81
- }
82
- export interface UiProxyRequestBody<TParams> {
83
- token: string;
84
- params: TParams;
85
- }
86
- export interface UiProxyResult<T = Record<string, unknown>> {
87
- ok: boolean;
88
- result?: T;
89
- error?: string;
90
- }
91
- export interface UiResourceCsp {
92
- resourceDomains?: string[];
93
- connectDomains?: string[];
94
- frameDomains?: string[];
95
- baseUriDomains?: string[];
96
- }
97
- export interface UiResourcePermissions {
98
- camera?: {};
99
- microphone?: {};
100
- geolocation?: {};
101
- clipboardWrite?: {};
102
- }
103
- export interface UiToolInfo {
104
- id?: string | number;
105
- tool: {
106
- name: string;
107
- description?: string;
108
- inputSchema?: unknown;
109
- };
110
- }
111
- export interface UiHostContext {
112
- toolInfo?: UiToolInfo;
113
- theme?: "light" | "dark";
114
- styles?: Record<string, unknown>;
115
- displayMode?: UiDisplayMode;
116
- availableDisplayModes?: UiDisplayMode[];
117
- containerDimensions?: {
118
- width?: number;
119
- maxWidth?: number;
120
- height?: number;
121
- maxHeight?: number;
122
- };
123
- [key: string]: unknown;
124
- }
125
- export type UiDisplayMode = "inline" | "fullscreen" | "pip";
126
- /**
127
- * Live handle to a started UI tool session. Lives here (leaf module) so
128
- * `state.ts` can reference it without importing `ui-server.ts`, which
129
- * imports the state type back — an import cycle at type level.
130
- */
131
- export interface UiServerHandle {
132
- url: string;
133
- port: number;
134
- /** URL of the second-origin MCP Apps sandbox proxy. */
135
- proxyUrl: string;
136
- proxyPort: number;
137
- sessionToken: string;
138
- serverName: string;
139
- toolName: string;
140
- viewer?: "browser" | "glimpse" | "orca" | "suppressed";
141
- windowOpen?: boolean;
142
- close: (reason?: string) => void;
143
- sendToolInput: (args: Record<string, unknown>) => void;
144
- sendToolResult: (result: CallToolResult) => void;
145
- sendResultPatch: (result: CallToolResult) => void;
146
- sendToolCancelled: (reason: string) => void;
147
- sendResourceUpdated: (uri: string) => void;
148
- sendHostContext: (context: UiHostContext) => void;
149
- /** Get accumulated messages from this session */
150
- getSessionMessages: () => UiSessionMessages;
151
- getStreamSummary: () => UiStreamSummary | undefined;
152
- }
153
- export { UI_STREAM_HOST_CONTEXT_KEY, UI_STREAM_REQUEST_META_KEY, UI_STREAM_RESULT_PATCH_METHOD, SERVER_STREAM_RESULT_PATCH_METHOD, UI_STREAM_STRUCTURED_CONTENT_KEY, uiStreamModeSchema, visualizationStreamPhaseSchema, visualizationStreamFrameTypeSchema, visualizationStreamStatusSchema, uiStreamHostContextSchema, visualizationStreamEnvelopeSchema, uiStreamCallToolResultSchema, uiStreamResultPatchNotificationSchema, serverStreamResultPatchNotificationSchema, getUiStreamHostContext, getVisualizationStreamEnvelope, type UiStreamMode, type VisualizationStreamPhase, type VisualizationStreamFrameType, type VisualizationStreamStatus, type UiStreamHostContext, type VisualizationStreamEnvelope, type UiStreamCallToolResult, type UiStreamResultPatchNotification, type ServerStreamResultPatchNotification, type UiStreamSummary, } from "./ui-stream-types.ts";
154
- export interface UiMessageParams {
155
- role?: string;
156
- content?: unknown[];
157
- type?: "prompt" | "notify" | "intent" | "message";
158
- message?: string;
159
- prompt?: string;
160
- intent?: string;
161
- params?: Record<string, unknown>;
162
- [key: string]: unknown;
163
- }
164
- /**
165
- * Extract prompt text from either legacy MCP UI message shapes or native AppBridge user messages.
166
- */
167
- export declare function extractUiPromptText(params: UiMessageParams): string | undefined;
168
- /**
169
- * Structured UI handoff recovered from a canonical prompt envelope.
170
- */
171
- export interface UiPromptHandoff {
172
- intent: string;
173
- params: Record<string, unknown>;
174
- raw: string;
175
- }
176
- /**
177
- * Parse a canonical named UI handoff encoded as `intent\n{json}`.
178
- */
179
- export declare function parseUiPromptHandoff(prompt: string): UiPromptHandoff | undefined;
180
- /**
181
- * Accumulated messages from a UI session.
182
- * Collected during the session and available when it ends.
183
- */
184
- export interface UiSessionMessages {
185
- prompts: string[];
186
- notifications: string[];
187
- intents: Array<{
188
- intent: string;
189
- params?: Record<string, unknown>;
190
- }>;
191
- contexts: UiModelContextUpdate[];
192
- }
193
- export interface UiModelContextUpdate {
194
- summary: string;
195
- truncated: boolean;
196
- payload?: Record<string, unknown>;
197
- }
198
- export interface UiModelContextParams {
199
- content?: McpContentBlock[];
200
- structuredContent?: Record<string, unknown>;
201
- }
202
- export declare function createUiModelContextUpdate(params: UiModelContextParams, maxChars?: number): UiModelContextUpdate | undefined;
203
- export interface UiOpenLinkResult {
204
- isError?: boolean;
205
- [key: string]: unknown;
206
- }
207
- export interface UiDisplayModeRequest {
208
- mode?: UiDisplayMode;
209
- }
210
- export interface UiDisplayModeResult {
211
- mode: UiDisplayMode;
212
- [key: string]: unknown;
213
- }
214
- export interface McpContent {
215
- type: "text" | "image" | "audio" | "resource" | "resource_link";
216
- text?: string;
217
- data?: string;
218
- mimeType?: string;
219
- resource?: {
220
- uri: string;
221
- text?: string;
222
- blob?: string;
223
- };
224
- uri?: string;
225
- name?: string;
226
- description?: string;
227
- }
228
- export type ContentBlock = TextContent | ImageContent;
229
- export interface OAuthConfig {
230
- /** OAuth grant type (defaults to authorization_code) */
231
- grantType?: "authorization_code" | "client_credentials";
232
- /** Pre-registered client ID (optional, dynamic registration used if not provided) */
233
- clientId?: string;
234
- /** Client secret for confidential clients; requires an explicit clientId when clientMetadataUrl is set. */
235
- clientSecret?: string;
236
- /** Operator-supplied public HTTPS Client ID Metadata Document URL (SEP-991); opt-in, with DCR remaining the default. */
237
- clientMetadataUrl?: string;
238
- /** Requested OAuth scopes */
239
- scope?: string;
240
- /** Extra authorization URL parameters for provider-specific extensions. Flow-owned parameters cannot be overridden. */
241
- authorizationParams?: Record<string, string>;
242
- /** Authorization-code redirect URI. Loopback URIs may use `{port}` for an OS-assigned port; HTTPS redirects use manual completion. */
243
- redirectUri?: string;
244
- /** Client display name for dynamic registration */
245
- clientName?: string;
246
- /** Client homepage URI for dynamic registration */
247
- clientUri?: string;
248
- /** Client logo URL for dynamic registration; shown on consent screens */
249
- logoUri?: string;
250
- /** HTTPS URL for an authorization-server metadata document used instead of MCP discovery */
251
- authServerMetadataUrl?: string;
252
- /** Security-weakening escape hatch for known-misconfigured authorization servers. */
253
- skipIssuerMetadataValidation?: boolean;
254
- }
255
- /**
256
- * Trusted executable invoked for every outbound HTTP request. The adapter
257
- * writes a versioned JSON request envelope to stdin and expects a JSON object
258
- * containing headers on stdout. This is intended for caller-bound signing
259
- * schemes whose headers depend on the exact request body.
260
- */
261
- export interface HttpRequestHeadersCommand {
262
- command: string;
263
- args?: string[];
264
- env?: Record<string, string>;
265
- timeoutMs?: number;
266
- }
267
- export interface ServerEntry {
268
- command?: string;
269
- args?: string[];
270
- /** Explicit rmcp-mux Unix-domain socket path. Mutually exclusive with command and url. */
271
- socket?: string;
272
- env?: Record<string, string>;
273
- /** Inherit the adapter process environment for stdio servers. Defaults to true; false keeps SDK platform defaults plus explicit env overlays. */
274
- inheritEnv?: boolean;
275
- cwd?: string;
276
- url?: string;
277
- /** PEM CA bundle replacing default roots for this HTTPS MCP origin only. */
278
- caFile?: string;
279
- headers?: Record<string, string>;
280
- /** Add or replace HTTP headers by running a trusted command for each request. */
281
- requestHeadersCommand?: HttpRequestHeadersCommand;
282
- /**
283
- * Authentication type:
284
- * - 'oauth' - Use OAuth 2.1 (auto-discovers endpoints, supports dynamic client registration)
285
- * - 'bearer' - Use static Bearer token
286
- * - false - Disable authentication
287
- * If not specified and url is present, OAuth will be auto-detected unless custom headers are configured
288
- */
289
- auth?: "oauth" | "bearer" | false;
290
- bearerToken?: string;
291
- bearerTokenEnv?: string;
292
- /** Read a static bearer token from the adapter-owned OS credential store. */
293
- bearerTokenStore?: true;
294
- /**
295
- * OAuth configuration (optional).
296
- * If not provided, the SDK will attempt dynamic client registration.
297
- * Set to false to explicitly disable OAuth for this server.
298
- */
299
- oauth?: OAuthConfig | false;
300
- lifecycle?: "keep-alive" | "lazy" | "lazy-keep-alive" | "eager";
301
- idleTimeout?: number;
302
- requestTimeoutMs?: number;
303
- exposeResources?: boolean;
304
- directTools?: boolean | string[] | "search";
305
- toolPrefix?: ToolPrefix;
306
- includeTools?: string[];
307
- excludeTools?: string[];
308
- /**
309
- * Extra search keywords per tool, keyed by original name, prefixed name, or
310
- * glob (same matching rules as includeTools/excludeTools). Keywords boost
311
- * mcp({ search }) ranking only — they never appear in tool schemas,
312
- * describe output, or the metadata cache.
313
- */
314
- searchKeywords?: Record<string, string[]>;
315
- approveTools?: boolean | string[];
316
- debug?: boolean;
317
- /** Enable metadata-only JSONL protocol tracing for this server. */
318
- trace?: boolean;
319
- /** Force a specific HTTP MCP transport. Used by Agent Plugins, whose `type` declares the transport and forbids client fallback. */
320
- httpTransport?: "streamable-http" | "sse";
321
- /** Client-managed persistent data directory for Agent Plugin stdio servers. */
322
- pluginDataDir?: string;
323
- /** Treat env values as already resolved literals. Used for Agent Plugin env rules. */
324
- literalEnv?: boolean;
325
- /**
326
- * MCP protocol era negotiation for this server. Defaults to `"legacy"`
327
- * (byte-equivalent to pre-2026 behavior — no `versionNegotiation` is sent).
328
- * `"auto"` offers the SDK's default 2026-07-28+ modern versions with
329
- * legacy fallback; `"2026-07-28"` pins the connection to that revision
330
- * with no fallback. `auto` and `2026-07-28` must be set explicitly.
331
- */
332
- protocolVersion?: "legacy" | "auto" | "2026-07-28";
333
- /**
334
- * MCP Tasks extension (io.modelcontextprotocol/tasks, SEP-2663) support.
335
- * On 2026-07-28 connections where the server advertises the extension, tool
336
- * calls that return a task handle are transparently polled to completion,
337
- * task-time elicitation is routed through the normal elicitation UI, and
338
- * aborting a call cancels the remote task. Enabled by default; set to
339
- * false to keep the plain synchronous call path.
340
- */
341
- tasks?: boolean;
342
- disabled?: boolean;
343
- }
344
- /** Only the literal boolean `true` disables a server. */
345
- export declare function isServerDisabled(definition: ServerEntry | undefined): boolean;
346
- export interface McpOutputGuardSettings {
347
- /** Maximum inline MCP text output bytes before truncation/spill-to-disk. Defaults to 51200 (50 KiB). */
348
- maxBytes?: number;
349
- /** Maximum inline MCP text output lines before truncation/spill-to-disk. Defaults to 2000. */
350
- maxLines?: number;
351
- /** Maximum details.mcpResult JSON bytes kept raw; larger results are summarized and spilled to disk. Defaults to 16384 (16 KiB). */
352
- detailsMaxBytes?: number;
353
- }
354
- export type ToolPrefix = "server" | "none" | "short" | "mcp";
355
- export declare function formatServerNamespace(serverName: string): string;
356
- export type HostConfigDiscovery = "off" | "prompt" | "on";
357
- export type McpFooterStatus = "full" | "compact" | "off";
358
- export interface McpTraceSettings {
359
- /** Enable tracing for all servers unless a server sets trace to false. */
360
- enabled?: boolean;
361
- /** JSONL destination; relative paths are resolved from the session cwd. */
362
- file?: string;
363
- /** Maximum per-session trace file size in bytes. */
364
- maxBytes?: number;
365
- /** Maximum events retained in the per-session trace file. */
366
- maxEvents?: number;
367
- }
368
- export declare const MCP_TOOL_APPROVAL_REQUEST_EVENT: "pi-mcp-adapter:tool-approval-request";
369
- export type McpToolApprovalOrigin = "proxy" | "direct" | "script" | "resource" | "iframe";
370
- export type McpToolApprovalDecision = "allow_once" | "allow_for_session" | "deny" | "abstain";
371
- export type McpToolApprovalHandler = () => McpToolApprovalDecision | Promise<McpToolApprovalDecision>;
372
- export interface McpToolApprovalRequest {
373
- requestId: string;
374
- serverName: string;
375
- originalToolName: string;
376
- prefixedToolName: string;
377
- args: Record<string, unknown>;
378
- origin: McpToolApprovalOrigin;
379
- signal?: AbortSignal;
380
- claim(handler: McpToolApprovalHandler): boolean;
381
- }
382
- export type { JevAnswer, JevErrorCode, JevEvaluateInput, JevEvaluationData, JevEvaluationEnvelope, JevJson, JevQuestion } from "./jev-contracts.ts";
383
- export interface McpSettings {
384
- toolPrefix?: ToolPrefix;
385
- /** Allow agents to persist remote MCP endpoints with the install action. Defaults to true. */
386
- allowInstall?: boolean;
387
- /** Show the plug prefix in MCP status and connection text (default: true). Set to false to disable it. */
388
- showStatusIcon?: boolean;
389
- /** Footer status verbosity: full details, compact connected/enabled count, or no footer status. Defaults to full. */
390
- mcpFooterStatus?: McpFooterStatus;
391
- /** Show successful startup connection notifications. Defaults to true. */
392
- notifyOnStartupConnect?: boolean;
393
- /** Discover detected host-specific MCP configs only when explicitly enabled. */
394
- hostConfigDiscovery?: HostConfigDiscovery;
395
- /** Trusted HOME-contained roots from which to discover ancestor project configs. */
396
- ancestorConfigRoots?: string[];
397
- /** Agent Plugin package directories to load MCP servers from. */
398
- agentPluginPaths?: string[];
399
- idleTimeout?: number;
400
- requestTimeoutMs?: number;
401
- /** Defer lazy runtime startup even when persisted metadata is missing or invalid. Defaults to false. */
402
- deferWithMissingMetadata?: boolean;
403
- directTools?: boolean | "search";
404
- /** Register per-server mcp__<server> namespace proxies. Defaults to true. */
405
- namespaceProxyTools?: boolean;
406
- /**
407
- * Validate direct-tool inputs against the advertised schema after recovering
408
- * one JSON string layer for object and array properties. Defaults to false.
409
- */
410
- strictDirectToolArguments?: boolean;
411
- /**
412
- * Include the byte-bounded raw MCP result in direct-tool details. The default
413
- * `lean` mode keeps the existing small details object.
414
- */
415
- directToolResultDetails?: "lean" | "bounded";
416
- /** Show the advisory when 75 or more direct tools resolve. Defaults to true. */
417
- warnOnLargeDirectTools?: boolean;
418
- /** Register the trusted MCP-only JavaScript scripting tool. Defaults to true; set false to hide it. */
419
- scriptMode?: boolean;
420
- /** Expose MCP resources as tools (default: true). Set to false to disable globally across all servers. */
421
- exposeResources?: boolean;
422
- /** Optional Jev (System One) integrations. A valid key enables semantic search; script evaluation remains disabled by default. */
423
- jev?: false | {
424
- semanticSearch?: boolean;
425
- scriptEvaluation?: boolean;
426
- /** Restrict semantic-search metadata and allow script-evaluation sources. Semantic search defaults to every enabled server. */
427
- allowedServers?: string[];
428
- model?: string;
429
- requestTimeoutMs?: number;
430
- maxRetries?: number;
431
- maxStateBytes?: number;
432
- maxQuestionsPerRequest?: number;
433
- maxEvaluationsPerScript?: number;
434
- maxEvaluationBytesPerScript?: number;
435
- /** Cumulative provider-reported input plus output tokens per script. Defaults to 32768. */
436
- maxEvaluationTokensPerScript?: number;
437
- /** Maximum semantic candidates per request. Defaults to 127; range 2..127. */
438
- semanticCandidateLimit?: number;
439
- semanticMinProbability?: number;
440
- };
441
- /** Render MCP tool results as compact self-rendered rows by default, or as the legacy boxed row. */
442
- toolResultRendering?: "compact" | "boxed";
443
- /** Number of result text lines to show before expansion. Supports 1, 2, or 3. Defaults to 1 in compact mode and 3 in boxed mode. */
444
- collapsedResultLines?: 1 | 2 | 3;
445
- /** Default approval gate for matching tools/resources; per-server settings override it. */
446
- approveTools?: boolean | string[];
447
- disableProxyTool?: boolean;
448
- /** Freeze direct-tool registration after the initial sync. Automatic metadata updates
449
- * and explicit reconnects won't rebuild the system prompt, preserving the
450
- * prompt-cache prefix. Proxy/search/cache metadata still refreshes. Default: false. */
451
- freezeDirectTools?: boolean;
452
- autoAuth?: boolean;
453
- sampling?: boolean;
454
- samplingAutoApprove?: boolean;
455
- elicitation?: boolean;
456
- /**
457
- * Guard oversized MCP tool/resource output before it is returned to the model.
458
- * Defaults to true (50 KiB / 2,000 lines inline text, 16 KiB details.mcpResult).
459
- * Set to false to restore raw MCP output behavior, or pass an object to tune
460
- * the limits. Env kill switch: MCP_OUTPUT_GUARD=0.
461
- */
462
- outputGuard?: boolean | McpOutputGuardSettings;
463
- /**
464
- * Opt-in metadata-only MCP protocol tracing. Payloads, prompts, tool
465
- * arguments/results, authorization data, and URLs are never persisted.
466
- */
467
- trace?: McpTraceSettings;
468
- /**
469
- * Message returned in tool results when a server needs (re-)authentication.
470
- * "${server}" is substituted with the server name. Defaults to a TUI
471
- * instruction when unset.
472
- */
473
- authRequiredMessage?: string;
474
- /** Explicitly use AES-256-GCM files keyed by PI_MCP_ADAPTER_OAUTH_FILE_KEY instead of the OS credential store. */
475
- oauthCredentialStore?: "encrypted-file";
476
- /**
477
- * Legacy OAuth tokens.json import directory.
478
- * Relative paths are resolved from the project root (cwd).
479
- * Takes precedence over the agent's mcp-oauth/ legacy import directory but
480
- * can still be overridden by the MCP_OAUTH_DIR env variable.
481
- *
482
- * Persistent OAuth credentials are stored in the operating system credential
483
- * store, not this directory. Existing plaintext tokens.json files found here
484
- * are imported once and removed.
485
- */
486
- oauthDir?: string;
487
- }
488
- export interface ClaudePluginConfig {
489
- /** Explicit local Claude plugin directory. File-based config resolves relative paths from the active project cwd; createMcpAdapter snapshots programmatic paths against process.cwd(). */
490
- path: string;
491
- /** Load the plugin's root .mcp.json as low-precedence MCP defaults. */
492
- mcp?: boolean;
493
- /** Expose the plugin's root skills/ directory to Pi resource discovery. */
494
- skills?: boolean;
495
- }
496
- export interface McpConfig {
497
- mcpServers: Record<string, ServerEntry>;
498
- imports?: ImportKind[];
499
- settings?: McpSettings;
500
- claudePlugins?: ClaudePluginConfig[];
501
- }
502
- export interface McpAdapterOptions {
503
- config?: McpConfig;
504
- configPath?: string;
505
- }
506
- export type ServerDefinition = ServerEntry;
507
- export interface ToolMetadata {
508
- name: string;
509
- originalName: string;
510
- description: string;
511
- resourceUri?: string;
512
- uiResourceUri?: string;
513
- uiVisibility?: UiToolVisibility[];
514
- inputSchema?: unknown;
515
- outputSchema?: unknown;
516
- uiStreamMode?: UiStreamMode;
517
- }
518
- export interface PromptMetadata {
519
- serverName: string;
520
- originalName: string;
521
- commandName: string;
522
- title?: string;
523
- description: string;
524
- arguments: McpPromptArgument[];
525
- }
526
- export interface DirectToolSpec {
527
- /** Registered inactive; `mcp({ search })` or a successful `mcp({ tool })` call activates it (directTools: "search"). */
528
- lazy?: boolean;
529
- serverName: string;
530
- originalName: string;
531
- prefixedName: string;
532
- description: string;
533
- inputSchema?: unknown;
534
- resourceUri?: string;
535
- uiResourceUri?: string;
536
- uiStreamMode?: UiStreamMode;
537
- }
538
- export interface ServerProvenance {
539
- path: string;
540
- kind: "user" | "project" | "import";
541
- importKind?: string;
542
- }
543
- export interface McpAuthResult {
544
- ok: boolean;
545
- message?: string;
546
- }
547
- export interface CachedTool {
548
- name: string;
549
- description?: string;
550
- inputSchema?: unknown;
551
- outputSchema?: unknown;
552
- uiResourceUri?: string;
553
- uiVisibility?: UiToolVisibility[];
554
- uiStreamMode?: "eager" | "stream-first";
555
- }
556
- export interface CachedResource {
557
- uri: string;
558
- name: string;
559
- description?: string;
560
- }
561
- export interface CachedPrompt {
562
- name: string;
563
- title?: string;
564
- description?: string;
565
- arguments?: {
566
- name: string;
567
- description?: string;
568
- required?: boolean;
569
- }[];
570
- }
571
- export interface ServerCacheEntry {
572
- configHash: string;
573
- tools: CachedTool[];
574
- resources: CachedResource[];
575
- prompts?: CachedPrompt[];
576
- instructions?: string;
577
- /** Server-level hints from the aggregated tools/list result. */
578
- ttlMs?: ListToolsResult["ttlMs"];
579
- cacheScope?: ListToolsResult["cacheScope"];
580
- cachedAt: number;
581
- }
582
- export interface MetadataCache {
583
- version: number;
584
- servers: Record<string, ServerCacheEntry>;
585
- }
586
- export interface McpPanelCallbacks {
587
- reconnect: (serverName: string) => Promise<boolean>;
588
- canAuthenticate: (serverName: string) => boolean;
589
- authenticate: (serverName: string) => Promise<McpAuthResult>;
590
- getConnectionStatus: (serverName: string) => "connected" | "idle" | "failed" | "needs-auth" | "disabled";
591
- getFailureMessage?: (serverName: string) => string | null;
592
- refreshCacheAfterReconnect: (serverName: string) => ServerCacheEntry | null;
593
- }
594
- export interface McpPanelResult {
595
- changes: Map<string, true | string[] | false>;
596
- /** Servers whose disabled flag changed during the panel session (name → new disabled state). */
597
- disabledChanges: Map<string, boolean>;
598
- cancelled: boolean;
599
- }
600
- export declare function getServerPrefix(serverName: string, mode: ToolPrefix): string;
601
- /**
602
- * Format a tool name with server prefix.
603
- */
604
- export declare function formatToolName(toolName: string, serverName: string, prefix: ToolPrefix): string;
605
- export declare function resolveToolPrefix(definition?: Pick<ServerEntry, "toolPrefix">, globalPrefix?: ToolPrefix): ToolPrefix;
606
- /** A canonical name has an owner only when exactly one eligible entry produces it. */
607
- export declare function resolveUniqueNameOwnership<T>(entries: readonly T[], getName: (entry: T) => string): {
608
- unique: T[];
609
- collisions: Map<string, T[]>;
610
- };
611
- /**
612
- * Resolve a configured MCP server name from a prefixed tool name.
613
- *
614
- * When the proxy tool is addressed with a fully-qualified name such as
615
- * `searxng_searxng_web_search`, downstream policy systems (for example a
616
- * permission gate) need to recover the owning server so they can evaluate
617
- * server-scoped rules against the bare server name. This performs the inverse
618
- * of {@link getServerPrefix}: it finds the longest configured server prefix
619
- * that the tool name starts with and returns that server's name.
620
- *
621
- * @param toolName - the tool name as passed to the proxy `mcp({ tool })` call.
622
- * @param serverNames - the configured MCP server names (keys of `mcpServers`).
623
- * @param prefix - the active tool-prefix mode.
624
- * @returns the resolved server name, or `undefined` when no prefix matches or
625
- * the prefix mode is `"none"`.
626
- */
627
- export declare function resolveServerFromToolName(toolName: string, serverNames: Iterable<string>, prefix: ToolPrefix): string | undefined;
628
- export declare function sanitizePromptName(name: string): string;
629
- export declare function formatPromptCommandName(promptName: string, serverName: string, prefix: ToolPrefix): string;
630
- export declare function getToolNameCandidates(toolName: string, serverName: string, prefix: ToolPrefix, includeLegacy?: boolean): Set<string>;
631
- export interface ToolSelectorCandidateIndex {
632
- readonly allCurrentCandidates: ReadonlySet<string>;
633
- readonly matchingCountByPattern: Map<string, number>;
634
- readonly matcherByPattern: Map<string, RegExp>;
635
- readonly additionalCurrentCandidatesByToolName?: ReadonlyMap<string, ReadonlySet<string>>;
636
- }
637
- export declare function createToolSelectorCandidateIndex(allCurrentCandidates: Set<string>, additionalCurrentCandidatesByToolName?: ReadonlyMap<string, ReadonlySet<string>>): ToolSelectorCandidateIndex;
638
- export declare function matchesToolPattern(candidates: Set<string>, patterns?: unknown): boolean;
639
- export type ToolSelectorCandidateContext = Set<string> | ToolSelectorCandidateIndex;
640
- export declare function isToolIncluded(toolName: string, serverName: string, prefix: ToolPrefix, includeTools?: unknown, otherCurrentCandidates?: ToolSelectorCandidateContext): boolean;
641
- export declare function isToolExcluded(toolName: string, serverName: string, prefix: ToolPrefix, excludeTools?: unknown, otherCurrentCandidates?: ToolSelectorCandidateContext): boolean;
642
- export declare function isToolAllowed(toolName: string, serverName: string, prefix: ToolPrefix, includeTools?: unknown, excludeTools?: unknown, otherCurrentCandidates?: ToolSelectorCandidateContext): boolean;