@herbertgao/pi-extensions 2026.9.17 → 2026.9.19

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