@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,369 +0,0 @@
1
- import { ProtocolError } from "@modelcontextprotocol/client";
2
- import { createApplicationInputHandler, createTaskSessionEndpointId, createTaskSessionFromClient, DispatchError, JsonRpcResponseError, resultFromTaskOutcome, TaskCancelledError, TaskFailedError, } from "@modelcontextprotocol/ext-tasks/client";
3
- import { logger } from "./logger.js";
4
- export const TASKS_EXTENSION_ID = "io.modelcontextprotocol/tasks";
5
- const RAW_REQUEST_ID_PREFIX = "pi-mcp-tasks-";
6
- const DEFAULT_RAW_REQUEST_TIMEOUT_MS = 60_000;
7
- const LATE_TASK_HANDLE_GRACE_MS = 60_000;
8
- function abortError(signal) {
9
- return signal.reason instanceof Error
10
- ? signal.reason
11
- : new DOMException("This operation was aborted", "AbortError");
12
- }
13
- function isJsonRecord(value) {
14
- return value !== null && typeof value === "object" && !Array.isArray(value);
15
- }
16
- /**
17
- * Raw JSON-RPC request channel chained onto a connected transport. Raw
18
- * requests use string ids with a reserved prefix, which cannot collide with
19
- * the SDK's numeric ids; their responses are consumed before the SDK client
20
- * sees them. All other traffic passes through unchanged.
21
- *
22
- * Attach only after Client.connect has installed its transport handlers:
23
- * attach() reads the current onmessage/onclose (through any wrapper
24
- * accessors) and chains in front of them.
25
- */
26
- export class RawRequestChannel {
27
- transport;
28
- pending = new Map();
29
- requestCounter = 0;
30
- defaultTimeoutMs;
31
- attached = false;
32
- constructor(transport, defaultTimeoutMs) {
33
- this.transport = transport;
34
- this.defaultTimeoutMs = defaultTimeoutMs ?? DEFAULT_RAW_REQUEST_TIMEOUT_MS;
35
- }
36
- attach() {
37
- if (this.attached)
38
- return;
39
- this.attached = true;
40
- const previousOnMessage = this.transport.onmessage;
41
- this.transport.onmessage = (message, extra) => {
42
- if (this.consumeRawResponse(message))
43
- return;
44
- previousOnMessage?.(message, extra);
45
- };
46
- const previousOnClose = this.transport.onclose;
47
- this.transport.onclose = () => {
48
- this.rejectAll("MCP connection closed");
49
- previousOnClose?.();
50
- };
51
- }
52
- /** Sends a raw JSON-RPC request and resolves with its correlated response. */
53
- rawDispatch = (request, options) => {
54
- if (!isJsonRecord(request) || typeof request.method !== "string") {
55
- return Promise.reject(new Error("Raw MCP request must be a JSON object with a string method"));
56
- }
57
- const params = request.params;
58
- if (params !== undefined && !isJsonRecord(params)) {
59
- return Promise.reject(new Error("Raw MCP request params must be a JSON object"));
60
- }
61
- const signal = options?.signal;
62
- if (signal?.aborted)
63
- return Promise.reject(abortError(signal));
64
- const id = `${RAW_REQUEST_ID_PREFIX}${++this.requestCounter}`;
65
- const message = {
66
- jsonrpc: "2.0",
67
- id,
68
- method: request.method,
69
- ...(params === undefined ? {} : { params }),
70
- };
71
- const timeoutMs = options?.context?.requestTimeoutMs ?? this.defaultTimeoutMs;
72
- return new Promise((resolve, reject) => {
73
- const entry = {
74
- id,
75
- resolve,
76
- reject,
77
- state: "pending",
78
- ...(signal === undefined ? {} : { signal }),
79
- ...(message.method === "tools/call" ? { observationController: new AbortController() } : {}),
80
- };
81
- entry.requestTimer = setTimeout(() => {
82
- this.terminateLocalWait(entry, new Error(`MCP task request "${message.method}" timed out after ${timeoutMs}ms`));
83
- }, timeoutMs);
84
- this.pending.set(id, entry);
85
- if (signal) {
86
- entry.onAbort = () => {
87
- this.terminateLocalWait(entry, abortError(signal));
88
- };
89
- signal.addEventListener("abort", entry.onAbort, { once: true });
90
- }
91
- const fail = (error) => {
92
- if (this.pending.get(id) !== entry)
93
- return;
94
- const wasPending = entry.state === "pending";
95
- this.finishRequest(entry, true);
96
- if (wasPending)
97
- reject(error instanceof Error ? error : new Error(String(error)));
98
- };
99
- // ext-tasks supplies the SEP-2663 Mcp-Name routing header (and any
100
- // host headers) via context.headers. A task-producing tools/call owns
101
- // its transport observation independently from the caller's wait.
102
- try {
103
- Promise.resolve(this.transport.send(message, {
104
- ...(options?.context?.headers === undefined ? {} : { headers: options.context.headers }),
105
- ...(entry.observationController !== undefined
106
- ? { requestSignal: entry.observationController.signal }
107
- : signal === undefined ? {} : { requestSignal: signal }),
108
- })).catch(fail);
109
- }
110
- catch (error) {
111
- fail(error);
112
- }
113
- });
114
- };
115
- consumeRawResponse(message) {
116
- if (!("id" in message) || typeof message.id !== "string")
117
- return false;
118
- if (!message.id.startsWith(RAW_REQUEST_ID_PREFIX))
119
- return false;
120
- // A server request may choose any string ID, including our client-side
121
- // prefix. Method-bearing frames still belong to the SDK request handler.
122
- if ("method" in message)
123
- return false;
124
- const entry = this.pending.get(message.id);
125
- if (!entry)
126
- return true; // ours, but already completed or its bounded observation expired
127
- const wasObserving = entry.state === "observing";
128
- this.finishRequest(entry, true);
129
- if (wasObserving) {
130
- this.cancelLateTask(message);
131
- return true;
132
- }
133
- if ("error" in message) {
134
- const { code, message: errorMessage, data } = message.error;
135
- entry.resolve({ kind: "error", error: { code, message: errorMessage, ...(data === undefined ? {} : { data }) } });
136
- }
137
- else if ("result" in message) {
138
- entry.resolve({ kind: "result", result: message.result });
139
- }
140
- else {
141
- entry.reject(new Error("MCP task response frame carried neither result nor error"));
142
- }
143
- return true;
144
- }
145
- terminateLocalWait(entry, error) {
146
- if (this.pending.get(entry.id) !== entry || entry.state !== "pending")
147
- return;
148
- if (entry.observationController === undefined) {
149
- this.finishRequest(entry, false);
150
- }
151
- else {
152
- entry.state = "observing";
153
- this.clearLocalWait(entry);
154
- entry.observationTimer = setTimeout(() => {
155
- this.finishRequest(entry, true);
156
- }, LATE_TASK_HANDLE_GRACE_MS);
157
- }
158
- entry.reject(error);
159
- }
160
- clearLocalWait(entry) {
161
- if (entry.requestTimer !== undefined)
162
- clearTimeout(entry.requestTimer);
163
- delete entry.requestTimer;
164
- if (entry.signal !== undefined && entry.onAbort !== undefined) {
165
- entry.signal.removeEventListener("abort", entry.onAbort);
166
- }
167
- delete entry.onAbort;
168
- }
169
- finishRequest(entry, abortObservation) {
170
- if (this.pending.get(entry.id) !== entry)
171
- return;
172
- this.clearLocalWait(entry);
173
- if (entry.observationTimer !== undefined)
174
- clearTimeout(entry.observationTimer);
175
- delete entry.observationTimer;
176
- this.pending.delete(entry.id);
177
- if (abortObservation)
178
- entry.observationController?.abort();
179
- }
180
- cancelLateTask(message) {
181
- if (!("result" in message) || !isJsonRecord(message.result))
182
- return;
183
- if (message.result.resultType !== "task" || typeof message.result.taskId !== "string")
184
- return;
185
- const taskId = message.result.taskId;
186
- void this.rawDispatch({ method: "tasks/cancel", params: { taskId } }, { context: { headers: { "Mcp-Name": taskId } } }).catch(() => { });
187
- }
188
- rejectAll(reason) {
189
- const entries = [...this.pending.values()];
190
- for (const entry of entries) {
191
- const wasPending = entry.state === "pending";
192
- this.finishRequest(entry, true);
193
- if (wasPending)
194
- entry.reject(new Error(reason));
195
- }
196
- }
197
- }
198
- /**
199
- * Whether a connected 2026-07-28 server advertises the tasks extension.
200
- * ext-tasks requires the exact empty-object declaration; anything else
201
- * downgrades the session, so mirror its check here.
202
- *
203
- * Legacy (2025-11-25) task servers are intentionally out of scope: driving
204
- * their opt-in `task` parameter requires per-tool taskSupport declarations,
205
- * which this integration does not supply.
206
- */
207
- export function serverAdvertisesTasks(client) {
208
- if (client.getProtocolEra?.() !== "modern")
209
- return false;
210
- const capabilities = client.getServerCapabilities();
211
- const extension = capabilities?.extensions?.[TASKS_EXTENSION_ID];
212
- return isJsonRecord(extension) && Object.keys(extension).length === 0;
213
- }
214
- /** Missing-handler errors carry the SDK's capability shape so call sites can classify them. */
215
- function capabilityNotSupportedError(serverName, method, inputKey) {
216
- const error = new Error(`MCP server ${serverName} requested ${method} during a task, but this session has no handler for it`);
217
- Object.assign(error, {
218
- code: "CAPABILITY_NOT_SUPPORTED",
219
- data: { key: inputKey ?? "unknown", method },
220
- });
221
- return error;
222
- }
223
- /**
224
- * Attaches an ext-tasks requester session to a connected client when the
225
- * server advertises task support. Returns undefined otherwise, leaving the
226
- * plain callTool path untouched.
227
- */
228
- export async function attachTaskSession(options) {
229
- const { client, serverName, definition } = options;
230
- if (!serverAdvertisesTasks(client))
231
- return undefined;
232
- const protocolVersion = client.getNegotiatedProtocolVersion?.();
233
- if (protocolVersion === undefined)
234
- return undefined;
235
- const endpointId = await createTaskSessionEndpointId("pi-mcp-adapter", {
236
- server: serverName,
237
- ...(definition.command !== undefined
238
- ? { transport: { type: "stdio", command: definition.command, args: definition.args ?? [] } }
239
- : definition.url !== undefined
240
- ? { transport: { type: "http", url: definition.url } }
241
- : { transport: { type: "unix-socket", socket: definition.socket ?? null } }),
242
- });
243
- const onInputRequest = createApplicationInputHandler({
244
- elicitation: async (request, context) => {
245
- if (options.onElicitation === undefined) {
246
- throw capabilityNotSupportedError(serverName, "elicitation/create", context.inputId);
247
- }
248
- const result = await options.onElicitation({ method: "elicitation/create", params: request.params }, context.signal);
249
- return {
250
- action: result.action,
251
- ...(result.content === undefined
252
- ? {}
253
- : { content: result.content }),
254
- };
255
- },
256
- sampling: async (request, context) => {
257
- if (options.onSampling === undefined) {
258
- throw capabilityNotSupportedError(serverName, "sampling/createMessage", context.inputId);
259
- }
260
- const result = await options.onSampling({ method: "sampling/createMessage", params: request.params }, context.signal);
261
- return {
262
- model: result.model,
263
- role: result.role,
264
- content: result.content,
265
- };
266
- },
267
- roots: async () => ({ roots: [] }),
268
- });
269
- const channel = new RawRequestChannel(options.transport, options.requestTimeoutMs);
270
- channel.attach();
271
- const session = createTaskSessionFromClient(client, {
272
- endpointId,
273
- rawDispatch: channel.rawDispatch,
274
- v2RequestFraming: {
275
- protocolVersion,
276
- clientInfo: options.clientInfo,
277
- clientCapabilities: options.clientCapabilities,
278
- },
279
- // Tool declarations only add per-tool taskSupport hints; the adapter's
280
- // cached tools/list is not threaded through here, and a miss is harmless.
281
- tools: { currentTool: () => undefined },
282
- onInputRequest,
283
- onError: (error) => logger.warn(`ext-tasks background error for ${serverName}: ${String(error)}`),
284
- });
285
- // A downgraded session (server capability mismatch) would silently route
286
- // plain tool calls through the generic request path, skipping callTool's
287
- // output-schema validation. Refuse it and keep the plain path instead.
288
- if (!session.capabilities.execution) {
289
- await session.close().catch(() => { });
290
- channel.rejectAll("Task session downgraded");
291
- return undefined;
292
- }
293
- return { session, channel };
294
- }
295
- /**
296
- * Preserves error-shape parity with Client.callTool: JSON-RPC failures —
297
- * immediate (JsonRpcResponseError) or terminal task errors (TaskFailedError
298
- * with a code) — become the typed ProtocolError subclass for their code, so
299
- * call-site handling (session recovery, URL elicitation) keeps working.
300
- * Local failures rethrow their original cause instead of being relabeled.
301
- */
302
- function toCallToolError(error, signal) {
303
- if (error instanceof TaskCancelledError && signal?.aborted === true) {
304
- return abortError(signal);
305
- }
306
- if (error instanceof JsonRpcResponseError) {
307
- return ProtocolError.fromError(error.code, error.message, error.data);
308
- }
309
- if (error instanceof TaskFailedError && error.code !== undefined) {
310
- return ProtocolError.fromError(error.code, error.message, error.data);
311
- }
312
- if (error instanceof DispatchError) {
313
- return error.cause ?? error;
314
- }
315
- return error;
316
- }
317
- /**
318
- * Calls a tool through a task session and blocks until settlement, preserving
319
- * the plain callTool contract: an immediate result returns as-is, a
320
- * task-backed execution is polled to completion, a failed task throws the
321
- * underlying JSON-RPC error, and aborting cancels the remote task.
322
- */
323
- export async function callToolViaTaskSession(session, options) {
324
- const { signal } = options;
325
- let execution;
326
- try {
327
- execution = await session.callTool(options.name, options.args, {
328
- ...(options.meta === undefined ? {} : { metadata: options.meta }),
329
- ...(signal === undefined ? {} : { signal }),
330
- ...(options.requestTimeoutMs === undefined ? {} : { requestTimeoutMs: options.requestTimeoutMs }),
331
- });
332
- }
333
- catch (error) {
334
- throw toCallToolError(error, signal);
335
- }
336
- let onAbort;
337
- if (signal !== undefined && execution.kind === "task") {
338
- // settle({ signal }) only stops waiting locally; propagate the abort as a
339
- // cooperative remote cancellation so the server can stop the work. The
340
- // signal may have aborted while callTool was resolving, so fire directly
341
- // for an abort the listener would miss.
342
- onAbort = () => {
343
- void execution.cancel().catch(() => { });
344
- };
345
- if (signal.aborted)
346
- onAbort();
347
- else
348
- signal.addEventListener("abort", onAbort, { once: true });
349
- }
350
- try {
351
- const settlement = await execution.settle(signal === undefined ? {} : { signal });
352
- const result = resultFromTaskOutcome(settlement.outcome);
353
- if (!isJsonRecord(result)) {
354
- throw new Error(`Task-backed tool ${options.name} settled with a non-object result`);
355
- }
356
- // Match Client.callTool's lifted shape, which strips the wire-only discriminator.
357
- const { resultType: _resultType, ...lifted } = result;
358
- return lifted;
359
- }
360
- catch (error) {
361
- throw toCallToolError(error, signal);
362
- }
363
- finally {
364
- if (signal !== undefined && onAbort !== undefined)
365
- signal.removeEventListener("abort", onAbort);
366
- await execution.close().catch(() => { });
367
- }
368
- }
369
- //# sourceMappingURL=mcp-tasks.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"mcp-tasks.js","sourceRoot":"","sources":["../mcp-tasks.ts"],"names":[],"mappings":"AAiCA,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAC7D,OAAO,EACL,6BAA6B,EAC7B,2BAA2B,EAC3B,2BAA2B,EAC3B,aAAa,EACb,oBAAoB,EACpB,qBAAqB,EACrB,kBAAkB,EAClB,eAAe,GAIhB,MAAM,wCAAwC,CAAC;AAEhD,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAErC,MAAM,CAAC,MAAM,kBAAkB,GAAG,+BAA+B,CAAC;AAElE,MAAM,qBAAqB,GAAG,eAAe,CAAC;AAE9C,MAAM,8BAA8B,GAAG,MAAM,CAAC;AAC9C,MAAM,yBAAyB,GAAG,MAAM,CAAC;AAmBzC,SAAS,UAAU,CAAC,MAAmB;IACrC,OAAO,MAAM,CAAC,MAAM,YAAY,KAAK;QACnC,CAAC,CAAC,MAAM,CAAC,MAAM;QACf,CAAC,CAAC,IAAI,YAAY,CAAC,4BAA4B,EAAE,YAAY,CAAC,CAAC;AACnE,CAAC;AAED,SAAS,YAAY,CAAC,KAAc;IAClC,OAAO,KAAK,KAAK,IAAI,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AAC9E,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,OAAO,iBAAiB;IACX,SAAS,CAAY;IACrB,OAAO,GAAG,IAAI,GAAG,EAA6B,CAAC;IACxD,cAAc,GAAG,CAAC,CAAC;IACV,gBAAgB,CAAS;IAClC,QAAQ,GAAG,KAAK,CAAC;IAEzB,YAAY,SAAoB,EAAE,gBAAyB;QACzD,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AAE,CAAC,CAAC;IACjE,CAAC;IACD,IAAI,CAAC;QACH,MAAM,UAAU,GAAG,MAAM,SAAS,CAAC,MAAM,CAAC,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC;QAClF,MAAM,MAAM,GAAG,qBAAqB,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;QACzD,IAAI,CAAC,YAAY,CAAC,MAAM,CAAC,EAAE,CAAC;YAC1B,MAAM,IAAI,KAAK,CAAC,oBAAoB,OAAO,CAAC,IAAI,mCAAmC,CAAC,CAAC;QACvF,CAAC;QACD,kFAAkF;QAClF,MAAM,EAAE,UAAU,EAAE,WAAW,EAAE,GAAG,MAAM,EAAE,GAAG,MAAM,CAAC;QACtD,OAAO,MAAM,CAAC;IAChB,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,eAAe,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;IACvC,CAAC;YAAS,CAAC;QACT,IAAI,MAAM,KAAK,SAAS,IAAI,OAAO,KAAK,SAAS;YAAE,MAAM,CAAC,mBAAmB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QAChG,MAAM,SAAS,CAAC,KAAK,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC,CAAC;IAC1C,CAAC;AACH,CAAC"}
@@ -1,95 +0,0 @@
1
- import type { Transport } from "@modelcontextprotocol/client";
2
- import type { JSONRPCMessage } from "@modelcontextprotocol/client";
3
- export declare const MCP_TRACE_SCHEMA_VERSION = 1;
4
- export declare const DEFAULT_MCP_TRACE_MAX_BYTES: number;
5
- export declare const DEFAULT_MCP_TRACE_MAX_EVENTS = 10000;
6
- export type McpTraceDirection = "outbound" | "inbound";
7
- export type McpTraceTransport = "stdio" | "unix-socket" | "sse" | "streamable-http" | "unknown";
8
- export type McpTraceMessageKind = "request" | "response" | "notification";
9
- export interface McpTraceSettings {
10
- /** Enable metadata-only protocol tracing for all servers unless overridden. */
11
- enabled?: boolean;
12
- /** JSONL destination. Relative paths are resolved from the session cwd. */
13
- file?: string;
14
- /** Maximum bytes retained in the per-session JSONL file. */
15
- maxBytes?: number;
16
- /** Maximum events retained in the per-session JSONL file. */
17
- maxEvents?: number;
18
- }
19
- export interface McpTraceEvent {
20
- version: typeof MCP_TRACE_SCHEMA_VERSION;
21
- timestamp: string;
22
- direction: McpTraceDirection;
23
- server: string;
24
- transport: McpTraceTransport;
25
- kind: McpTraceMessageKind;
26
- status: "sent" | "received" | "error";
27
- method?: string;
28
- id?: string | number | null;
29
- relatedRequestId?: string | number;
30
- errorCode?: number | string;
31
- bytes?: number;
32
- durationMs?: number;
33
- }
34
- export interface McpTraceWriterOptions {
35
- filePath: string;
36
- maxBytes?: number;
37
- maxEvents?: number;
38
- appendFile?: (path: string, data: string, options: {
39
- encoding: "utf8";
40
- }) => Promise<void>;
41
- writeFile?: (path: string, data: string, options: {
42
- encoding: "utf8";
43
- }) => Promise<void>;
44
- mkdir?: (path: string, options: {
45
- recursive: true;
46
- }) => Promise<string | undefined>;
47
- }
48
- /** Redact strings before they can become durable trace metadata. */
49
- export declare function redactTraceText(value: string, maxLength?: number): string;
50
- export declare function createMcpTraceEvent(direction: McpTraceDirection, server: string, transport: McpTraceTransport, message: JSONRPCMessage, status: "sent" | "received" | "error", options?: {
51
- relatedRequestId?: unknown;
52
- durationMs?: number;
53
- }): McpTraceEvent;
54
- export declare class McpTraceWriter {
55
- private readonly options;
56
- private readonly maxBytes;
57
- private readonly maxEvents;
58
- private readonly append;
59
- private readonly resetFile;
60
- private readonly makeDirectory;
61
- private bytesWritten;
62
- private eventsWritten;
63
- private queue;
64
- private disabled;
65
- private initializationFailed;
66
- private readonly fileReady;
67
- constructor(options: McpTraceWriterOptions);
68
- get filePath(): string;
69
- get isDisabled(): boolean;
70
- get stats(): {
71
- bytes: number;
72
- events: number;
73
- };
74
- write(event: McpTraceEvent): void;
75
- flush(): Promise<void>;
76
- }
77
- export declare function createMcpTraceWriter(sessionCwd: string | undefined, settings?: McpTraceSettings, randomSuffix?: string): McpTraceWriter;
78
- export interface McpTraceObserver {
79
- record(event: McpTraceEvent): void;
80
- }
81
- export declare function isMcpTraceEnabled(definition: {
82
- trace?: boolean;
83
- }, settings?: McpTraceSettings): boolean;
84
- /**
85
- * Compose the SDK's transport callbacks in place instead of replacing the
86
- * transport object. SDK v2 detects its base stdio transport before connect so
87
- * it can run `server/discover` on a disposable sibling process; returning a
88
- * wrapper hides that identity and makes tracing change negotiation behavior.
89
- */
90
- export declare function wrapTransportWithMcpTrace(transport: Transport, server: string, transportKind: McpTraceTransport, observer: McpTraceObserver): Transport;
91
- export declare function traceTransportKind(definition: {
92
- command?: string;
93
- url?: string;
94
- socket?: string;
95
- }, transport: Transport): McpTraceTransport;