@herbertgao/pi-extensions 2026.9.17 → 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 (266) 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/@juicesharp/rpiv-ask-user-question/package.json +99 -99
  11. package/node_modules/@pi-plugins/fast-mode/package.json +1 -1
  12. package/node_modules/@tifan/pi-handoff/package.json +1 -1
  13. package/node_modules/@tifan/pi-handoff/src/index.ts +56 -26
  14. package/node_modules/@tifan/pi-mermaid-open/package.json +1 -1
  15. package/node_modules/@tifan/pi-preferred-thinking/package.json +1 -1
  16. package/node_modules/@tifan/pi-recap/package.json +1 -1
  17. package/node_modules/@tifan/pi-rename/package.json +1 -1
  18. package/node_modules/pi-antigravity/package.json +2 -2
  19. package/node_modules/pi-lens/package.json +158 -158
  20. package/node_modules/pi-multi-account/package.json +2 -2
  21. package/node_modules/pi-typesafe/README.md +1 -1
  22. package/node_modules/pi-typesafe/dist/auth.d.ts +9 -5
  23. package/node_modules/pi-typesafe/dist/auth.js +7 -3
  24. package/node_modules/pi-typesafe/dist/backends.d.ts +33 -3
  25. package/node_modules/pi-typesafe/dist/backends.js +95 -1
  26. package/node_modules/pi-typesafe/dist/client.d.ts +5 -5
  27. package/node_modules/pi-typesafe/dist/client.js +12 -9
  28. package/node_modules/pi-typesafe/dist/credentials.d.ts +14 -8
  29. package/node_modules/pi-typesafe/dist/credentials.js +10 -7
  30. package/node_modules/pi-typesafe/dist/errors.d.ts +2 -2
  31. package/node_modules/pi-typesafe/dist/index.d.ts +2 -2
  32. package/node_modules/pi-typesafe/dist/index.js +1 -1
  33. package/node_modules/pi-typesafe/dist/login.d.ts +2 -2
  34. package/node_modules/pi-typesafe/dist/login.js +2 -2
  35. package/node_modules/pi-typesafe/package.json +5 -5
  36. package/node_modules/pi-web-access/package.json +2 -2
  37. package/node_modules/remote-pi/package.json +5 -1
  38. package/package.json +16 -28
  39. package/node_modules/pi-mcp-adapter/CHANGELOG.md +0 -1013
  40. package/node_modules/pi-mcp-adapter/LICENSE +0 -21
  41. package/node_modules/pi-mcp-adapter/OAUTH.md +0 -369
  42. package/node_modules/pi-mcp-adapter/README.md +0 -1021
  43. package/node_modules/pi-mcp-adapter/abort.ts +0 -34
  44. package/node_modules/pi-mcp-adapter/agent-dir.ts +0 -68
  45. package/node_modules/pi-mcp-adapter/agent-plugin-loader.ts +0 -416
  46. package/node_modules/pi-mcp-adapter/agent-plugin-provenance.ts +0 -36
  47. package/node_modules/pi-mcp-adapter/app-bridge.bundle.js +0 -67
  48. package/node_modules/pi-mcp-adapter/banner.png +0 -0
  49. package/node_modules/pi-mcp-adapter/bearer-command-resolver.ts +0 -193
  50. package/node_modules/pi-mcp-adapter/claude-plugin-loader.ts +0 -365
  51. package/node_modules/pi-mcp-adapter/cli.js +0 -454
  52. package/node_modules/pi-mcp-adapter/commands.ts +0 -861
  53. package/node_modules/pi-mcp-adapter/config.ts +0 -1565
  54. package/node_modules/pi-mcp-adapter/consent-manager.ts +0 -95
  55. package/node_modules/pi-mcp-adapter/direct-tool-surface.ts +0 -244
  56. package/node_modules/pi-mcp-adapter/direct-tools.ts +0 -428
  57. package/node_modules/pi-mcp-adapter/dist/abort.d.ts +0 -2
  58. package/node_modules/pi-mcp-adapter/dist/abort.js +0 -36
  59. package/node_modules/pi-mcp-adapter/dist/abort.js.map +0 -1
  60. package/node_modules/pi-mcp-adapter/dist/agent-dir.d.ts +0 -10
  61. package/node_modules/pi-mcp-adapter/dist/agent-dir.js +0 -63
  62. package/node_modules/pi-mcp-adapter/dist/agent-dir.js.map +0 -1
  63. package/node_modules/pi-mcp-adapter/dist/agent-plugin-loader.d.ts +0 -8
  64. package/node_modules/pi-mcp-adapter/dist/agent-plugin-loader.js +0 -398
  65. package/node_modules/pi-mcp-adapter/dist/agent-plugin-loader.js.map +0 -1
  66. package/node_modules/pi-mcp-adapter/dist/agent-plugin-provenance.d.ts +0 -1
  67. package/node_modules/pi-mcp-adapter/dist/agent-plugin-provenance.js +0 -31
  68. package/node_modules/pi-mcp-adapter/dist/agent-plugin-provenance.js.map +0 -1
  69. package/node_modules/pi-mcp-adapter/dist/bearer-command-resolver.d.ts +0 -6
  70. package/node_modules/pi-mcp-adapter/dist/bearer-command-resolver.js +0 -194
  71. package/node_modules/pi-mcp-adapter/dist/bearer-command-resolver.js.map +0 -1
  72. package/node_modules/pi-mcp-adapter/dist/claude-plugin-loader.d.ts +0 -9
  73. package/node_modules/pi-mcp-adapter/dist/claude-plugin-loader.js +0 -362
  74. package/node_modules/pi-mcp-adapter/dist/claude-plugin-loader.js.map +0 -1
  75. package/node_modules/pi-mcp-adapter/dist/config.d.ts +0 -134
  76. package/node_modules/pi-mcp-adapter/dist/config.js +0 -1361
  77. package/node_modules/pi-mcp-adapter/dist/config.js.map +0 -1
  78. package/node_modules/pi-mcp-adapter/dist/consent-manager.d.ts +0 -18
  79. package/node_modules/pi-mcp-adapter/dist/consent-manager.js +0 -88
  80. package/node_modules/pi-mcp-adapter/dist/consent-manager.js.map +0 -1
  81. package/node_modules/pi-mcp-adapter/dist/elicitation-handler.d.ts +0 -17
  82. package/node_modules/pi-mcp-adapter/dist/elicitation-handler.js +0 -316
  83. package/node_modules/pi-mcp-adapter/dist/elicitation-handler.js.map +0 -1
  84. package/node_modules/pi-mcp-adapter/dist/errors.d.ts +0 -131
  85. package/node_modules/pi-mcp-adapter/dist/errors.js +0 -278
  86. package/node_modules/pi-mcp-adapter/dist/errors.js.map +0 -1
  87. package/node_modules/pi-mcp-adapter/dist/http-ca.d.ts +0 -8
  88. package/node_modules/pi-mcp-adapter/dist/http-ca.js +0 -88
  89. package/node_modules/pi-mcp-adapter/dist/http-ca.js.map +0 -1
  90. package/node_modules/pi-mcp-adapter/dist/jev-client.d.ts +0 -14
  91. package/node_modules/pi-mcp-adapter/dist/jev-client.js +0 -367
  92. package/node_modules/pi-mcp-adapter/dist/jev-client.js.map +0 -1
  93. package/node_modules/pi-mcp-adapter/dist/jev-contracts.d.ts +0 -77
  94. package/node_modules/pi-mcp-adapter/dist/jev-contracts.js +0 -2
  95. package/node_modules/pi-mcp-adapter/dist/jev-contracts.js.map +0 -1
  96. package/node_modules/pi-mcp-adapter/dist/jev-key-store.d.ts +0 -51
  97. package/node_modules/pi-mcp-adapter/dist/jev-key-store.js +0 -205
  98. package/node_modules/pi-mcp-adapter/dist/jev-key-store.js.map +0 -1
  99. package/node_modules/pi-mcp-adapter/dist/json-schema-validator.d.ts +0 -2
  100. package/node_modules/pi-mcp-adapter/dist/json-schema-validator.js +0 -68
  101. package/node_modules/pi-mcp-adapter/dist/json-schema-validator.js.map +0 -1
  102. package/node_modules/pi-mcp-adapter/dist/lifecycle.d.ts +0 -56
  103. package/node_modules/pi-mcp-adapter/dist/lifecycle.js +0 -410
  104. package/node_modules/pi-mcp-adapter/dist/lifecycle.js.map +0 -1
  105. package/node_modules/pi-mcp-adapter/dist/logger.d.ts +0 -51
  106. package/node_modules/pi-mcp-adapter/dist/logger.js +0 -131
  107. package/node_modules/pi-mcp-adapter/dist/logger.js.map +0 -1
  108. package/node_modules/pi-mcp-adapter/dist/mcp-auth-fetch.d.ts +0 -26
  109. package/node_modules/pi-mcp-adapter/dist/mcp-auth-fetch.js +0 -103
  110. package/node_modules/pi-mcp-adapter/dist/mcp-auth-fetch.js.map +0 -1
  111. package/node_modules/pi-mcp-adapter/dist/mcp-auth-flow.d.ts +0 -118
  112. package/node_modules/pi-mcp-adapter/dist/mcp-auth-flow.js +0 -1097
  113. package/node_modules/pi-mcp-adapter/dist/mcp-auth-flow.js.map +0 -1
  114. package/node_modules/pi-mcp-adapter/dist/mcp-auth.d.ts +0 -170
  115. package/node_modules/pi-mcp-adapter/dist/mcp-auth.js +0 -1142
  116. package/node_modules/pi-mcp-adapter/dist/mcp-auth.js.map +0 -1
  117. package/node_modules/pi-mcp-adapter/dist/mcp-bearer-store.d.ts +0 -24
  118. package/node_modules/pi-mcp-adapter/dist/mcp-bearer-store.js +0 -203
  119. package/node_modules/pi-mcp-adapter/dist/mcp-bearer-store.js.map +0 -1
  120. package/node_modules/pi-mcp-adapter/dist/mcp-callback-server.d.ts +0 -53
  121. package/node_modules/pi-mcp-adapter/dist/mcp-callback-server.js +0 -441
  122. package/node_modules/pi-mcp-adapter/dist/mcp-callback-server.js.map +0 -1
  123. package/node_modules/pi-mcp-adapter/dist/mcp-oauth-provider.d.ts +0 -148
  124. package/node_modules/pi-mcp-adapter/dist/mcp-oauth-provider.js +0 -689
  125. package/node_modules/pi-mcp-adapter/dist/mcp-oauth-provider.js.map +0 -1
  126. package/node_modules/pi-mcp-adapter/dist/mcp-probe.d.ts +0 -6
  127. package/node_modules/pi-mcp-adapter/dist/mcp-probe.js +0 -166
  128. package/node_modules/pi-mcp-adapter/dist/mcp-probe.js.map +0 -1
  129. package/node_modules/pi-mcp-adapter/dist/mcp-tasks.d.ts +0 -102
  130. package/node_modules/pi-mcp-adapter/dist/mcp-tasks.js +0 -369
  131. package/node_modules/pi-mcp-adapter/dist/mcp-tasks.js.map +0 -1
  132. package/node_modules/pi-mcp-adapter/dist/mcp-trace.d.ts +0 -95
  133. package/node_modules/pi-mcp-adapter/dist/mcp-trace.js +0 -242
  134. package/node_modules/pi-mcp-adapter/dist/mcp-trace.js.map +0 -1
  135. package/node_modules/pi-mcp-adapter/dist/metadata-cache.d.ts +0 -19
  136. package/node_modules/pi-mcp-adapter/dist/metadata-cache.js +0 -301
  137. package/node_modules/pi-mcp-adapter/dist/metadata-cache.js.map +0 -1
  138. package/node_modules/pi-mcp-adapter/dist/npx-resolver.d.ts +0 -6
  139. package/node_modules/pi-mcp-adapter/dist/npx-resolver.js +0 -505
  140. package/node_modules/pi-mcp-adapter/dist/npx-resolver.js.map +0 -1
  141. package/node_modules/pi-mcp-adapter/dist/package-mcp-loader.d.ts +0 -2
  142. package/node_modules/pi-mcp-adapter/dist/package-mcp-loader.js +0 -144
  143. package/node_modules/pi-mcp-adapter/dist/package-mcp-loader.js.map +0 -1
  144. package/node_modules/pi-mcp-adapter/dist/request-headers-command.d.ts +0 -10
  145. package/node_modules/pi-mcp-adapter/dist/request-headers-command.js +0 -312
  146. package/node_modules/pi-mcp-adapter/dist/request-headers-command.js.map +0 -1
  147. package/node_modules/pi-mcp-adapter/dist/resource-tools.d.ts +0 -1
  148. package/node_modules/pi-mcp-adapter/dist/resource-tools.js +0 -15
  149. package/node_modules/pi-mcp-adapter/dist/resource-tools.js.map +0 -1
  150. package/node_modules/pi-mcp-adapter/dist/runtime-owner.d.ts +0 -13
  151. package/node_modules/pi-mcp-adapter/dist/runtime-owner.js +0 -97
  152. package/node_modules/pi-mcp-adapter/dist/runtime-owner.js.map +0 -1
  153. package/node_modules/pi-mcp-adapter/dist/sampling-handler.d.ts +0 -17
  154. package/node_modules/pi-mcp-adapter/dist/sampling-handler.js +0 -203
  155. package/node_modules/pi-mcp-adapter/dist/sampling-handler.js.map +0 -1
  156. package/node_modules/pi-mcp-adapter/dist/secure-keyring.d.ts +0 -11
  157. package/node_modules/pi-mcp-adapter/dist/secure-keyring.js +0 -172
  158. package/node_modules/pi-mcp-adapter/dist/secure-keyring.js.map +0 -1
  159. package/node_modules/pi-mcp-adapter/dist/server-manager.d.ts +0 -157
  160. package/node_modules/pi-mcp-adapter/dist/server-manager.js +0 -1745
  161. package/node_modules/pi-mcp-adapter/dist/server-manager.js.map +0 -1
  162. package/node_modules/pi-mcp-adapter/dist/session-approvals.d.ts +0 -34
  163. package/node_modules/pi-mcp-adapter/dist/session-approvals.js +0 -140
  164. package/node_modules/pi-mcp-adapter/dist/session-approvals.js.map +0 -1
  165. package/node_modules/pi-mcp-adapter/dist/session-recovery.d.ts +0 -26
  166. package/node_modules/pi-mcp-adapter/dist/session-recovery.js +0 -142
  167. package/node_modules/pi-mcp-adapter/dist/session-recovery.js.map +0 -1
  168. package/node_modules/pi-mcp-adapter/dist/state.d.ts +0 -73
  169. package/node_modules/pi-mcp-adapter/dist/state.js +0 -2
  170. package/node_modules/pi-mcp-adapter/dist/state.js.map +0 -1
  171. package/node_modules/pi-mcp-adapter/dist/types.d.ts +0 -642
  172. package/node_modules/pi-mcp-adapter/dist/types.js +0 -331
  173. package/node_modules/pi-mcp-adapter/dist/types.js.map +0 -1
  174. package/node_modules/pi-mcp-adapter/dist/ui-app-bridge-helpers.d.ts +0 -6
  175. package/node_modules/pi-mcp-adapter/dist/ui-app-bridge-helpers.js +0 -37
  176. package/node_modules/pi-mcp-adapter/dist/ui-app-bridge-helpers.js.map +0 -1
  177. package/node_modules/pi-mcp-adapter/dist/ui-resource-handler.d.ts +0 -17
  178. package/node_modules/pi-mcp-adapter/dist/ui-resource-handler.js +0 -219
  179. package/node_modules/pi-mcp-adapter/dist/ui-resource-handler.js.map +0 -1
  180. package/node_modules/pi-mcp-adapter/dist/ui-stream-types.d.ts +0 -104
  181. package/node_modules/pi-mcp-adapter/dist/ui-stream-types.js +0 -59
  182. package/node_modules/pi-mcp-adapter/dist/ui-stream-types.js.map +0 -1
  183. package/node_modules/pi-mcp-adapter/dist/ui-tool-visibility.d.ts +0 -4
  184. package/node_modules/pi-mcp-adapter/dist/ui-tool-visibility.js +0 -27
  185. package/node_modules/pi-mcp-adapter/dist/ui-tool-visibility.js.map +0 -1
  186. package/node_modules/pi-mcp-adapter/dist/unix-socket-transport.d.ts +0 -15
  187. package/node_modules/pi-mcp-adapter/dist/unix-socket-transport.js +0 -85
  188. package/node_modules/pi-mcp-adapter/dist/unix-socket-transport.js.map +0 -1
  189. package/node_modules/pi-mcp-adapter/dist/utils.d.ts +0 -41
  190. package/node_modules/pi-mcp-adapter/dist/utils.js +0 -417
  191. package/node_modules/pi-mcp-adapter/dist/utils.js.map +0 -1
  192. package/node_modules/pi-mcp-adapter/elicitation-handler.ts +0 -358
  193. package/node_modules/pi-mcp-adapter/error-signal.ts +0 -32
  194. package/node_modules/pi-mcp-adapter/errors.ts +0 -364
  195. package/node_modules/pi-mcp-adapter/examples/jev-accessibility-loop.mjs +0 -85
  196. package/node_modules/pi-mcp-adapter/examples/jev-semantic-filter.mjs +0 -34
  197. package/node_modules/pi-mcp-adapter/failure-backoff.ts +0 -23
  198. package/node_modules/pi-mcp-adapter/glimpse-ui.ts +0 -80
  199. package/node_modules/pi-mcp-adapter/host-html-template.ts +0 -515
  200. package/node_modules/pi-mcp-adapter/http-ca.ts +0 -84
  201. package/node_modules/pi-mcp-adapter/index.ts +0 -2106
  202. package/node_modules/pi-mcp-adapter/init.ts +0 -721
  203. package/node_modules/pi-mcp-adapter/jev-client.ts +0 -300
  204. package/node_modules/pi-mcp-adapter/jev-contracts.ts +0 -53
  205. package/node_modules/pi-mcp-adapter/jev-key-store.ts +0 -192
  206. package/node_modules/pi-mcp-adapter/json-schema-validator.ts +0 -83
  207. package/node_modules/pi-mcp-adapter/lazy-loader.ts +0 -7
  208. package/node_modules/pi-mcp-adapter/lifecycle.ts +0 -457
  209. package/node_modules/pi-mcp-adapter/logger.ts +0 -169
  210. package/node_modules/pi-mcp-adapter/mcp-auth-fetch.ts +0 -113
  211. package/node_modules/pi-mcp-adapter/mcp-auth-flow.ts +0 -1296
  212. package/node_modules/pi-mcp-adapter/mcp-auth.ts +0 -1287
  213. package/node_modules/pi-mcp-adapter/mcp-bearer-store.ts +0 -250
  214. package/node_modules/pi-mcp-adapter/mcp-callback-server.ts +0 -534
  215. package/node_modules/pi-mcp-adapter/mcp-code.ts +0 -495
  216. package/node_modules/pi-mcp-adapter/mcp-install.ts +0 -60
  217. package/node_modules/pi-mcp-adapter/mcp-keyring-helper.cjs +0 -89
  218. package/node_modules/pi-mcp-adapter/mcp-oauth-provider.ts +0 -819
  219. package/node_modules/pi-mcp-adapter/mcp-output-guard.ts +0 -511
  220. package/node_modules/pi-mcp-adapter/mcp-panel-theme.ts +0 -104
  221. package/node_modules/pi-mcp-adapter/mcp-panel.ts +0 -1099
  222. package/node_modules/pi-mcp-adapter/mcp-probe.ts +0 -201
  223. package/node_modules/pi-mcp-adapter/mcp-references.ts +0 -373
  224. package/node_modules/pi-mcp-adapter/mcp-script-worker.mjs +0 -137
  225. package/node_modules/pi-mcp-adapter/mcp-setup-panel.ts +0 -747
  226. package/node_modules/pi-mcp-adapter/mcp-status.ts +0 -105
  227. package/node_modules/pi-mcp-adapter/mcp-tasks.ts +0 -467
  228. package/node_modules/pi-mcp-adapter/mcp-trace.ts +0 -306
  229. package/node_modules/pi-mcp-adapter/metadata-cache.ts +0 -362
  230. package/node_modules/pi-mcp-adapter/namespace-tools.ts +0 -334
  231. package/node_modules/pi-mcp-adapter/npx-resolver.ts +0 -543
  232. package/node_modules/pi-mcp-adapter/oauth-handler.ts +0 -30
  233. package/node_modules/pi-mcp-adapter/oauth.ts +0 -52
  234. package/node_modules/pi-mcp-adapter/onboarding-state.ts +0 -76
  235. package/node_modules/pi-mcp-adapter/package-mcp-loader.ts +0 -156
  236. package/node_modules/pi-mcp-adapter/package.json +0 -219
  237. package/node_modules/pi-mcp-adapter/panel-keys.ts +0 -53
  238. package/node_modules/pi-mcp-adapter/prompts.ts +0 -385
  239. package/node_modules/pi-mcp-adapter/proxy-modes.ts +0 -1735
  240. package/node_modules/pi-mcp-adapter/request-headers-command.ts +0 -333
  241. package/node_modules/pi-mcp-adapter/resource-tools.ts +0 -17
  242. package/node_modules/pi-mcp-adapter/runtime-owner.ts +0 -106
  243. package/node_modules/pi-mcp-adapter/sampling-handler.ts +0 -261
  244. package/node_modules/pi-mcp-adapter/sandbox-proxy-template.ts +0 -144
  245. package/node_modules/pi-mcp-adapter/search-ranking.ts +0 -309
  246. package/node_modules/pi-mcp-adapter/secure-keyring.ts +0 -170
  247. package/node_modules/pi-mcp-adapter/semantic-search.ts +0 -186
  248. package/node_modules/pi-mcp-adapter/server-manager.ts +0 -2088
  249. package/node_modules/pi-mcp-adapter/session-approvals.ts +0 -201
  250. package/node_modules/pi-mcp-adapter/session-recovery.ts +0 -158
  251. package/node_modules/pi-mcp-adapter/skills/mcp-scripting/SKILL.md +0 -49
  252. package/node_modules/pi-mcp-adapter/state.ts +0 -71
  253. package/node_modules/pi-mcp-adapter/tool-approval.ts +0 -205
  254. package/node_modules/pi-mcp-adapter/tool-metadata.ts +0 -302
  255. package/node_modules/pi-mcp-adapter/tool-registrar.ts +0 -255
  256. package/node_modules/pi-mcp-adapter/tool-result-renderer.ts +0 -573
  257. package/node_modules/pi-mcp-adapter/ts-shape.ts +0 -149
  258. package/node_modules/pi-mcp-adapter/types.ts +0 -1120
  259. package/node_modules/pi-mcp-adapter/ui-app-bridge-helpers.ts +0 -40
  260. package/node_modules/pi-mcp-adapter/ui-resource-handler.ts +0 -266
  261. package/node_modules/pi-mcp-adapter/ui-server.ts +0 -993
  262. package/node_modules/pi-mcp-adapter/ui-session.ts +0 -624
  263. package/node_modules/pi-mcp-adapter/ui-stream-types.ts +0 -89
  264. package/node_modules/pi-mcp-adapter/ui-tool-visibility.ts +0 -25
  265. package/node_modules/pi-mcp-adapter/unix-socket-transport.ts +0 -85
  266. package/node_modules/pi-mcp-adapter/utils.ts +0 -464
@@ -1 +0,0 @@
1
- {"version":3,"file":"package-mcp-loader.js","sourceRoot":"","sources":["../package-mcp-loader.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAC7D,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACtD,OAAO,EAAE,WAAW,EAAE,gBAAgB,EAAE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AC,IAAI,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC,MAAM,EAAE;QAAE,OAAO,IAAI,CAAC;IAC7F,OAAO,wBAAwB,CAAC,WAAW,EAAE,WAAW,CAAC,CAAC;AAC5D,CAAC;AAED,SAAS,iBAAiB,CAAC,IAAY;IACrC,OAAO,IAAI,CAAC,OAAO,CAAC,kBAAkB,EAAE,GAAG,CAAC,CAAC,OAAO,CAAC,gBAAgB,EAAE,EAAE,CAAC,IAAI,SAAS,CAAC;AAC1F,CAAC;AAED,SAAS,gBAAgB,CAAC,IAAY;IACpC,OAAO,IAAI,CAAC,OAAO,CAAC,kBAAkB,EAAE,GAAG,CAAC,CAAC,OAAO,CAAC,gBAAgB,EAAE,EAAE,CAAC,IAAI,QAAQ,CAAC;AACzF,CAAC"}
@@ -1,10 +0,0 @@
1
- import type { FetchLike } from "@modelcontextprotocol/client";
2
- import type { HttpRequestHeadersCommand } from "./types.ts";
3
- export interface HttpRequestCommandEnvelope {
4
- version: 1;
5
- method: string;
6
- url: string;
7
- bodyBase64: string;
8
- }
9
- /** Wrap fetch so a trusted command can derive headers from the exact request. */
10
- export declare function createRequestHeadersCommandFetch(config: HttpRequestHeadersCommand, delegate?: FetchLike): (input: URL | RequestInfo, init?: RequestInit) => Promise<Response>;
@@ -1,312 +0,0 @@
1
- import { spawn, spawnSync } from "node:child_process";
2
- import { randomUUID } from "node:crypto";
3
- import { interpolateEnvVars } from "./utils.js";
4
- const DEFAULT_TIMEOUT_MS = 10_000;
5
- const MAX_OUTPUT_BYTES = 64 * 1024;
6
- const USE_PROCESS_GROUP = process.platform !== "win32";
7
- const CLEANUP_TOKEN_ENV = "PI_MCP_REQUEST_HEADERS_CLEANUP_TOKEN";
8
- // Busy hosts can exceed spawnSync's 1 MiB default when `ps axeww` dumps each
9
- // process environment. Keep discovery below a bounded cap instead of letting
10
- // `ps` get SIGTERM'd and reporting a false cleanup failure.
11
- const PS_MAX_BUFFER_BYTES = 8 * 1024 * 1024;
12
- function isNoSuchProcessError(error) {
13
- return typeof error === "object" && error !== null && "code" in error && error.code === "ESRCH";
14
- }
15
- function runPosixPs(args) {
16
- if (process.env.PI_MCP_ADAPTER_TEST_FAIL_PS === "1")
17
- return { status: 1, signal: null, stdout: "" };
18
- const result = spawnSync("ps", args, { encoding: "utf8", maxBuffer: PS_MAX_BUFFER_BYTES });
19
- return { status: result.status, signal: result.signal, stdout: result.stdout };
20
- }
21
- function psFailureReason(result) {
22
- return result.status === null
23
- ? `ps was killed by signal ${result.signal ?? "unknown"}`
24
- : `ps exited with code ${result.status}`;
25
- }
26
- function collectPosixProcessPids(rootPid, cleanupToken) {
27
- const result = runPosixPs(["axeww", "-o", "pid=,ppid=,command="]);
28
- if (result.status !== 0) {
29
- throw new Error(`HTTP request headers command cleanup failed: ${psFailureReason(result)}`);
30
- }
31
- const childrenByParent = new Map();
32
- const processPids = new Set();
33
- const needle = cleanupToken ? `${CLEANUP_TOKEN_ENV}=${cleanupToken}` : undefined;
34
- for (const line of result.stdout.split("\n")) {
35
- const match = /^\s*(\d+)\s+(\d+)(?:\s+(.*))?$/.exec(line);
36
- if (!match)
37
- continue;
38
- const pid = Number(match[1]);
39
- const ppid = Number(match[2]);
40
- if (!Number.isInteger(pid) || !Number.isInteger(ppid))
41
- continue;
42
- const children = childrenByParent.get(ppid);
43
- if (children)
44
- children.push(pid);
45
- else
46
- childrenByParent.set(ppid, [pid]);
47
- if (needle && pid !== process.pid && match[3]?.includes(needle))
48
- processPids.add(pid);
49
- }
50
- const stack = [...(childrenByParent.get(rootPid) ?? [])];
51
- while (stack.length > 0) {
52
- const pid = stack.pop();
53
- processPids.add(pid);
54
- stack.push(...(childrenByParent.get(pid) ?? []));
55
- }
56
- return [...processPids];
57
- }
58
- function assertPosixProcessDiscoveryAvailable() {
59
- const result = runPosixPs(["axeww", "-o", "pid=,ppid=,command="]);
60
- if (result.status !== 0) {
61
- throw new Error(`HTTP request headers command cleanup failed: ${psFailureReason(result)}`);
62
- }
63
- }
64
- function isTaskkillNoSuchProcess(result) {
65
- return `${result.stdout ?? ""}\n${result.stderr ?? ""}`.toLowerCase().includes("not found");
66
- }
67
- function signalPid(pid, signal) {
68
- try {
69
- process.kill(pid, signal);
70
- }
71
- catch (error) {
72
- if (!isNoSuchProcessError(error))
73
- throw error;
74
- }
75
- }
76
- function signalProcessGroup(pid, signal) {
77
- try {
78
- process.kill(-pid, signal);
79
- }
80
- catch (error) {
81
- if (!isNoSuchProcessError(error))
82
- throw error;
83
- }
84
- }
85
- function killRequestHeadersCommand(child, trackedPosixDescendantPids = new Set(), cleanupToken) {
86
- if (process.platform === "win32" && child.pid !== undefined) {
87
- const result = spawnSync("taskkill", ["/pid", String(child.pid), "/T", "/F"], {
88
- encoding: "utf8",
89
- windowsHide: true,
90
- });
91
- if (result.status === 0 || result.status === 128 || isTaskkillNoSuchProcess(result))
92
- return;
93
- throw new Error(`HTTP request headers command cleanup failed: taskkill exited with code ${result.status ?? "unknown"}`);
94
- }
95
- if (USE_PROCESS_GROUP && child.pid !== undefined) {
96
- const frozenPids = new Set();
97
- let cleanupError;
98
- try {
99
- signalProcessGroup(child.pid, "SIGSTOP");
100
- for (const pid of trackedPosixDescendantPids) {
101
- signalPid(pid, "SIGSTOP");
102
- frozenPids.add(pid);
103
- }
104
- let stablePasses = 0;
105
- for (let pass = 0; pass < 16; pass++) {
106
- const candidates = collectPosixProcessPids(child.pid, cleanupToken);
107
- const newPids = candidates.filter(pid => !frozenPids.has(pid));
108
- if (newPids.length === 0) {
109
- stablePasses++;
110
- if (stablePasses >= 2)
111
- return;
112
- continue;
113
- }
114
- stablePasses = 0;
115
- for (const pid of newPids) {
116
- signalPid(pid, "SIGSTOP");
117
- frozenPids.add(pid);
118
- }
119
- }
120
- cleanupError = new Error("HTTP request headers command cleanup failed: descendant process tree did not stabilize");
121
- }
122
- catch (error) {
123
- cleanupError = error instanceof Error ? error : new Error(String(error));
124
- }
125
- finally {
126
- signalProcessGroup(child.pid, "SIGKILL");
127
- for (const pid of frozenPids)
128
- signalPid(pid, "SIGKILL");
129
- }
130
- if (cleanupError)
131
- throw cleanupError;
132
- return;
133
- }
134
- child.kill("SIGKILL");
135
- }
136
- function resolvedCommand(config) {
137
- if (!config || typeof config !== "object" || Array.isArray(config)) {
138
- throw new Error("HTTP request headers command must be an object");
139
- }
140
- if (typeof config.command !== "string" || config.command.trim() === "") {
141
- throw new Error("HTTP request headers command requires a non-empty command");
142
- }
143
- if (config.args !== undefined && (!Array.isArray(config.args) || config.args.some(arg => typeof arg !== "string"))) {
144
- throw new Error("HTTP request headers command args must be strings");
145
- }
146
- if (config.env !== undefined && (typeof config.env !== "object"
147
- || Array.isArray(config.env)
148
- || Object.values(config.env).some(value => typeof value !== "string"))) {
149
- throw new Error("HTTP request headers command env values must be strings");
150
- }
151
- const timeoutMs = config.timeoutMs ?? DEFAULT_TIMEOUT_MS;
152
- if (!Number.isInteger(timeoutMs) || timeoutMs <= 0 || timeoutMs > 60_000) {
153
- throw new Error("HTTP request headers command timeoutMs must be an integer between 1 and 60000");
154
- }
155
- return {
156
- command: interpolateEnvVars(config.command),
157
- args: (config.args ?? []).map(interpolateEnvVars),
158
- env: {
159
- ...process.env,
160
- ...Object.fromEntries(Object.entries(config.env ?? {}).map(([key, value]) => [key, interpolateEnvVars(value)])),
161
- },
162
- timeoutMs,
163
- };
164
- }
165
- async function invokeRequestHeadersCommand(config, envelope, signal) {
166
- const resolved = resolvedCommand(config);
167
- if (USE_PROCESS_GROUP)
168
- assertPosixProcessDiscoveryAvailable();
169
- return new Promise((resolve, reject) => {
170
- let stdout = Buffer.alloc(0);
171
- let settled = false;
172
- const cleanupToken = randomUUID();
173
- const child = spawn(resolved.command, resolved.args, {
174
- env: { ...resolved.env, [CLEANUP_TOKEN_ENV]: cleanupToken },
175
- stdio: ["pipe", "pipe", "ignore"],
176
- windowsHide: true,
177
- detached: USE_PROCESS_GROUP,
178
- });
179
- const trackedPosixDescendantPids = new Set();
180
- let trackingError;
181
- const trackPosixDescendants = () => {
182
- if (!USE_PROCESS_GROUP || child.pid === undefined || settled || trackingError)
183
- return;
184
- try {
185
- for (const pid of collectPosixProcessPids(child.pid, cleanupToken))
186
- trackedPosixDescendantPids.add(pid);
187
- }
188
- catch (error) {
189
- trackingError = error instanceof Error ? error : new Error(String(error));
190
- }
191
- };
192
- const descendantTracker = USE_PROCESS_GROUP ? setInterval(trackPosixDescendants, 50) : undefined;
193
- descendantTracker?.unref();
194
- const finish = (result) => {
195
- if (settled)
196
- return;
197
- settled = true;
198
- clearTimeout(timer);
199
- if (descendantTracker)
200
- clearInterval(descendantTracker);
201
- signal.removeEventListener("abort", abort);
202
- if (result.status === "error")
203
- reject(result.error);
204
- else
205
- resolve(result.headers);
206
- };
207
- const finishAfterKill = (result) => {
208
- try {
209
- killRequestHeadersCommand(child, trackedPosixDescendantPids, cleanupToken);
210
- finish(result);
211
- }
212
- catch (cleanupError) {
213
- finish({ status: "error", error: cleanupError instanceof Error ? cleanupError : new Error(String(cleanupError)) });
214
- }
215
- };
216
- const failAfterKill = (message) => {
217
- finishAfterKill({ status: "error", error: trackingError ?? new Error(message) });
218
- };
219
- const abort = () => {
220
- failAfterKill("HTTP request headers command aborted");
221
- };
222
- const timer = setTimeout(() => {
223
- failAfterKill(`HTTP request headers command timed out after ${resolved.timeoutMs}ms`);
224
- }, resolved.timeoutMs);
225
- signal.addEventListener("abort", abort, { once: true });
226
- if (signal.aborted) {
227
- abort();
228
- return;
229
- }
230
- child.on("error", () => finish({ status: "error", error: new Error("HTTP request headers command failed to start") }));
231
- child.stdout.on("data", (chunk) => {
232
- if (settled)
233
- return;
234
- stdout = Buffer.concat([stdout, Buffer.from(chunk)]);
235
- if (stdout.byteLength > MAX_OUTPUT_BYTES) {
236
- failAfterKill("HTTP request headers command output exceeded 64 KiB");
237
- }
238
- });
239
- child.on("close", code => {
240
- if (settled)
241
- return;
242
- if (trackingError) {
243
- failAfterKill(trackingError.message);
244
- return;
245
- }
246
- if (code !== 0) {
247
- failAfterKill(`HTTP request headers command exited with code ${code ?? "unknown"}`);
248
- return;
249
- }
250
- let parsed;
251
- try {
252
- parsed = JSON.parse(stdout.toString("utf8"));
253
- }
254
- catch {
255
- finishAfterKill({ status: "error", error: new Error("HTTP request headers command returned invalid JSON") });
256
- return;
257
- }
258
- if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) {
259
- finishAfterKill({ status: "error", error: new Error("HTTP request headers command must return a JSON object") });
260
- return;
261
- }
262
- const entries = Object.entries(parsed);
263
- if (entries.some(([, value]) => typeof value !== "string")) {
264
- finishAfterKill({ status: "error", error: new Error("HTTP request headers command values must be strings") });
265
- return;
266
- }
267
- try {
268
- finishAfterKill({ status: "success", headers: new Headers(entries) });
269
- }
270
- catch {
271
- finishAfterKill({ status: "error", error: new Error("HTTP request headers command returned an invalid header") });
272
- }
273
- });
274
- child.stdin.on("error", () => { });
275
- child.stdin.end(JSON.stringify(envelope));
276
- });
277
- }
278
- /** Wrap fetch so a trusted command can derive headers from the exact request. */
279
- export function createRequestHeadersCommandFetch(config, delegate = globalThis.fetch) {
280
- // Validate static configuration before the first request.
281
- resolvedCommand(config);
282
- return async (input, init) => {
283
- const request = new Request(input, init);
284
- const signal = init?.signal === null
285
- ? request.signal
286
- : init?.signal ?? (input instanceof Request ? input.signal : request.signal);
287
- const body = Buffer.from(await request.clone().arrayBuffer());
288
- const derived = await invokeRequestHeadersCommand(config, {
289
- version: 1,
290
- method: request.method.toUpperCase(),
291
- url: request.url,
292
- bodyBase64: body.toString("base64"),
293
- }, signal);
294
- const headers = new Headers(request.headers);
295
- derived.forEach((value, name) => headers.set(name, value));
296
- return delegate(new URL(request.url), {
297
- method: request.method,
298
- headers,
299
- ...(request.method === "GET" || request.method === "HEAD" ? {} : { body }),
300
- signal,
301
- cache: request.cache,
302
- credentials: request.credentials,
303
- integrity: request.integrity,
304
- keepalive: request.keepalive,
305
- mode: request.mode,
306
- redirect: request.redirect,
307
- referrer: request.referrer,
308
- referrerPolicy: request.referrerPolicy,
309
- });
310
- };
311
- }
312
- //# sourceMappingURL=request-headers-command.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"request-headers-command.js","sourceRoot":"","sources":["../request-headers-command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,SAAS,EAAqB,MAAM,oBAAoB,CAAC;AACzE,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAGzC,OAAO,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAEhD,MAAM,kBAAkB,GAAG,MAAM,CAAC;AAClC,MAAM,gBAAgB,GAAG,EAAE,GAAG,IAAI,CAAC;AACnC,MAAM,iBAAiB,GAAG,OAAO,CAAC,QAAQ,KAAK,OAAO,CAAC;AACvD,MAAM,iBAAiB,GAAG,sCAAsC,CAAC;AACjE,6EAA6E;AAC7E,6EAA6E;AAC7E,4DAA4D;AAC5D,MAAM,mBAAmB,GAAG,CAAC,GAAG,IAAI,GAAG,IAAI,CAAC;AAE5C,SAAS,oBAAoB,CAAC,KAAc;IAC1C,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,MAAM,IAAI,KAAK,IAAK,KAA+B,CAAC,IAAI,KAAK,OAAO,CAAC;AAC7H,CAAC;AAED,SAAS,UAAU,CAAC,IAAc;IAChC,IAAI,OAAO,CAAC,GAAG,CAAC,2BAA2B,KAAK,GAAG;QAAE,OAAO,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC;IACpG,MAAM,MAAM,GAAG,SAAS,CAAC,IAAI,EAAE,IAAI,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,mBAAmB,EAAE,CAAC,CAAC;IAC3F,OAAO,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,CAAC;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AC,SAAS;YAC5B,SAAS,EAAE,OAAO,CAAC,SAAS;YAC5B,IAAI,EAAE,OAAO,CAAC,IAAI;YAClB,QAAQ,EAAE,OAAO,CAAC,QAAQ;YAC1B,QAAQ,EAAE,OAAO,CAAC,QAAQ;YAC1B,cAAc,EAAE,OAAO,CAAC,cAAc;SACvC,CAAC,CAAC;IACL,CAAC,CAAC;AACJ,CAAC"}
@@ -1 +0,0 @@
1
- export declare function resourceNameToToolName(name: string): string;
@@ -1,15 +0,0 @@
1
- // resource-tools.ts - MCP resource name utilities
2
- export function resourceNameToToolName(name) {
3
- let result = name
4
- .replace(/[^a-zA-Z0-9]/g, "_")
5
- .replace(/_+/g, "_")
6
- .replace(/^_+/, "") // Remove leading underscores
7
- .replace(/_+$/, "") // Remove trailing underscores
8
- .toLowerCase();
9
- // Ensure we have a valid name
10
- if (!result || /^\d/.test(result)) {
11
- result = "resource" + (result ? "_" + result : "");
12
- }
13
- return result;
14
- }
15
- //# sourceMappingURL=resource-tools.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"resource-tools.js","sourceRoot":"","sources":["../resource-tools.ts"],"names":[],"mappings":"AAAA,kDAAkD;AAElD,MAAM,UAAU,sBAAsB,CAAC,IAAY;IACjD,IAAI,MAAM,GAAG,IAAI;SACd,OAAO,CAAC,eAAe,EAAE,GAAG,CAAC;SAC7B,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC;SACnB,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAE,6BAA6B;SACjD,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAE,8BAA8B;SAClD,WAAW,EAAE,CAAC;IAEjB,8BAA8B;IAC9B,IAAI,CAAC,MAAM,IAAI,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC;QAClC,MAAM,GAAG,UAAU,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,GAAG,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;IACrD,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC"}
@@ -1,13 +0,0 @@
1
- import type { ExtensionUIContext } from "@earendil-works/pi-coding-agent";
2
- export interface McpRuntimeOwner {
3
- readonly signal: AbortSignal;
4
- isActive(): boolean;
5
- addCleanup(cleanup: () => void | Promise<void>): void;
6
- stop(reason?: string): Promise<void>;
7
- throwIfInactive(): void;
8
- }
9
- export declare function createMcpRuntimeOwner(): McpRuntimeOwner;
10
- export declare function combineAbortSignals(...signals: Array<AbortSignal | undefined>): AbortSignal | undefined;
11
- /** Fence session-bound UI calls after the owning extension runtime stops. */
12
- export declare function createOwnedUi(ui: ExtensionUIContext, owner: McpRuntimeOwner): ExtensionUIContext;
13
- export declare function isAbortError(error: unknown, signal?: AbortSignal): boolean;
@@ -1,97 +0,0 @@
1
- import { formatTerminalError } from "./utils.js";
2
- export function createMcpRuntimeOwner() {
3
- const controller = new AbortController();
4
- const cleanups = [];
5
- let stopPromise;
6
- const reportCleanupFailure = (error, late) => {
7
- console.error(`MCP: ${late ? "late " : ""}runtime cleanup failed: ${formatTerminalError(error)}`);
8
- };
9
- return {
10
- signal: controller.signal,
11
- isActive: () => !controller.signal.aborted,
12
- addCleanup: cleanup => {
13
- if (controller.signal.aborted) {
14
- void Promise.resolve().then(cleanup).catch(error => reportCleanupFailure(error, true));
15
- return;
16
- }
17
- cleanups.push(cleanup);
18
- },
19
- stop: (reason = "MCP extension runtime stopped") => {
20
- if (stopPromise)
21
- return stopPromise;
22
- controller.abort(new Error(reason));
23
- const pendingCleanups = cleanups.splice(0).reverse().map(cleanup => Promise.resolve().then(cleanup));
24
- stopPromise = Promise.allSettled(pendingCleanups).then(results => {
25
- const failures = results.flatMap(result => result.status === "rejected" ? [result.reason] : []);
26
- if (failures.length > 0) {
27
- const aggregate = new AggregateError(failures, "MCP runtime cleanup failed");
28
- console.error(`MCP: runtime cleanup failed: ${formatTerminalError(aggregate)}`);
29
- throw aggregate;
30
- }
31
- });
32
- return stopPromise;
33
- },
34
- throwIfInactive: () => controller.signal.throwIfAborted(),
35
- };
36
- }
37
- export function combineAbortSignals(...signals) {
38
- const active = signals.filter((signal) => signal !== undefined);
39
- if (active.length === 0)
40
- return undefined;
41
- if (active.length === 1)
42
- return active[0];
43
- if (typeof AbortSignal.any === "function")
44
- return AbortSignal.any(active);
45
- // AbortSignal.any was added after Node 20.0.0, our minimum supported version.
46
- const controller = new AbortController();
47
- const alreadyAborted = active.find(signal => signal.aborted);
48
- if (alreadyAborted) {
49
- controller.abort(alreadyAborted.reason);
50
- return controller.signal;
51
- }
52
- const onAbort = (event) => {
53
- for (const signal of active)
54
- signal.removeEventListener("abort", onAbort);
55
- controller.abort(event.target.reason);
56
- };
57
- for (const signal of active)
58
- signal.addEventListener("abort", onAbort, { once: true });
59
- return controller.signal;
60
- }
61
- /** Fence session-bound UI calls after the owning extension runtime stops. */
62
- export function createOwnedUi(ui, owner) {
63
- const proxies = new WeakMap();
64
- const wrap = (value) => {
65
- if ((typeof value !== "object" || value === null) && typeof value !== "function") {
66
- return value;
67
- }
68
- const object = value;
69
- const existing = proxies.get(object);
70
- if (existing)
71
- return existing;
72
- const proxy = new Proxy(object, {
73
- get(target, property, receiver) {
74
- if (!owner.isActive())
75
- return undefined;
76
- const member = Reflect.get(target, property, receiver);
77
- if (typeof member === "function") {
78
- return (...args) => {
79
- if (!owner.isActive())
80
- return undefined;
81
- return Reflect.apply(member, target, args);
82
- };
83
- }
84
- return owner.isActive() ? wrap(member) : undefined;
85
- },
86
- });
87
- proxies.set(object, proxy);
88
- return proxy;
89
- };
90
- return wrap(ui);
91
- }
92
- export function isAbortError(error, signal) {
93
- if (signal?.aborted)
94
- return true;
95
- return error instanceof Error && (error.name === "AbortError" || error.message === "MCP extension runtime stopped");
96
- }
97
- //# sourceMappingURL=runtime-owner.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"runtime-owner.js","sourceRoot":"","sources":["../runtime-owner.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAm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AAM,GAAG,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAC;gBACvD,IAAI,OAAO,MAAM,KAAK,UAAU,EAAE,CAAC;oBACjC,OAAO,CAAC,GAAG,IAAe,EAAE,EAAE;wBAC5B,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE;4BAAE,OAAO,SAAS,CAAC;wBACxC,OAAO,OAAO,CAAC,KAAK,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,CAAC,CAAC;oBAC7C,CAAC,CAAC;gBACJ,CAAC;gBACD,OAAO,KAAK,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;YACrD,CAAC;SACF,CAAC,CAAC;QACH,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;QAC3B,OAAO,KAAK,CAAC;IACf,CAAC,CAAC;IACF,OAAO,IAAI,CAAC,EAAE,CAAuB,CAAC;AACxC,CAAC;AAED,MAAM,UAAU,YAAY,CAAC,KAAc,EAAE,MAAoB;IAC/D,IAAI,MAAM,EAAE,OAAO;QAAE,OAAO,IAAI,CAAC;IACjC,OAAO,KAAK,YAAY,KAAK,IAAI,CAAC,KAAK,CAAC,IAAI,KAAK,YAAY,IAAI,KAAK,CAAC,OAAO,KAAK,+BAA+B,CAAC,CAAC;AACtH,CAAC"}
@@ -1,17 +0,0 @@
1
- import type { Api, Model } from "@earendil-works/pi-ai";
2
- import type { ExtensionUIContext, ModelRegistry } from "@earendil-works/pi-coding-agent";
3
- import type { Client } from "@modelcontextprotocol/client";
4
- import { type CreateMessageRequest, type CreateMessageResult } from "@modelcontextprotocol/client";
5
- export type SamplingUIContext = Pick<ExtensionUIContext, "confirm">;
6
- export type SamplingModelRegistry = Pick<ModelRegistry, "getAvailable" | "complete">;
7
- export interface SamplingHandlerOptions {
8
- serverName: string;
9
- autoApprove: boolean;
10
- ui?: SamplingUIContext;
11
- modelRegistry: SamplingModelRegistry;
12
- getCurrentModel: () => Model<Api> | undefined;
13
- getSignal: () => AbortSignal | undefined;
14
- }
15
- export type ServerSamplingConfig = Omit<SamplingHandlerOptions, "serverName">;
16
- export declare function registerSamplingHandler(client: Client, options: SamplingHandlerOptions): void;
17
- export declare function handleSamplingRequest(options: SamplingHandlerOptions, request: CreateMessageRequest): Promise<CreateMessageResult>;