@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,364 +0,0 @@
1
- /**
2
- * Custom error types for MCP UI operations.
3
- * Provides structured errors with context and recovery hints.
4
- */
5
-
6
- export interface McpUiErrorContext {
7
- server?: string;
8
- tool?: string;
9
- uri?: string;
10
- session?: string;
11
- [key: string]: unknown;
12
- }
13
-
14
- /**
15
- * Base error class for MCP UI errors.
16
- */
17
- export class McpUiError extends Error {
18
- readonly code: string;
19
- readonly context: McpUiErrorContext;
20
- readonly recoveryHint: string | undefined;
21
- readonly cause: Error | undefined;
22
-
23
- constructor(
24
- message: string,
25
- options: {
26
- code: string;
27
- context?: McpUiErrorContext;
28
- recoveryHint?: string;
29
- cause?: Error;
30
- }
31
- ) {
32
- super(message);
33
- this.name = "McpUiError";
34
- this.code = options.code;
35
- this.context = options.context ?? {};
36
- this.recoveryHint = options.recoveryHint;
37
- this.cause = options.cause;
38
-
39
- // Maintain proper stack trace
40
- if (Error.captureStackTrace) {
41
- Error.captureStackTrace(this, this.constructor);
42
- }
43
- }
44
-
45
- toJSON(): Record<string, unknown> {
46
- return {
47
- name: this.name,
48
- code: this.code,
49
- message: this.message,
50
- context: this.context,
51
- recoveryHint: this.recoveryHint,
52
- stack: this.stack,
53
- };
54
- }
55
- }
56
-
57
- /**
58
- * Error fetching a UI resource from the MCP server.
59
- */
60
- export class ResourceFetchError extends McpUiError {
61
- constructor(
62
- uri: string,
63
- reason: string,
64
- options?: { server?: string; cause?: Error }
65
- ) {
66
- super(`Failed to fetch UI resource "${uri}": ${reason}`, {
67
- code: "RESOURCE_FETCH_ERROR",
68
- context: { uri, ...(options?.server !== undefined ? { server: options.server } : {}) },
69
- recoveryHint: "Check that the MCP server is connected and the resource URI is valid.",
70
- ...(options?.cause !== undefined ? { cause: options.cause } : {}),
71
- });
72
- this.name = "ResourceFetchError";
73
- }
74
- }
75
-
76
- /**
77
- * Error parsing or validating UI resource content.
78
- */
79
- export class ResourceParseError extends McpUiError {
80
- constructor(
81
- uri: string,
82
- reason: string,
83
- options?: { server?: string; mimeType?: string }
84
- ) {
85
- super(`Invalid UI resource "${uri}": ${reason}`, {
86
- code: "RESOURCE_PARSE_ERROR",
87
- context: {
88
- uri,
89
- ...(options?.server !== undefined ? { server: options.server } : {}),
90
- ...(options?.mimeType !== undefined ? { mimeType: options.mimeType } : {}),
91
- },
92
- recoveryHint: "Ensure the resource returns valid HTML with the correct MIME type.",
93
- });
94
- this.name = "ResourceParseError";
95
- }
96
- }
97
-
98
- /**
99
- * Error connecting to the AppBridge.
100
- */
101
- export class BridgeConnectionError extends McpUiError {
102
- constructor(reason: string, options?: { session?: string; cause?: Error }) {
103
- super(`AppBridge connection failed: ${reason}`, {
104
- code: "BRIDGE_CONNECTION_ERROR",
105
- context: options?.session !== undefined ? { session: options.session } : {},
106
- recoveryHint: "Check browser console for detailed errors. The iframe may have failed to load.",
107
- ...(options?.cause !== undefined ? { cause: options.cause } : {}),
108
- });
109
- this.name = "BridgeConnectionError";
110
- }
111
- }
112
-
113
- /**
114
- * Error related to user consent for tool calls.
115
- */
116
- export class ConsentError extends McpUiError {
117
- readonly denied: boolean;
118
-
119
- constructor(
120
- server: string,
121
- options: { denied?: boolean; requiresApproval?: boolean }
122
- ) {
123
- const message = options.denied
124
- ? `Tool calls for "${server}" were denied for this session`
125
- : `Tool call approval required for "${server}"`;
126
-
127
- super(message, {
128
- code: options.denied ? "CONSENT_DENIED" : "CONSENT_REQUIRED",
129
- context: { server },
130
- recoveryHint: options.denied
131
- ? "The user denied tool access. Start a new session to try again."
132
- : "Prompt the user for consent before calling tools.",
133
- });
134
- this.name = "ConsentError";
135
- this.denied = options.denied ?? false;
136
- }
137
- }
138
-
139
- /**
140
- * Error with UI server session management.
141
- */
142
- export class SessionError extends McpUiError {
143
- constructor(
144
- reason: string,
145
- options?: { session?: string; cause?: Error }
146
- ) {
147
- super(`Session error: ${reason}`, {
148
- code: "SESSION_ERROR",
149
- context: options?.session !== undefined ? { session: options.session } : {},
150
- recoveryHint: "The session may have expired or been closed. Try opening the UI again.",
151
- ...(options?.cause !== undefined ? { cause: options.cause } : {}),
152
- });
153
- this.name = "SessionError";
154
- }
155
- }
156
-
157
- /**
158
- * Error starting or operating the UI server.
159
- */
160
- export class ServerError extends McpUiError {
161
- constructor(
162
- reason: string,
163
- options?: { port?: number; cause?: Error }
164
- ) {
165
- super(`UI server error: ${reason}`, {
166
- code: "SERVER_ERROR",
167
- context: options?.port !== undefined ? { port: options.port } : {},
168
- recoveryHint: "Check if the port is available. Another process may be using it.",
169
- ...(options?.cause !== undefined ? { cause: options.cause } : {}),
170
- });
171
- this.name = "ServerError";
172
- }
173
- }
174
-
175
- /**
176
- * Error communicating with the MCP server.
177
- */
178
- export class McpServerError extends McpUiError {
179
- constructor(
180
- server: string,
181
- reason: string,
182
- options?: { tool?: string; cause?: Error }
183
- ) {
184
- super(`MCP server "${server}" error: ${reason}`, {
185
- code: "MCP_SERVER_ERROR",
186
- context: { server, ...(options?.tool !== undefined ? { tool: options.tool } : {}) },
187
- recoveryHint: "Check that the MCP server is running and responsive.",
188
- ...(options?.cause !== undefined ? { cause: options.cause } : {}),
189
- });
190
- this.name = "McpServerError";
191
- }
192
- }
193
-
194
- /**
195
- * Wrap an unknown error into an McpUiError.
196
- */
197
- export function wrapError(error: unknown, context?: McpUiErrorContext): McpUiError {
198
- if (error instanceof McpUiError) {
199
- // Merge contexts
200
- return new McpUiError(error.message, {
201
- code: error.code,
202
- context: { ...error.context, ...context },
203
- ...(error.recoveryHint !== undefined ? { recoveryHint: error.recoveryHint } : {}),
204
- ...(error.cause !== undefined ? { cause: error.cause } : {}),
205
- });
206
- }
207
-
208
- const cause = error instanceof Error ? error : undefined;
209
- const message = error instanceof Error ? error.message : String(error);
210
-
211
- return new McpUiError(message, {
212
- code: "UNKNOWN_ERROR",
213
- ...(context !== undefined ? { context } : {}),
214
- ...(cause !== undefined ? { cause } : {}),
215
- });
216
- }
217
-
218
- /**
219
- * Check if an error is a specific MCP UI error type.
220
- */
221
- export function isErrorCode(error: unknown, code: string): boolean {
222
- return error instanceof McpUiError && error.code === code;
223
- }
224
-
225
- /**
226
- * Stable adapter error code for an SDK-native input_required result that the
227
- * current client cannot fulfil because its embedded-request handler is not
228
- * registered. The SDK keeps the request key/method in `SdkError.data`; this
229
- * adapter detail intentionally copies only bounded, actionable fields.
230
- */
231
- export const INPUT_REQUIRED_NEEDS_UI = "input_required_needs_ui" as const;
232
-
233
- export interface InputRequiredNeedsUiDetails {
234
- error: typeof INPUT_REQUIRED_NEEDS_UI;
235
- server: string;
236
- tool?: string;
237
- resourceUri?: string;
238
- inputKey: string;
239
- inputMethod: string;
240
- message: string;
241
- }
242
-
243
- export interface InputRequiredIdentity {
244
- server: string;
245
- tool?: string;
246
- resourceUri?: string;
247
- }
248
-
249
- const INPUT_REQUIRED_METHODS = new Set([
250
- "elicitation/create",
251
- "sampling/createMessage",
252
- ]);
253
- const MAX_INPUT_REQUIRED_SERVER_LENGTH = 96;
254
- const MAX_INPUT_REQUIRED_TARGET_LENGTH = 160;
255
- const MAX_INPUT_REQUIRED_DETAIL_LENGTH = 128;
256
-
257
- function asRecord(value: unknown): Record<string, unknown> | undefined {
258
- return value !== null && typeof value === "object" && !Array.isArray(value)
259
- ? value as Record<string, unknown>
260
- : undefined;
261
- }
262
-
263
- function boundedText(value: unknown, maxLength: number): string | undefined {
264
- if (typeof value !== "string" || value.length === 0) return undefined;
265
- return value.length <= maxLength ? value : `${value.slice(0, maxLength - 1)}…`;
266
- }
267
-
268
- interface EmbeddedInputRequest {
269
- inputKey: string;
270
- inputMethod: string;
271
- server?: string;
272
- tool?: string;
273
- resourceUri?: string;
274
- }
275
-
276
- function findEmbeddedInputRequest(error: unknown): EmbeddedInputRequest | undefined {
277
- let current: unknown = error;
278
- const seen = new Set<unknown>();
279
- for (let depth = 0; depth < 8 && current !== undefined && current !== null; depth++) {
280
- if (seen.has(current)) return undefined;
281
- seen.add(current);
282
- const record = asRecord(current);
283
- if (!record) return undefined;
284
-
285
- if (record.code === INPUT_REQUIRED_NEEDS_UI) {
286
- const details = asRecord(record.details);
287
- const inputKey = boundedText(details?.inputKey, MAX_INPUT_REQUIRED_DETAIL_LENGTH);
288
- const inputMethod = boundedText(details?.inputMethod, MAX_INPUT_REQUIRED_DETAIL_LENGTH);
289
- if (inputKey && inputMethod && INPUT_REQUIRED_METHODS.has(inputMethod)) {
290
- const server = boundedText(details?.server, MAX_INPUT_REQUIRED_SERVER_LENGTH);
291
- const tool = boundedText(details?.tool, MAX_INPUT_REQUIRED_TARGET_LENGTH);
292
- const resourceUri = boundedText(details?.resourceUri, MAX_INPUT_REQUIRED_TARGET_LENGTH);
293
- return {
294
- inputKey,
295
- inputMethod,
296
- ...(server ? { server } : {}),
297
- ...(tool ? { tool } : {}),
298
- ...(resourceUri ? { resourceUri } : {}),
299
- };
300
- }
301
- }
302
-
303
- if (record.code === "CAPABILITY_NOT_SUPPORTED") {
304
- const data = asRecord(record.data);
305
- const inputKey = boundedText(data?.key, MAX_INPUT_REQUIRED_DETAIL_LENGTH);
306
- const inputMethod = boundedText(data?.method, MAX_INPUT_REQUIRED_DETAIL_LENGTH);
307
- if (inputKey && inputMethod && INPUT_REQUIRED_METHODS.has(inputMethod)) {
308
- return { inputKey, inputMethod };
309
- }
310
- }
311
-
312
- current = record.cause;
313
- }
314
- return undefined;
315
- }
316
-
317
- /**
318
- * Convert a missing embedded-input handler into an adapter-owned result
319
- * detail. Matching requires the SDK's typed code/data shape (or this module's
320
- * typed wrapper), rather than arbitrary error-message text.
321
- */
322
- export function getInputRequiredNeedsUiDetails(
323
- error: unknown,
324
- identity: InputRequiredIdentity,
325
- ): InputRequiredNeedsUiDetails | undefined {
326
- const request = findEmbeddedInputRequest(error);
327
- if (!request) return undefined;
328
-
329
- const server = boundedText(request.server ?? identity.server, MAX_INPUT_REQUIRED_SERVER_LENGTH) ?? "unknown";
330
- const tool = boundedText(request.tool ?? identity.tool, MAX_INPUT_REQUIRED_TARGET_LENGTH);
331
- const resourceUri = boundedText(request.resourceUri ?? identity.resourceUri, MAX_INPUT_REQUIRED_TARGET_LENGTH);
332
- const target = resourceUri
333
- ? `read resource "${resourceUri}"`
334
- : tool
335
- ? `call tool "${tool}"`
336
- : "complete the MCP request";
337
- const guidance = request.inputMethod === "elicitation/create"
338
- ? "Run this call in an interactive Pi session with elicitation enabled, then retry."
339
- : "Run this call in an interactive Pi session with the required MCP capability enabled, then retry.";
340
- const message = `MCP server "${server}" requested input to ${target}, but this session has no handler for "${request.inputMethod}" (input "${request.inputKey}"). ${guidance}`;
341
-
342
- return {
343
- error: INPUT_REQUIRED_NEEDS_UI,
344
- server,
345
- ...(tool ? { tool } : {}),
346
- ...(resourceUri ? { resourceUri } : {}),
347
- inputKey: request.inputKey,
348
- inputMethod: request.inputMethod,
349
- message,
350
- };
351
- }
352
-
353
- /** Error form used by UiResourceHandler so an outer tool call can preserve the classification. */
354
- export class InputRequiredNeedsUiError extends McpUiError {
355
- constructor(readonly details: InputRequiredNeedsUiDetails, cause?: Error) {
356
- super(details.message, {
357
- code: INPUT_REQUIRED_NEEDS_UI,
358
- context: { ...details },
359
- recoveryHint: "Run this call in an interactive Pi session with the required MCP input handler enabled, then retry.",
360
- ...(cause ? { cause } : {}),
361
- });
362
- this.name = "InputRequiredNeedsUiError";
363
- }
364
- }
@@ -1,85 +0,0 @@
1
- const SAFE_OPERATIONS = new Set(["focus", "scroll"]);
2
-
3
- export async function runAccessibilityLoop(tools, jev, options) {
4
- const { observePath, actionPath, goal, allowedOperations, sources, maxSteps, maxMs, maxEvaluations } = options;
5
- if (typeof observePath !== "string" || !observePath || typeof actionPath !== "string" || !actionPath || typeof goal !== "string" || !goal
6
- || !Array.isArray(allowedOperations) || allowedOperations.length === 0 || allowedOperations.some(operation => !SAFE_OPERATIONS.has(operation))) {
7
- throw new Error("Exact tool paths, a goal, and non-destructive focus/scroll operations are required");
8
- }
9
- if (![maxSteps, maxMs, maxEvaluations].every(value => Number.isInteger(value) && value > 0)) {
10
- throw new Error("Positive step, time, and evaluation budgets are required");
11
- }
12
- if (!Array.isArray(sources) || sources.length === 0 || sources.some(source => typeof source !== "string" || !source)) {
13
- throw new Error("Explicit MCP sources are required for accessibility data");
14
- }
15
- const startedAt = Date.now();
16
- let evaluations = 0;
17
- let previousFingerprint;
18
-
19
- const observe = async () => {
20
- const result = await tools.call(observePath, {});
21
- if (!result.ok) return { error: "observation-failed" };
22
- const tree = result.data?.structuredContent;
23
- if (!tree || typeof tree.observationId !== "string" || !tree.observationId || !Array.isArray(tree.nodes)) {
24
- return { error: "needs-information" };
25
- }
26
- return { tree };
27
- };
28
-
29
- for (let step = 0; step < maxSteps; step += 1) {
30
- if (Date.now() - startedAt >= maxMs) return { status: "stop", reason: "time-budget" };
31
- const snapshot = await observe();
32
- if (snapshot.error) return { status: snapshot.error === "needs-information" ? "needs-information" : "stop", reason: snapshot.error };
33
- const fingerprint = JSON.stringify(snapshot.tree.nodes);
34
- if (fingerprint === previousFingerprint) return { status: "stop", reason: "no-progress" };
35
- previousFingerprint = fingerprint;
36
-
37
- const actions = snapshot.tree.nodes.flatMap(node =>
38
- (node && typeof node.id === "string" && node.id && Array.isArray(node.actions) ? node.actions : [])
39
- .filter(operation => typeof operation === "string" && allowedOperations.includes(operation))
40
- .map(operation => ({ target: node.id, operation })),
41
- ).slice(0, 120).map((action, index) => ({ ...action, label: `a${index}` }));
42
- if (actions.length === 0) return { status: "no-match" };
43
- if (evaluations >= maxEvaluations) return { status: "stop", reason: "evaluation-budget" };
44
- evaluations += 1;
45
- const evaluation = await jev.evaluate({
46
- state: { goal, observationId: snapshot.tree.observationId, nodes: snapshot.tree.nodes },
47
- sources,
48
- questions: {
49
- next: {
50
- type: "choice",
51
- instructions: "Choose complete only when the observation proves the goal. Otherwise choose one safe action, none, or needsInformation.",
52
- criteria: Object.fromEntries([
53
- ...actions.map(action => [action.label, { target: action.target, operation: action.operation }]),
54
- ["complete", "Goal is observably complete"],
55
- ["none", "No matching safe action"],
56
- ["needsInformation", "User information is required"],
57
- ]),
58
- },
59
- },
60
- });
61
- if (!evaluation.ok) return { status: "stop", reason: evaluation.error.code };
62
- const answer = evaluation.data.answers.next;
63
- if (answer.type !== "choice" || answer.confidence < 0.85) return { status: "stop", reason: "uncertain" };
64
- if (answer.choice === "complete") return { status: "complete", observationId: snapshot.tree.observationId };
65
- if (answer.choice === "none") return { status: "no-match" };
66
- if (answer.choice === "needsInformation") return { status: "needs-information" };
67
- const selected = actions.find(action => action.label === answer.choice);
68
- if (!selected) return { status: "stop", reason: "invalid-action" };
69
-
70
- if (Date.now() - startedAt >= maxMs) return { status: "stop", reason: "time-budget" };
71
- const fresh = await observe();
72
- if (fresh.error || fresh.tree.observationId === snapshot.tree.observationId) return { status: "stop", reason: "stale-candidate" };
73
- const target = fresh.tree.nodes.find(node => node.id === selected.target);
74
- if (!target || !Array.isArray(target.actions) || !target.actions.includes(selected.operation)) {
75
- return { status: "stop", reason: "stale-candidate" };
76
- }
77
- const acted = await tools.call(actionPath, {
78
- operation: selected.operation,
79
- target: selected.target,
80
- observationId: fresh.tree.observationId,
81
- });
82
- if (!acted.ok) return { status: "stop", reason: "action-failed-or-uncertain" };
83
- }
84
- return { status: "stop", reason: "step-budget" };
85
- }
@@ -1,34 +0,0 @@
1
- export async function filterIssuesForTriage(tools, jev) {
2
- const found = await tools.search({
3
- query: "list open customer issue reports",
4
- server: "github",
5
- searchMode: "semantic",
6
- limit: 5,
7
- });
8
- const tool = found.items?.[0];
9
- if (!tool) return { status: "no-match" };
10
-
11
- const listed = await tools.call(tool.path, { state: "open", limit: 20 });
12
- if (!listed.ok) return { status: "stop", error: listed.error };
13
- const issues = listed.data?.structuredContent?.issues;
14
- if (!Array.isArray(issues) || issues.length === 0) return { status: "no-match" };
15
-
16
- const candidates = issues.slice(0, 20).map((issue, index) => ({
17
- id: `issue${index}`,
18
- title: String(issue.title ?? ""),
19
- body: String(issue.body ?? "").slice(0, 2000),
20
- }));
21
- const questions = Object.fromEntries(candidates.flatMap(issue => [
22
- [`relevant_${issue.id}`, { type: "noul", instructions: "Is this issue actionable and relevant?", criteria: { true: "Relevant", false: "Not relevant" } }],
23
- [`regression_${issue.id}`, { type: "noul", instructions: "Does this issue contain evidence of a regression?", criteria: { true: "Regression", false: "No regression evidence" } }],
24
- ]));
25
- const evaluation = await jev.evaluate({ state: { candidates }, questions, sources: ["github"] });
26
- if (!evaluation.ok) return { status: "stop", error: evaluation.error };
27
-
28
- const useful = candidates.filter(issue => {
29
- const relevant = evaluation.data.answers[`relevant_${issue.id}`];
30
- const regression = evaluation.data.answers[`regression_${issue.id}`];
31
- return relevant?.type === "noul" && regression?.type === "noul" && relevant.noul >= 0.8 && regression.noul >= 0.7;
32
- });
33
- return useful.length > 0 ? { status: "matched", issues: useful } : { status: "no-match" };
34
- }
@@ -1,23 +0,0 @@
1
- import type { McpExtensionState } from "./state.ts";
2
-
3
- export const FAILURE_BACKOFF_MS = 60 * 1000;
4
-
5
- export function getFailureAgeSeconds(state: McpExtensionState, serverName: string): number | null {
6
- const failedAt = state.failureTracker.get(serverName);
7
- if (!failedAt) return null;
8
- const ageMs = Date.now() - failedAt;
9
- if (ageMs > FAILURE_BACKOFF_MS) return null;
10
- return Math.round(ageMs / 1000);
11
- }
12
-
13
- export function getFailureMessage(state: McpExtensionState, serverName: string): string | null {
14
- if (getFailureAgeSeconds(state, serverName) === null) return null;
15
- return state.failureMessages?.get(serverName) ?? null;
16
- }
17
-
18
- export function isServerInActiveFailureBackoff(state: McpExtensionState, serverName: string): boolean {
19
- const connection = state.manager.getConnection(serverName);
20
- return connection?.status !== "connected"
21
- && connection?.status !== "needs-auth"
22
- && getFailureAgeSeconds(state, serverName) !== null;
23
- }
@@ -1,80 +0,0 @@
1
- import { existsSync } from "node:fs";
2
- import { execFileSync } from "node:child_process";
3
- import { join, dirname } from "node:path";
4
- import { platform } from "node:os";
5
- import { createRequire } from "node:module";
6
-
7
- let glimpseAvailable: boolean | null = null;
8
- let resolvedBinaryPath: string | null = null;
9
-
10
- export function isGlimpseAvailable(): boolean {
11
- if (glimpseAvailable !== null) return glimpseAvailable;
12
-
13
- if (platform() !== "darwin") {
14
- glimpseAvailable = false;
15
- return false;
16
- }
17
-
18
- resolvedBinaryPath = getGlimpseBinaryPath();
19
- glimpseAvailable = resolvedBinaryPath !== null;
20
- return glimpseAvailable;
21
- }
22
-
23
- function getGlimpseBinaryPath(): string | null {
24
- if (process.env.GLIMPSE_BINARY && existsSync(process.env.GLIMPSE_BINARY)) {
25
- return process.env.GLIMPSE_BINARY;
26
- }
27
-
28
- // Local node_modules
29
- try {
30
- const require = createRequire(import.meta.url);
31
- const glimpseuiPath = require.resolve("glimpseui");
32
- const binaryPath = join(dirname(glimpseuiPath), "glimpse");
33
- if (existsSync(binaryPath)) return binaryPath;
34
- } catch {}
35
-
36
- // Global npm install
37
- try {
38
- const globalRoot = execFileSync("npm", ["root", "-g"], { encoding: "utf-8" }).trim();
39
- const binaryPath = join(globalRoot, "glimpseui", "src", "glimpse");
40
- if (existsSync(binaryPath)) return binaryPath;
41
- } catch {}
42
-
43
- return null;
44
- }
45
-
46
- export async function openGlimpseWindow(
47
- html: string,
48
- options: {
49
- title: string;
50
- width?: number;
51
- height?: number;
52
- onClosed: () => void;
53
- },
54
- ) {
55
- const modulePath = resolvedBinaryPath
56
- ? join(dirname(resolvedBinaryPath), "glimpse.mjs")
57
- : "glimpseui";
58
- const glimpse = await import(modulePath);
59
-
60
- let active = true;
61
- const win = glimpse.open(html, {
62
- width: options.width ?? 900,
63
- height: options.height ?? 700,
64
- title: options.title,
65
- });
66
-
67
- win.on("closed", () => {
68
- if (!active) return;
69
- active = false;
70
- options.onClosed();
71
- });
72
-
73
- return {
74
- close: () => {
75
- if (!active) return;
76
- active = false;
77
- win.close();
78
- },
79
- };
80
- }