@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,505 +0,0 @@
1
- // npx-resolver.ts - Resolve npx/npm exec binaries to avoid npm parent processes
2
- import { existsSync, readFileSync, realpathSync, readdirSync, statSync, writeFileSync, renameSync, mkdirSync, openSync, readSync, closeSync, unlinkSync } from "node:fs";
3
- import { join, dirname, extname, resolve, sep } from "node:path";
4
- import { getAgentPath } from "./agent-dir.js";
5
- import { throwIfAborted } from "./abort.js";
6
- import crossSpawn from "cross-spawn";
7
- const CACHE_VERSION = 2;
8
- const CACHE_TTL_MS = 24 * 60 * 60 * 1000;
9
- const EXACT_PACKAGE_VERSION_RE = /^\d+\.\d+\.\d+(?:-[0-9A-Za-z][0-9A-Za-z.-]*)?(?:\+[0-9A-Za-z][0-9A-Za-z.-]*)?$/;
10
- export async function resolveNpxBinary(command, args, signal) {
11
- throwIfAborted(signal);
12
- const parsed = command === "npx"
13
- ? parseNpxArgs(args)
14
- : command === "npm"
15
- ? parseNpmExecArgs(args)
16
- : null;
17
- if (!parsed)
18
- return null;
19
- const packageSpec = parsePackageSpec(parsed.packageSpec);
20
- const cacheKey = JSON.stringify([command, parsed.packageSpec, parsed.binName ?? ""]);
21
- const cache = loadCache();
22
- const cached = cache?.entries?.[cacheKey];
23
- if (cached
24
- && Date.now() - cached.resolvedAt < CACHE_TTL_MS
25
- && existsSync(cached.resolvedBin)
26
- && (!packageSpec?.exactVersion || cached.packageVersion === packageSpec.exactVersion)) {
27
- return { binPath: cached.resolvedBin, extraArgs: parsed.extraArgs, isJs: cached.isJs };
28
- }
29
- const resolved = resolveFromNpmCache(parsed.packageSpec, parsed.binName);
30
- if (resolved) {
31
- saveCacheEntry(cacheKey, resolved);
32
- return { binPath: resolved.resolvedBin, extraArgs: parsed.extraArgs, isJs: resolved.isJs };
33
- }
34
- // Slow path: force npx cache population
35
- await forceNpxCache(parsed.packageSpec, signal);
36
- const resolvedAfterInstall = resolveFromNpmCache(parsed.packageSpec, parsed.binName);
37
- if (resolvedAfterInstall) {
38
- saveCacheEntry(cacheKey, resolvedAfterInstall);
39
- return { binPath: resolvedAfterInstall.resolvedBin, extraArgs: parsed.extraArgs, isJs: resolvedAfterInstall.isJs };
40
- }
41
- return null;
42
- }
43
- function parseNpxArgs(args) {
44
- const separatorIndex = args.indexOf("--");
45
- const before = separatorIndex >= 0 ? args.slice(0, separatorIndex) : args;
46
- const after = separatorIndex >= 0 ? args.slice(separatorIndex + 1) : [];
47
- const positionals = [];
48
- let packageSpec;
49
- let sawPackageFlag = false;
50
- let foundFirstPositional = false;
51
- for (let i = 0; i < before.length; i++) {
52
- const arg = before[i];
53
- if (arg === undefined)
54
- return null;
55
- if (foundFirstPositional) {
56
- positionals.push(arg);
57
- continue;
58
- }
59
- if (arg === "-y" || arg === "--yes")
60
- continue;
61
- if (arg === "-p" || arg === "--package") {
62
- const value = before[i + 1];
63
- if (!value || value.startsWith("-"))
64
- return null;
65
- if (!packageSpec)
66
- packageSpec = value;
67
- sawPackageFlag = true;
68
- i++;
69
- continue;
70
- }
71
- if (arg.startsWith("--package=")) {
72
- const value = arg.slice("--package=".length);
73
- if (!value)
74
- return null;
75
- if (!packageSpec)
76
- packageSpec = value;
77
- sawPackageFlag = true;
78
- continue;
79
- }
80
- if (arg.startsWith("-")) {
81
- return null;
82
- }
83
- positionals.push(arg);
84
- foundFirstPositional = true;
85
- }
86
- const separatedAfter = separatorIndex >= 0 && after.length > 0 ? ["--", ...after] : after;
87
- if (sawPackageFlag) {
88
- const binName = positionals[0];
89
- if (!packageSpec || !binName)
90
- return null;
91
- const extraArgs = positionals.slice(1).concat(separatedAfter);
92
- return { packageSpec, binName, extraArgs };
93
- }
94
- const packagePositional = positionals[0];
95
- if (!packagePositional)
96
- return null;
97
- const extraArgs = positionals.slice(1).concat(separatedAfter);
98
- return { packageSpec: packagePositional, extraArgs };
99
- }
100
- function parseNpmExecArgs(args) {
101
- if (args[0] !== "exec")
102
- return null;
103
- const execArgs = args.slice(1);
104
- const separatorIndex = execArgs.indexOf("--");
105
- if (separatorIndex < 0)
106
- return null;
107
- const before = execArgs.slice(0, separatorIndex);
108
- const after = execArgs.slice(separatorIndex + 1);
109
- let packageSpec;
110
- for (let i = 0; i < before.length; i++) {
111
- const arg = before[i];
112
- if (arg === undefined)
113
- return null;
114
- if (arg === "-y" || arg === "--yes")
115
- continue;
116
- if (arg === "--package") {
117
- const value = before[i + 1];
118
- if (!value || value.startsWith("-"))
119
- return null;
120
- if (!packageSpec)
121
- packageSpec = value;
122
- i++;
123
- continue;
124
- }
125
- if (arg.startsWith("--package=")) {
126
- const value = arg.slice("--package=".length);
127
- if (!value)
128
- return null;
129
- if (!packageSpec)
130
- packageSpec = value;
131
- continue;
132
- }
133
- if (arg.startsWith("-")) {
134
- return null;
135
- }
136
- }
137
- const binName = after[0];
138
- if (!packageSpec || !binName)
139
- return null;
140
- const extraArgs = after.slice(1);
141
- return { packageSpec, binName, extraArgs };
142
- }
143
- function resolveFromNpmCache(packageSpec, binName) {
144
- const cacheDir = getNpmCacheDir();
145
- if (!cacheDir)
146
- return null;
147
- const parsedSpec = parsePackageSpec(packageSpec);
148
- if (!parsedSpec)
149
- return null;
150
- const { packageName, exactVersion } = parsedSpec;
151
- const packageDir = findCachedPackageDir(cacheDir, packageName, exactVersion);
152
- if (!packageDir)
153
- return null;
154
- const packageJsonPath = join(packageDir, "package.json");
155
- if (!existsSync(packageJsonPath))
156
- return null;
157
- let pkg = null;
158
- try {
159
- pkg = JSON.parse(readFileSync(packageJsonPath, "utf-8"));
160
- }
161
- catch {
162
- return null;
163
- }
164
- const binField = pkg?.bin;
165
- if (!binField)
166
- return null;
167
- const candidates = buildBinCandidates(packageName, binName);
168
- let chosenBinName;
169
- let binRel;
170
- if (typeof binField === "string") {
171
- chosenBinName = defaultBinName(packageName);
172
- binRel = binField;
173
- }
174
- else {
175
- for (const candidate of candidates) {
176
- if (binField[candidate]) {
177
- chosenBinName = candidate;
178
- binRel = binField[candidate];
179
- break;
180
- }
181
- }
182
- if (!binRel) {
183
- const firstEntry = Object.entries(binField)[0];
184
- if (firstEntry) {
185
- chosenBinName = firstEntry[0];
186
- binRel = firstEntry[1];
187
- }
188
- }
189
- }
190
- if (!binRel)
191
- return null;
192
- const nodeModulesDir = findNodeModulesDir(packageDir);
193
- const binLink = chosenBinName ? join(nodeModulesDir, ".bin", chosenBinName) : null;
194
- let resolvedBin = binLink && existsSync(binLink) ? safeRealpath(binLink) : "";
195
- if (!resolvedBin) {
196
- resolvedBin = resolve(packageDir, binRel);
197
- if (!existsSync(resolvedBin))
198
- return null;
199
- }
200
- const isJs = detectJsBinary(resolvedBin);
201
- return {
202
- resolvedBin,
203
- resolvedAt: Date.now(),
204
- ...(pkg?.version !== undefined ? { packageVersion: pkg.version } : {}),
205
- isJs,
206
- };
207
- }
208
- const FORCE_CACHE_TIMEOUT_MS = 30_000;
209
- async function forceNpxCache(packageSpec, signal) {
210
- throwIfAborted(signal);
211
- try {
212
- await new Promise((resolve, reject) => {
213
- const proc = crossSpawn("npm", ["exec", "--yes", "--package", packageSpec, "--", "node", "-e", "1"], { stdio: "ignore" });
214
- const timer = setTimeout(() => {
215
- proc.kill();
216
- reject(new Error("timeout"));
217
- }, FORCE_CACHE_TIMEOUT_MS);
218
- const abort = () => {
219
- proc.kill();
220
- reject(signal?.reason instanceof Error ? signal.reason : new Error("MCP request aborted"));
221
- };
222
- signal?.addEventListener("abort", abort, { once: true });
223
- timer.unref();
224
- proc.on("close", () => {
225
- clearTimeout(timer);
226
- signal?.removeEventListener("abort", abort);
227
- resolve();
228
- });
229
- proc.on("error", (err) => {
230
- clearTimeout(timer);
231
- signal?.removeEventListener("abort", abort);
232
- reject(err);
233
- });
234
- });
235
- }
236
- catch (error) {
237
- if (signal?.aborted)
238
- throwIfAborted(signal);
239
- // Ignore failures, resolution will fall back to original command
240
- }
241
- throwIfAborted(signal);
242
- }
243
- function buildBinCandidates(packageName, explicitBin) {
244
- const candidates = [];
245
- if (explicitBin)
246
- candidates.push(explicitBin);
247
- if (packageName.startsWith("@")) {
248
- const namePart = packageName.split("/")[1] ?? "";
249
- const scopePart = packageName.split("/")[0]?.replace("@", "") ?? "";
250
- if (namePart)
251
- candidates.push(namePart);
252
- if (scopePart && namePart)
253
- candidates.push(`${scopePart}-${namePart}`);
254
- }
255
- else {
256
- candidates.push(packageName);
257
- }
258
- return [...new Set(candidates.filter(Boolean))];
259
- }
260
- function parsePackageSpec(spec) {
261
- const trimmed = spec.trim();
262
- if (!trimmed)
263
- return null;
264
- let packageName;
265
- let requestedVersion;
266
- if (trimmed.startsWith("@")) {
267
- const slashIndex = trimmed.indexOf("/");
268
- if (slashIndex < 0)
269
- return null;
270
- const atIndex = trimmed.lastIndexOf("@");
271
- if (atIndex > slashIndex) {
272
- packageName = trimmed.slice(0, atIndex);
273
- requestedVersion = trimmed.slice(atIndex + 1);
274
- }
275
- else {
276
- packageName = trimmed;
277
- }
278
- }
279
- else {
280
- const atIndex = trimmed.indexOf("@");
281
- if (atIndex >= 0) {
282
- packageName = trimmed.slice(0, atIndex);
283
- requestedVersion = trimmed.slice(atIndex + 1);
284
- }
285
- else {
286
- packageName = trimmed;
287
- }
288
- }
289
- if (!packageName)
290
- return null;
291
- const normalizedVersion = requestedVersion?.replace(/^=/, "").replace(/^v/i, "");
292
- return {
293
- packageName,
294
- ...(normalizedVersion && EXACT_PACKAGE_VERSION_RE.test(normalizedVersion)
295
- ? { exactVersion: normalizedVersion }
296
- : {}),
297
- };
298
- }
299
- function defaultBinName(packageName) {
300
- if (packageName.startsWith("@")) {
301
- const parts = packageName.split("/");
302
- return parts[1] ?? packageName.replace("@", "").replace("/", "-");
303
- }
304
- return packageName;
305
- }
306
- function findCachedPackageDir(cacheDir, packageName, exactVersion) {
307
- const npxDir = join(cacheDir, "_npx");
308
- if (!existsSync(npxDir))
309
- return null;
310
- const packagePathParts = packageName.startsWith("@")
311
- ? packageName.split("/")
312
- : [packageName];
313
- const candidates = readdirSync(npxDir, { withFileTypes: true })
314
- .filter(entry => entry.isDirectory())
315
- .map(entry => {
316
- const full = join(npxDir, entry.name);
317
- const mtime = safeStatMtime(full);
318
- return { name: entry.name, mtime };
319
- })
320
- .sort((a, b) => b.mtime - a.mtime);
321
- for (const entry of candidates) {
322
- const pkgDir = join(npxDir, entry.name, "node_modules", ...packagePathParts);
323
- const packageJsonPath = join(pkgDir, "package.json");
324
- if (!existsSync(packageJsonPath))
325
- continue;
326
- if (exactVersion) {
327
- try {
328
- const pkg = JSON.parse(readFileSync(packageJsonPath, "utf-8"));
329
- if (pkg.version !== exactVersion)
330
- continue;
331
- }
332
- catch {
333
- continue;
334
- }
335
- }
336
- return pkgDir;
337
- }
338
- return null;
339
- }
340
- function findNodeModulesDir(packageDir) {
341
- const parts = packageDir.split(sep);
342
- const idx = parts.lastIndexOf("node_modules");
343
- if (idx >= 0) {
344
- return parts.slice(0, idx + 1).join(sep);
345
- }
346
- return join(packageDir, "..");
347
- }
348
- function detectJsBinary(binPath) {
349
- const ext = extname(binPath).toLowerCase();
350
- if (ext === ".js" || ext === ".mjs" || ext === ".cjs")
351
- return true;
352
- try {
353
- const fd = openSync(binPath, "r");
354
- try {
355
- const buf = Buffer.alloc(256);
356
- readSync(fd, buf, 0, 256, 0);
357
- const firstLine = buf.toString("utf-8").split("\n")[0] ?? "";
358
- return firstLine.startsWith("#!") && firstLine.includes("node");
359
- }
360
- finally {
361
- closeSync(fd);
362
- }
363
- }
364
- catch {
365
- return false;
366
- }
367
- }
368
- let npmCacheDirCached;
369
- function getNpmCacheDir() {
370
- if (npmCacheDirCached !== undefined)
371
- return npmCacheDirCached;
372
- if (process.env.NPM_CONFIG_CACHE) {
373
- npmCacheDirCached = process.env.NPM_CONFIG_CACHE;
374
- return npmCacheDirCached;
375
- }
376
- try {
377
- const result = crossSpawn.sync("npm", ["config", "get", "cache"], { encoding: "utf-8" });
378
- if (result.status === 0) {
379
- const path = String(result.stdout).trim();
380
- npmCacheDirCached = path || null;
381
- return npmCacheDirCached;
382
- }
383
- }
384
- catch {
385
- npmCacheDirCached = null;
386
- return null;
387
- }
388
- npmCacheDirCached = null;
389
- return null;
390
- }
391
- function getNpxCachePath() {
392
- return getAgentPath("mcp-npx-cache.json");
393
- }
394
- function readNpxCachePayload(cachePath) {
395
- if (!existsSync(cachePath))
396
- return null;
397
- try {
398
- return JSON.parse(readFileSync(cachePath, "utf-8"));
399
- }
400
- catch {
401
- return null;
402
- }
403
- }
404
- function asRecord(value) {
405
- return typeof value === "object" && value !== null && !Array.isArray(value)
406
- ? value
407
- : null;
408
- }
409
- function createCacheEntries() {
410
- return Object.create(null);
411
- }
412
- function toNpxCacheEntry(value) {
413
- const raw = asRecord(value);
414
- if (!raw)
415
- return null;
416
- if (typeof raw.resolvedBin !== "string")
417
- return null;
418
- if (typeof raw.resolvedAt !== "number" || !Number.isFinite(raw.resolvedAt))
419
- return null;
420
- if (typeof raw.isJs !== "boolean")
421
- return null;
422
- if (raw.packageVersion !== undefined && typeof raw.packageVersion !== "string")
423
- return null;
424
- return {
425
- resolvedBin: raw.resolvedBin,
426
- resolvedAt: raw.resolvedAt,
427
- ...(raw.packageVersion !== undefined ? { packageVersion: raw.packageVersion } : {}),
428
- isJs: raw.isJs,
429
- };
430
- }
431
- function toNpxCache(value) {
432
- const raw = asRecord(value);
433
- if (!raw || raw.version !== CACHE_VERSION)
434
- return null;
435
- const rawEntries = asRecord(raw.entries);
436
- if (!rawEntries)
437
- return null;
438
- const entries = createCacheEntries();
439
- for (const [key, rawEntry] of Object.entries(rawEntries)) {
440
- const entry = toNpxCacheEntry(rawEntry);
441
- if (entry)
442
- entries[key] = entry;
443
- }
444
- return { version: CACHE_VERSION, entries };
445
- }
446
- function clearLegacyCache() {
447
- const cachePath = getNpxCachePath();
448
- const raw = asRecord(readNpxCachePayload(cachePath));
449
- if (raw?.version !== 1)
450
- return false;
451
- try {
452
- unlinkSync(cachePath);
453
- }
454
- catch {
455
- try {
456
- writeFileSync(cachePath, "", "utf-8");
457
- }
458
- catch {
459
- // Cache cleanup is best effort; resolution must still proceed.
460
- }
461
- }
462
- return true;
463
- }
464
- clearLegacyCache();
465
- function loadCache() {
466
- if (clearLegacyCache())
467
- return null;
468
- return toNpxCache(readNpxCachePayload(getNpxCachePath()));
469
- }
470
- function saveCacheEntry(key, entry) {
471
- try {
472
- const cachePath = getNpxCachePath();
473
- const dir = dirname(cachePath);
474
- mkdirSync(dir, { recursive: true });
475
- const existing = toNpxCache(readNpxCachePayload(cachePath));
476
- const entries = createCacheEntries();
477
- if (existing)
478
- Object.assign(entries, existing.entries);
479
- const merged = { version: CACHE_VERSION, entries };
480
- merged.entries[key] = entry;
481
- const tmpPath = `${cachePath}.${process.pid}.tmp`;
482
- writeFileSync(tmpPath, JSON.stringify(merged, null, 2), "utf-8");
483
- renameSync(tmpPath, cachePath);
484
- }
485
- catch {
486
- // Cache writes are best effort; resolution must still proceed.
487
- }
488
- }
489
- function safeRealpath(path) {
490
- try {
491
- return realpathSync(path);
492
- }
493
- catch {
494
- return "";
495
- }
496
- }
497
- function safeStatMtime(path) {
498
- try {
499
- return statSync(path).mtimeMs;
500
- }
501
- catch {
502
- return 0;
503
- }
504
- }
505
- //# sourceMappingURL=npx-resolver.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"npx-resolver.js","sourceRoot":"","sources":["../npx-resolver.ts"],"names":[],"mappings":"AAAA,gFAAgF;AAChF,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,YAAY,EAAE,WAAW,EAAE,QAAQ,EAAE,aAAa,EAAE,UAAU,EAAE,SAAS,EAAE,QAAQ,EAAE,QAAQ,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACzK,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AACjE,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,C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C,OAAO,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;QAC5B,MAAM,OAAO,GAAG,GAAG,SAAS,IAAI,OAAO,CAAC,GAAG,MAAM,CAAC;QAClD,aAAa,CAAC,OAAO,EAAE,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC;QACjE,UAAU,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC;IACjC,CAAC;IAAC,MAAM,CAAC;QACP,+DAA+D;IACjE,CAAC;AACH,CAAC;AAED,SAAS,YAAY,CAAC,IAAY;IAChC,IAAI,CAAC;QACH,OAAO,YAAY,CAAC,IAAI,CAAC,CAAC;IAC5B,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,EAAE,CAAC;IACZ,CAAC;AACH,CAAC;AAED,SAAS,aAAa,CAAC,IAAY;IACjC,IAAI,CAAC;QACH,OAAO,QAAQ,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC;IAChC,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,CAAC,CAAC;IACX,CAAC;AACH,CAAC"}
@@ -1,2 +0,0 @@
1
- import type { McpConfig } from "./types.ts";
2
- export declare function loadPackageMcpConfigs(cwd?: string): McpConfig;
@@ -1,144 +0,0 @@
1
- import { existsSync, readFileSync, statSync } from "node:fs";
2
- import { isAbsolute, join, resolve } from "node:path";
3
- import { getAgentDir, getConfigDirName } from "./agent-dir.js";
4
- import { parseJsonWithComments, resolveContainedPath, resolveRealContainedPath } from "./utils.js";
5
- export function loadPackageMcpConfigs(cwd = process.cwd()) {
6
- const mcpServers = {};
7
- const seen = new Set();
8
- for (const packageRoot of getConfiguredPackageRoots(cwd)) {
9
- const manifest = readPackageManifest(packageRoot);
10
- if (!manifest || typeof manifest.name !== "string" || !manifest.name)
11
- continue;
12
- const paths = getManifestMcpPaths(manifest.pi?.mcp, manifest.name);
13
- if (!paths)
14
- continue;
15
- const packagePrefix = formatPackageName(manifest.name);
16
- const packageServers = new Set();
17
- for (const path of paths) {
18
- const configPath = resolvePackageConfigPath(packageRoot, path);
19
- if (!configPath) {
20
- console.warn(`Pi package ${manifest.name} skips MCP config ${path}: file must stay inside the package`);
21
- continue;
22
- }
23
- const config = readMcpConfig(configPath, manifest.name);
24
- if (!config)
25
- continue;
26
- for (const [serverName, server] of Object.entries(config.mcpServers)) {
27
- const normalizedName = `${packagePrefix}__${formatServerName(serverName)}`;
28
- if (packageServers.has(normalizedName) || seen.has(normalizedName)) {
29
- console.warn(`Pi package ${manifest.name} skips duplicate normalized MCP server ${normalizedName}`);
30
- continue;
31
- }
32
- packageServers.add(normalizedName);
33
- seen.add(normalizedName);
34
- mcpServers[normalizedName] = server;
35
- }
36
- }
37
- }
38
- return { mcpServers };
39
- }
40
- function getConfiguredPackageRoots(cwd) {
41
- const roots = [];
42
- for (const [settingsPath, scope] of [
43
- [join(cwd, getConfigDirName(), "settings.json"), "project"],
44
- [join(getAgentDir(), "settings.json"), "user"],
45
- ]) {
46
- const settings = readOptionalJson(settingsPath, `${scope} Pi settings`);
47
- if (settings === undefined)
48
- continue;
49
- if (typeof settings !== "object" || settings === null || Array.isArray(settings)) {
50
- throw new Error(`${scope} Pi settings ${settingsPath} must be a JSON object`);
51
- }
52
- const packages = settings.packages;
53
- if (packages === undefined)
54
- continue;
55
- if (!Array.isArray(packages))
56
- throw new Error(`${scope} Pi settings ${settingsPath} packages must be an array`);
57
- for (const entry of packages) {
58
- const source = typeof entry === "string"
59
- ? entry
60
- : entry && typeof entry === "object" && !Array.isArray(entry) && typeof entry.source === "string"
61
- ? entry.source
62
- : undefined;
63
- if (!source)
64
- throw new Error(`${scope} Pi settings ${settingsPath} package entries must be strings or objects with a string source`);
65
- const root = resolvePackageRoot(source, scope, cwd);
66
- if (root && !roots.includes(root))
67
- roots.push(root);
68
- }
69
- }
70
- return roots;
71
- }
72
- function resolvePackageRoot(source, scope, cwd) {
73
- const baseDir = scope === "user" ? getAgentDir() : join(cwd, getConfigDirName());
74
- if (source.startsWith("npm:")) {
75
- const name = source.slice(4).trim().match(/^(@?[^@]+(?:\/[^@]+)?)/)?.[1];
76
- return name ? resolveContainedPath(join(baseDir, "npm", "node_modules"), name) : null;
77
- }
78
- const gitSource = source.startsWith("git:")
79
- ? source.slice(4).trim()
80
- : /^(?:(?:https?|ssh):\/\/|git@[^:]+:)/.test(source) ? source : null;
81
- if (gitSource) {
82
- const value = gitSource
83
- .replace(/^ssh:\/\/git@/, "")
84
- .replace(/^git@([^:]+):/, "$1/")
85
- .replace(/^[a-z]+:\/\//i, "");
86
- const path = value.replace(/@[^/]+$/, "").replace(/\.git$/, "");
87
- return path && !path.startsWith("/") ? resolveContainedPath(join(baseDir, "git"), path) : null;
88
- }
89
- return isAbsolute(source) ? resolve(source) : resolve(baseDir, source);
90
- }
91
- function readPackageManifest(packageRoot) {
92
- const manifest = readOptionalJson(join(packageRoot, "package.json"), `Pi package manifest ${packageRoot}`);
93
- return manifest && typeof manifest === "object" && !Array.isArray(manifest) ? manifest : null;
94
- }
95
- function getManifestMcpPaths(value, packageName) {
96
- const paths = typeof value === "string" ? [value] : Array.isArray(value) && value.every((path) => typeof path === "string") ? value : null;
97
- if (value !== undefined && !paths)
98
- console.warn(`Pi package ${packageName} ignores invalid pi.mcp manifest entry`);
99
- return paths;
100
- }
101
- function readMcpConfig(path, packageName) {
102
- const config = readRequiredJson(path, `Pi package ${packageName} MCP config`);
103
- if (!config || typeof config !== "object" || Array.isArray(config)) {
104
- throw new Error(`Pi package ${packageName} MCP config ${path} must be a JSON object`);
105
- }
106
- const servers = config.mcpServers;
107
- if (!servers || typeof servers !== "object" || Array.isArray(servers)) {
108
- throw new Error(`Pi package ${packageName} MCP config ${path} must contain a JSON object mcpServers field`);
109
- }
110
- const mcpServers = {};
111
- for (const [name, server] of Object.entries(servers)) {
112
- if (!server || typeof server !== "object" || Array.isArray(server)) {
113
- throw new Error(`Pi package ${packageName} MCP config ${path} server ${name} must be a JSON object`);
114
- }
115
- mcpServers[name] = server;
116
- }
117
- return { mcpServers };
118
- }
119
- function readRequiredJson(path, description) {
120
- try {
121
- return parseJsonWithComments(readFileSync(path, "utf8"));
122
- }
123
- catch (error) {
124
- throw new Error(`${description} ${path} contains invalid JSON: ${error instanceof Error ? error.message : String(error)}`, { cause: error });
125
- }
126
- }
127
- function readOptionalJson(path, description) {
128
- if (!existsSync(path))
129
- return undefined;
130
- return readRequiredJson(path, description);
131
- }
132
- function resolvePackageConfigPath(packageRoot, path) {
133
- const lexicalPath = resolveContainedPath(packageRoot, path);
134
- if (!lexicalPath || !existsSync(lexicalPath) || !statSync(lexicalPath).isFile())
135
- return null;
136
- return resolveRealContainedPath(packageRoot, lexicalPath);
137
- }
138
- function formatPackageName(name) {
139
- return name.replace(/[^A-Za-z0-9_-]+/g, "_").replace(/^[_-]+|[_-]+$/g, "") || "package";
140
- }
141
- function formatServerName(name) {
142
- return name.replace(/[^A-Za-z0-9_-]+/g, "_").replace(/^[_-]+|[_-]+$/g, "") || "server";
143
- }
144
- //# sourceMappingURL=package-mcp-loader.js.map