@introspection-ai/recipes 0.25.1 → 0.27.1

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 (291) hide show
  1. package/dist/api/mcp.d.ts +3 -3
  2. package/dist/api/mcp.d.ts.map +1 -1
  3. package/dist/api/mcp.js +1 -1
  4. package/dist/api/mcp.js.map +1 -1
  5. package/dist/{child-agent-completions.d.ts → child/agent-completions.d.ts} +2 -2
  6. package/dist/child/agent-completions.d.ts.map +1 -0
  7. package/dist/{child-agent-completions.js → child/agent-completions.js} +1 -1
  8. package/dist/child/agent-completions.js.map +1 -0
  9. package/dist/{child-agent-store.d.ts → child/agent-store.d.ts} +1 -1
  10. package/dist/child/agent-store.d.ts.map +1 -0
  11. package/dist/{child-agent-store.js → child/agent-store.js} +1 -1
  12. package/dist/child/agent-store.js.map +1 -0
  13. package/dist/{child-agent.d.ts → child/agent.d.ts} +2 -2
  14. package/dist/child/agent.d.ts.map +1 -0
  15. package/dist/{child-agent.js → child/agent.js} +5 -5
  16. package/dist/child/agent.js.map +1 -0
  17. package/dist/{child-session.d.ts → child/session.d.ts} +4 -4
  18. package/dist/child/session.d.ts.map +1 -0
  19. package/dist/{child-session.js → child/session.js} +2 -2
  20. package/dist/child/session.js.map +1 -0
  21. package/dist/connector-tools.d.ts +1 -1
  22. package/dist/connector-tools.js +2 -2
  23. package/dist/inspect.d.ts +1 -1
  24. package/dist/inspect.js +1 -1
  25. package/dist/{mcp-catalog.d.ts → mcp/catalog.d.ts} +3 -3
  26. package/dist/mcp/catalog.d.ts.map +1 -0
  27. package/dist/{mcp-catalog.js → mcp/catalog.js} +2 -2
  28. package/dist/mcp/catalog.js.map +1 -0
  29. package/dist/{mcp-command-context.d.ts → mcp/cli/command-context.d.ts} +1 -1
  30. package/dist/mcp/cli/command-context.d.ts.map +1 -0
  31. package/dist/{mcp-command-context.js → mcp/cli/command-context.js} +1 -1
  32. package/dist/mcp/cli/command-context.js.map +1 -0
  33. package/dist/{mcp-cli-core.d.ts → mcp/cli/core.d.ts} +14 -8
  34. package/dist/mcp/cli/core.d.ts.map +1 -0
  35. package/dist/{mcp-cli-core.js → mcp/cli/core.js} +105 -146
  36. package/dist/mcp/cli/core.js.map +1 -0
  37. package/dist/mcp/cli/help.d.ts +6 -0
  38. package/dist/mcp/cli/help.d.ts.map +1 -0
  39. package/dist/mcp/cli/help.js +116 -0
  40. package/dist/mcp/cli/help.js.map +1 -0
  41. package/dist/mcp/cli/index.d.ts +3 -0
  42. package/dist/mcp/cli/index.d.ts.map +1 -0
  43. package/dist/{mcp-cli.js → mcp/cli/index.js} +4 -4
  44. package/dist/mcp/cli/index.js.map +1 -0
  45. package/dist/{mcp-cli-policy.d.ts → mcp/cli/policy.d.ts} +2 -2
  46. package/dist/mcp/cli/policy.d.ts.map +1 -0
  47. package/dist/{mcp-cli-policy.js → mcp/cli/policy.js} +2 -2
  48. package/dist/mcp/cli/policy.js.map +1 -0
  49. package/dist/mcp/cli/run-worker.d.ts +2 -0
  50. package/dist/mcp/cli/run-worker.d.ts.map +1 -0
  51. package/dist/mcp/cli/run-worker.js +54 -0
  52. package/dist/mcp/cli/run-worker.js.map +1 -0
  53. package/dist/mcp/client-entry.d.ts +3 -0
  54. package/dist/mcp/client-entry.d.ts.map +1 -0
  55. package/dist/{mcp-client.js → mcp/client-entry.js} +3 -3
  56. package/dist/mcp/client-entry.js.map +1 -0
  57. package/dist/{mcp-contract.d.ts → mcp/contract.d.ts} +2 -2
  58. package/dist/mcp/contract.d.ts.map +1 -0
  59. package/dist/{mcp-contract.js → mcp/contract.js} +1 -1
  60. package/dist/mcp/contract.js.map +1 -0
  61. package/dist/{mcp-daemon-client.d.ts → mcp/daemon/client.d.ts} +3 -2
  62. package/dist/mcp/daemon/client.d.ts.map +1 -0
  63. package/dist/{mcp-daemon-client.js → mcp/daemon/client.js} +12 -8
  64. package/dist/mcp/daemon/client.js.map +1 -0
  65. package/dist/mcp/daemon/index.d.ts +3 -0
  66. package/dist/mcp/daemon/index.d.ts.map +1 -0
  67. package/dist/mcp/daemon/index.js +453 -0
  68. package/dist/{mcp-daemon.js.map → mcp/daemon/index.js.map} +1 -1
  69. package/dist/{mcp-daemon-protocol.d.ts → mcp/daemon/protocol.d.ts} +2 -2
  70. package/dist/mcp/daemon/protocol.d.ts.map +1 -0
  71. package/dist/{mcp-daemon-protocol.js → mcp/daemon/protocol.js} +1 -1
  72. package/dist/mcp/daemon/protocol.js.map +1 -0
  73. package/dist/{mcp.d.ts → mcp/index.d.ts} +5 -5
  74. package/dist/mcp/index.d.ts.map +1 -0
  75. package/dist/{mcp.js → mcp/index.js} +16 -10
  76. package/dist/mcp/index.js.map +1 -0
  77. package/dist/{mcp-policy.d.ts → mcp/policy.d.ts} +3 -3
  78. package/dist/mcp/policy.d.ts.map +1 -0
  79. package/dist/{mcp-policy.js → mcp/policy.js} +1 -1
  80. package/dist/mcp/policy.js.map +1 -0
  81. package/dist/{mcp-tools.d.ts → mcp/tools.d.ts} +4 -4
  82. package/dist/mcp/tools.d.ts.map +1 -0
  83. package/dist/{mcp-tools.js → mcp/tools.js} +4 -4
  84. package/dist/mcp/tools.js.map +1 -0
  85. package/dist/{mcp-trace-context.d.ts → mcp/trace-context.d.ts} +2 -2
  86. package/dist/mcp/trace-context.d.ts.map +1 -0
  87. package/dist/{mcp-trace-context.js → mcp/trace-context.js} +1 -1
  88. package/dist/mcp/trace-context.js.map +1 -0
  89. package/dist/mcp-chunks/{auth-command-4WFRNU2I.js → auth-command-GQFV6QYP.js} +24 -27
  90. package/dist/mcp-chunks/call-arguments-VT7JLNJY.js +16 -0
  91. package/dist/mcp-chunks/{call-command-JBIKXOGC.js → call-command-LMAREWKD.js} +45 -45
  92. package/dist/mcp-chunks/{chunk-3JGS7LQB.js → chunk-2HOMVWSA.js} +2 -2
  93. package/dist/mcp-chunks/{chunk-G6OMDUNG.js → chunk-2P2HVZ3G.js} +1 -1
  94. package/dist/mcp-chunks/{chunk-ED2WN5BI.js → chunk-34QXE62Y.js} +175 -147
  95. package/dist/mcp-chunks/{chunk-Y3EDWN2P.js → chunk-5B7GRMUK.js} +1 -1
  96. package/dist/mcp-chunks/chunk-5BMCVE2J.js +516 -0
  97. package/dist/mcp-chunks/{chunk-V5AYEKSL.js → chunk-6QZQZXDJ.js} +52 -81
  98. package/dist/mcp-chunks/{chunk-3R2WK3NB.js → chunk-6RG6AD5X.js} +6 -6
  99. package/dist/mcp-chunks/{chunk-SNKXMWDB.js → chunk-77BZYP72.js} +1 -1
  100. package/dist/mcp-chunks/chunk-7PFJCLXL.js +123 -0
  101. package/dist/mcp-chunks/chunk-7WL4TMON.js +31 -0
  102. package/dist/mcp-chunks/{chunk-ELA77TDC.js → chunk-C2VLY7ED.js} +4 -4
  103. package/dist/mcp-chunks/{chunk-FAJPJTOC.js → chunk-CLR6DJV3.js} +1 -1
  104. package/dist/mcp-chunks/{chunk-ZOAQDFAO.js → chunk-D6B2M5V7.js} +1 -1
  105. package/dist/mcp-chunks/{chunk-WTMJMM3B.js → chunk-D6SVCPN6.js} +3 -30
  106. package/dist/mcp-chunks/chunk-FBVRU4Y3.js +1195 -0
  107. package/dist/mcp-chunks/{chunk-EMSNQHZZ.js → chunk-FONFU4G5.js} +1 -1
  108. package/dist/mcp-chunks/{chunk-BWW4XRUC.js → chunk-H4KL74PV.js} +303 -161
  109. package/dist/mcp-chunks/{chunk-ITR7FQM3.js → chunk-H7ARMBV7.js} +4 -9
  110. package/dist/mcp-chunks/{chunk-EPT4MYOF.js → chunk-HZ2SX5U6.js} +39 -34
  111. package/dist/mcp-chunks/{chunk-36VIJRYY.js → chunk-I6UMKX5E.js} +4 -4
  112. package/dist/mcp-chunks/{chunk-ASG4OY3M.js → chunk-IF6LRV3J.js} +21 -28
  113. package/dist/mcp-chunks/{chunk-KW3ANJ36.js → chunk-JVYCENPP.js} +4 -4
  114. package/dist/mcp-chunks/{chunk-AIKLVBYU.js → chunk-KOWNVUL2.js} +34 -7
  115. package/dist/mcp-chunks/{chunk-B2LNXGAP.js → chunk-KQCLM7R7.js} +4 -4
  116. package/dist/mcp-chunks/{chunk-OP3IW2V6.js → chunk-L6OOGZVA.js} +2 -2
  117. package/dist/mcp-chunks/{chunk-MOEZ43ZL.js → chunk-LCBDVFVA.js} +1 -1
  118. package/dist/mcp-chunks/{chunk-ITCCROID.js → chunk-LIEFPSSB.js} +5 -5
  119. package/dist/mcp-chunks/{chunk-GUXMP7QB.js → chunk-LQIE4PKL.js} +2 -2
  120. package/dist/mcp-chunks/{chunk-WYLHHXI6.js → chunk-LXHPDKEF.js} +26 -11
  121. package/dist/mcp-chunks/{chunk-6YZW3XAE.js → chunk-MJFZM5EV.js} +5 -5
  122. package/dist/mcp-chunks/{chunk-TPHPAEDH.js → chunk-NQW3ES2G.js} +2 -8
  123. package/dist/mcp-chunks/{chunk-IPNSPKQK.js → chunk-O2VOMKAS.js} +15 -17
  124. package/dist/mcp-chunks/{chunk-QZUC2T72.js → chunk-O4JIUOWF.js} +2 -2
  125. package/dist/mcp-chunks/{chunk-C2KNLFZR.js → chunk-P3UVILEW.js} +2 -2
  126. package/dist/mcp-chunks/{chunk-7WOKCV6Q.js → chunk-P463YBJM.js} +1 -1
  127. package/dist/mcp-chunks/{chunk-GQ6NSIDS.js → chunk-PJCMJ65D.js} +1175 -718
  128. package/dist/mcp-chunks/{chunk-CZKDJZER.js → chunk-QALB3DRW.js} +1 -1
  129. package/dist/mcp-chunks/{chunk-JG4TRUPF.js → chunk-QJNF3A3F.js} +1 -1
  130. package/dist/mcp-chunks/{chunk-HLRCUHNO.js → chunk-RIHPVCGI.js} +1 -1
  131. package/dist/mcp-chunks/{chunk-RD7NHCRK.js → chunk-RZIJUJGL.js} +60 -1074
  132. package/dist/mcp-chunks/{chunk-4ZNBWL65.js → chunk-S2YF442K.js} +2 -2
  133. package/dist/mcp-chunks/chunk-S5F3HEZZ.js +37060 -0
  134. package/dist/mcp-chunks/{chunk-TF2YTYE4.js → chunk-S6GJ42I2.js} +1 -1
  135. package/dist/mcp-chunks/chunk-T4MQCFIK.js +982 -0
  136. package/dist/mcp-chunks/{chunk-SCOMDV54.js → chunk-TUQGOYK6.js} +1 -1
  137. package/dist/mcp-chunks/{chunk-YIRGLKDA.js → chunk-TYYSBILI.js} +46 -27
  138. package/dist/mcp-chunks/{chunk-FS5JIKT6.js → chunk-UHO6KIUJ.js} +6 -6
  139. package/dist/mcp-chunks/{chunk-RSTKSBVF.js → chunk-UIPG6W7N.js} +2 -2
  140. package/dist/mcp-chunks/{chunk-IME7DGLJ.js → chunk-UKM35J67.js} +2 -2
  141. package/dist/mcp-chunks/{chunk-FX5NYWBH.js → chunk-UYJZJXC2.js} +3 -3
  142. package/dist/mcp-chunks/{chunk-HCOKLSOB.js → chunk-VJIAHZZG.js} +4 -4
  143. package/dist/mcp-chunks/{chunk-IYWYVHHD.js → chunk-WHJUDBPR.js} +1 -1
  144. package/dist/mcp-chunks/{chunk-53NRFMB3.js → chunk-XNHGMWN2.js} +46 -25
  145. package/dist/mcp-chunks/{cli-XU26MUCN.js → cli-JI7MEAAX.js} +111 -79
  146. package/dist/mcp-chunks/client-QU7ABSNB.js +30 -0
  147. package/dist/mcp-chunks/{config-command-UQMMIK2U.js → config-command-GRZLKD3R.js} +36 -29
  148. package/dist/mcp-chunks/daemon-command-3266CYHO.js +30 -0
  149. package/dist/mcp-chunks/{dist-DM2RXZMU.js → dist-USMCQ22V.js} +105 -47
  150. package/dist/mcp-chunks/{emit-ts-command-KAOL6DAN.js → emit-ts-command-7VLESP7H.js} +20 -19
  151. package/dist/mcp-chunks/{generate-cli-runner-AK6XNRTK.js → generate-cli-runner-SSW2B72K.js} +54 -51
  152. package/dist/mcp-chunks/generated-daemon-runtime-7CFVWLC7.js +30 -0
  153. package/dist/mcp-chunks/{inspect-cli-command-6FVJO7H2.js → inspect-cli-command-NCGCMOIS.js} +9 -10
  154. package/dist/mcp-chunks/{launch-EIT73HX4.js → launch-NBONSPNK.js} +1 -1
  155. package/dist/mcp-chunks/{lifecycle-QH4TUI3K.js → lifecycle-CXAKUCN4.js} +1 -1
  156. package/dist/mcp-chunks/{list-command-UOB2XZK7.js → list-command-5T4UF4PF.js} +61 -75
  157. package/dist/mcp-chunks/{output-utils-6YXH23T7.js → output-utils-YFTWQZ5V.js} +3 -3
  158. package/dist/mcp-chunks/{prompt-CH6TK0bC-ZB6RFAXR.js → prompt-CH6TK0bC-6DI4RA4E.js} +1 -1
  159. package/dist/mcp-chunks/{record-command-FO5TTERC.js → record-command-TE5O7WBL.js} +5 -5
  160. package/dist/mcp-chunks/{replay-command-SCBPCGQ7.js → replay-command-QCUL5ASR.js} +6 -6
  161. package/dist/mcp-chunks/{resource-command-S2J7XEMV.js → resource-command-XMGF7EAK.js} +9 -10
  162. package/dist/mcp-chunks/{result-utils-OME6HGS6.js → result-utils-HKB42M7Y.js} +3 -4
  163. package/dist/mcp-chunks/runtime-3X2XVS6X.js +37 -0
  164. package/dist/mcp-chunks/runtime-wrapper-MI3HF45J.js +10 -0
  165. package/dist/mcp-chunks/{serve-command-DDBZZSG6.js → serve-command-5HV3ZE25.js} +30 -34
  166. package/dist/mcp-chunks/{timeouts-HNGNKDQN.js → timeouts-YBFBTLV2.js} +8 -5
  167. package/dist/mcp-chunks/{vault-command-TJZYS3YI.js → vault-command-FC2PD5U6.js} +4 -6
  168. package/dist/mcp-chunks/webapi-IFUPO72B.js +2481 -0
  169. package/dist/mcp-daemon.js +35 -33
  170. package/dist/mcp-run-worker.js +28 -32
  171. package/dist/pi-extension.d.ts +1 -1
  172. package/dist/pi-extension.js +8 -8
  173. package/dist/pi-extension.js.map +1 -1
  174. package/dist/{recipe-agent.d.ts → recipe/agent.d.ts} +3 -3
  175. package/dist/recipe/agent.d.ts.map +1 -0
  176. package/dist/{recipe-agent.js → recipe/agent.js} +5 -5
  177. package/dist/recipe/agent.js.map +1 -0
  178. package/dist/{recipe-extensions.d.ts → recipe/extensions.d.ts} +1 -1
  179. package/dist/recipe/extensions.d.ts.map +1 -0
  180. package/dist/{recipe-extensions.js → recipe/extensions.js} +1 -1
  181. package/dist/recipe/extensions.js.map +1 -0
  182. package/dist/{recipe-mcp-config.d.ts → recipe/mcp-config.d.ts} +2 -2
  183. package/dist/recipe/mcp-config.d.ts.map +1 -0
  184. package/dist/{recipe-mcp-config.js → recipe/mcp-config.js} +1 -1
  185. package/dist/recipe/mcp-config.js.map +1 -0
  186. package/dist/{recipe-model.d.ts → recipe/model.d.ts} +1 -1
  187. package/dist/recipe/model.d.ts.map +1 -0
  188. package/dist/{recipe-model.js → recipe/model.js} +1 -1
  189. package/dist/recipe/model.js.map +1 -0
  190. package/dist/{recipe-package.d.ts → recipe/package.d.ts} +1 -1
  191. package/dist/recipe/package.d.ts.map +1 -0
  192. package/dist/{recipe-package.js → recipe/package.js} +1 -1
  193. package/dist/recipe/package.js.map +1 -0
  194. package/dist/recipe/resolve.d.ts +6 -6
  195. package/dist/recipe/resolve.d.ts.map +1 -1
  196. package/dist/recipe/resolve.js +4 -4
  197. package/dist/recipe/resolve.js.map +1 -1
  198. package/dist/{recipe-session.d.ts → recipe/session.d.ts} +1 -1
  199. package/dist/recipe/session.d.ts.map +1 -0
  200. package/dist/{recipe-session.js → recipe/session.js} +1 -1
  201. package/dist/recipe/session.js.map +1 -0
  202. package/dist/{recipe-skills.d.ts → recipe/skills.d.ts} +1 -1
  203. package/dist/recipe/skills.d.ts.map +1 -0
  204. package/dist/{recipe-skills.js → recipe/skills.js} +2 -2
  205. package/dist/recipe/skills.js.map +1 -0
  206. package/dist/run-controller.js +2 -2
  207. package/dist/session.d.ts +1 -1
  208. package/dist/session.d.ts.map +1 -1
  209. package/dist/session.js +5 -5
  210. package/dist/session.js.map +1 -1
  211. package/docs/channels.md +1 -1
  212. package/docs/pi-extension.md +1 -1
  213. package/docs/recipe-format.md +8 -4
  214. package/docs/recipe-templates.md +46 -0
  215. package/docs/slack.md +1 -1
  216. package/package.json +14 -14
  217. package/dist/child-agent-completions.d.ts.map +0 -1
  218. package/dist/child-agent-completions.js.map +0 -1
  219. package/dist/child-agent-store.d.ts.map +0 -1
  220. package/dist/child-agent-store.js.map +0 -1
  221. package/dist/child-agent.d.ts.map +0 -1
  222. package/dist/child-agent.js.map +0 -1
  223. package/dist/child-session.d.ts.map +0 -1
  224. package/dist/child-session.js.map +0 -1
  225. package/dist/mcp-catalog.d.ts.map +0 -1
  226. package/dist/mcp-catalog.js.map +0 -1
  227. package/dist/mcp-chunks/call-arguments-4DWPBLQP.js +0 -15
  228. package/dist/mcp-chunks/chunk-3Z7MFS6K.js +0 -86
  229. package/dist/mcp-chunks/chunk-AD3FQ73K.js +0 -39
  230. package/dist/mcp-chunks/chunk-DTZHEVKC.js +0 -12
  231. package/dist/mcp-chunks/chunk-H3JCYHGS.js +0 -1018
  232. package/dist/mcp-chunks/chunk-HN7WPMCA.js +0 -18904
  233. package/dist/mcp-chunks/chunk-I5GI2A2D.js +0 -92
  234. package/dist/mcp-chunks/chunk-IRTJXFWA.js +0 -28
  235. package/dist/mcp-chunks/chunk-NTHUNCXJ.js +0 -526
  236. package/dist/mcp-chunks/chunk-OD3MSMXY.js +0 -15
  237. package/dist/mcp-chunks/chunk-PZ323CXI.js +0 -17394
  238. package/dist/mcp-chunks/client-OT34CKRH.js +0 -21
  239. package/dist/mcp-chunks/daemon-command-YCIOZGPZ.js +0 -35
  240. package/dist/mcp-chunks/runtime-QIPMLIJI.js +0 -39
  241. package/dist/mcp-chunks/runtime-wrapper-X4YFKMJI.js +0 -16
  242. package/dist/mcp-chunks/webapi-4GWO2UBA.js +0 -3508
  243. package/dist/mcp-cli-core.d.ts.map +0 -1
  244. package/dist/mcp-cli-core.js.map +0 -1
  245. package/dist/mcp-cli-help.d.ts +0 -2
  246. package/dist/mcp-cli-help.d.ts.map +0 -1
  247. package/dist/mcp-cli-help.js +0 -36
  248. package/dist/mcp-cli-help.js.map +0 -1
  249. package/dist/mcp-cli-policy.d.ts.map +0 -1
  250. package/dist/mcp-cli-policy.js.map +0 -1
  251. package/dist/mcp-cli.d.ts +0 -3
  252. package/dist/mcp-cli.d.ts.map +0 -1
  253. package/dist/mcp-cli.js.map +0 -1
  254. package/dist/mcp-client.d.ts +0 -3
  255. package/dist/mcp-client.d.ts.map +0 -1
  256. package/dist/mcp-client.js.map +0 -1
  257. package/dist/mcp-command-context.d.ts.map +0 -1
  258. package/dist/mcp-command-context.js.map +0 -1
  259. package/dist/mcp-contract.d.ts.map +0 -1
  260. package/dist/mcp-contract.js.map +0 -1
  261. package/dist/mcp-daemon-client.d.ts.map +0 -1
  262. package/dist/mcp-daemon-client.js.map +0 -1
  263. package/dist/mcp-daemon-protocol.d.ts.map +0 -1
  264. package/dist/mcp-daemon-protocol.js.map +0 -1
  265. package/dist/mcp-daemon.d.ts +0 -3
  266. package/dist/mcp-daemon.d.ts.map +0 -1
  267. package/dist/mcp-policy.d.ts.map +0 -1
  268. package/dist/mcp-policy.js.map +0 -1
  269. package/dist/mcp-run-worker.d.ts +0 -2
  270. package/dist/mcp-run-worker.d.ts.map +0 -1
  271. package/dist/mcp-run-worker.js.map +0 -1
  272. package/dist/mcp-tools.d.ts.map +0 -1
  273. package/dist/mcp-tools.js.map +0 -1
  274. package/dist/mcp-trace-context.d.ts.map +0 -1
  275. package/dist/mcp-trace-context.js.map +0 -1
  276. package/dist/mcp.d.ts.map +0 -1
  277. package/dist/mcp.js.map +0 -1
  278. package/dist/recipe-agent.d.ts.map +0 -1
  279. package/dist/recipe-agent.js.map +0 -1
  280. package/dist/recipe-extensions.d.ts.map +0 -1
  281. package/dist/recipe-extensions.js.map +0 -1
  282. package/dist/recipe-mcp-config.d.ts.map +0 -1
  283. package/dist/recipe-mcp-config.js.map +0 -1
  284. package/dist/recipe-model.d.ts.map +0 -1
  285. package/dist/recipe-model.js.map +0 -1
  286. package/dist/recipe-package.d.ts.map +0 -1
  287. package/dist/recipe-package.js.map +0 -1
  288. package/dist/recipe-session.d.ts.map +0 -1
  289. package/dist/recipe-session.js.map +0 -1
  290. package/dist/recipe-skills.d.ts.map +0 -1
  291. package/dist/recipe-skills.js.map +0 -1
@@ -1,43 +1,79 @@
1
1
  import { createRequire as __createRequire } from "node:module"; const require = __createRequire(import.meta.url);
2
+ import {
3
+ stableJsonStringify
4
+ } from "./chunk-KQCLM7R7.js";
2
5
  import {
3
6
  NON_INTERACTIVE_ELICITATION_HINT,
4
7
  createNonInteractiveElicitationResponder,
5
8
  registerElicitationHandler
6
- } from "./chunk-ZOAQDFAO.js";
9
+ } from "./chunk-D6B2M5V7.js";
7
10
  import {
8
11
  RecordTransport,
9
12
  resolveRecordingPath
10
- } from "./chunk-OP3IW2V6.js";
13
+ } from "./chunk-L6OOGZVA.js";
11
14
  import {
12
15
  OAuthTimeoutError,
13
16
  connectWithAuth,
14
17
  createOAuthSession,
15
18
  isOAuthFlowError,
16
19
  isPostAuthConnectError,
20
+ isUnauthorizedError,
21
+ maybeEnableOAuth,
17
22
  resolveOAuthTimeoutFromEnv
18
- } from "./chunk-YIRGLKDA.js";
23
+ } from "./chunk-TYYSBILI.js";
19
24
  import {
20
25
  readCachedAccessToken
21
- } from "./chunk-ASG4OY3M.js";
26
+ } from "./chunk-IF6LRV3J.js";
22
27
  import {
23
- isUnauthorizedError,
24
- maybeEnableOAuth
25
- } from "./chunk-IRTJXFWA.js";
28
+ withRuntimeEnvironment
29
+ } from "./chunk-XNHGMWN2.js";
30
+ import {
31
+ createPrefixedConsoleLogger,
32
+ resolveLogLevelFromEnv
33
+ } from "./chunk-P463YBJM.js";
26
34
  import {
27
35
  STDIO_TRACE_ENABLED,
28
36
  flushStdioLogs,
29
37
  ignoreStdioEmitterError
30
- } from "./chunk-EMSNQHZZ.js";
38
+ } from "./chunk-FONFU4G5.js";
31
39
  import {
32
40
  MCPORTER_VERSION
33
- } from "./chunk-OD3MSMXY.js";
41
+ } from "./chunk-7PFJCLXL.js";
34
42
  import {
35
- createPrefixedConsoleLogger,
36
- resolveLogLevelFromEnv
37
- } from "./chunk-7WOKCV6Q.js";
43
+ ChromeDevtoolsRelayDiscoveryError,
44
+ ChromeDevtoolsRelayRequiredError,
45
+ chromeDevtoolsRelayEnvironmentKeys,
46
+ formatChromeDevtoolsRelayDecision,
47
+ isExistingChromeDevtoolsCommand,
48
+ normalizeTimeout,
49
+ raceWithTimeout,
50
+ recordChromeDevtoolsRelayDecision,
51
+ resolveChromeDevtoolsAutoConnectCommand,
52
+ resolveChromeDevtoolsRelayEnvironment,
53
+ resolveChromeDevtoolsRelayPolicy,
54
+ resolveChromeDevtoolsRelayProbeTimeoutMs,
55
+ resolveChromeDevtoolsRelayRuntimeIdentity,
56
+ resolveCommandArgument,
57
+ resolveCommandArguments,
58
+ rewriteChromeDevtoolsArgsForRelay
59
+ } from "./chunk-H4KL74PV.js";
60
+ import {
61
+ loadServerDefinitions,
62
+ normalizeServerEntry,
63
+ readConfigFile
64
+ } from "./chunk-RZIJUJGL.js";
65
+ import {
66
+ pathExists
67
+ } from "./chunk-UYJZJXC2.js";
68
+ import {
69
+ mcporterConfigCandidates
70
+ } from "./chunk-UHO6KIUJ.js";
71
+ import {
72
+ resolveEnvPlaceholders
73
+ } from "./chunk-D6SVCPN6.js";
38
74
  import {
39
75
  analyzeConnectionError
40
- } from "./chunk-QZUC2T72.js";
76
+ } from "./chunk-O4JIUOWF.js";
41
77
  import {
42
78
  Client,
43
79
  DEFAULT_REQUEST_TIMEOUT_MSEC,
@@ -50,28 +86,7 @@ import {
50
86
  StreamableHTTPClientTransport,
51
87
  serializeMessage,
52
88
  specTypeSchemas
53
- } from "./chunk-PZ323CXI.js";
54
- import {
55
- ChromeDevtoolsRelayRequiredError,
56
- formatChromeDevtoolsRelayDecision,
57
- recordChromeDevtoolsRelayDecision,
58
- resolveChromeDevtoolsAutoConnectCommand,
59
- resolveChromeDevtoolsRelayEnvironment,
60
- rewriteChromeDevtoolsArgsForRelay
61
- } from "./chunk-BWW4XRUC.js";
62
- import {
63
- normalizeTimeout,
64
- raceWithTimeout,
65
- resolveCommandArgument,
66
- resolveCommandArguments
67
- } from "./chunk-I5GI2A2D.js";
68
- import {
69
- loadServerDefinitions
70
- } from "./chunk-RD7NHCRK.js";
71
- import {
72
- resolveEnvPlaceholders,
73
- withEnvOverrides
74
- } from "./chunk-WTMJMM3B.js";
89
+ } from "./chunk-S5F3HEZZ.js";
75
90
  import {
76
91
  __commonJS,
77
92
  __require,
@@ -83,8 +98,8 @@ var require_windows = __commonJS({
83
98
  "node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/windows.js"(exports, module) {
84
99
  module.exports = isexe;
85
100
  isexe.sync = sync;
86
- var fs5 = __require("fs");
87
- function checkPathExt(path4, options) {
101
+ var fs7 = __require("fs");
102
+ function checkPathExt(path7, options) {
88
103
  var pathext = options.pathExt !== void 0 ? options.pathExt : process.env.PATHEXT;
89
104
  if (!pathext) {
90
105
  return true;
@@ -95,25 +110,25 @@ var require_windows = __commonJS({
95
110
  }
96
111
  for (var i = 0; i < pathext.length; i++) {
97
112
  var p = pathext[i].toLowerCase();
98
- if (p && path4.substr(-p.length).toLowerCase() === p) {
113
+ if (p && path7.substr(-p.length).toLowerCase() === p) {
99
114
  return true;
100
115
  }
101
116
  }
102
117
  return false;
103
118
  }
104
- function checkStat(stat, path4, options) {
119
+ function checkStat(stat, path7, options) {
105
120
  if (!stat.isSymbolicLink() && !stat.isFile()) {
106
121
  return false;
107
122
  }
108
- return checkPathExt(path4, options);
123
+ return checkPathExt(path7, options);
109
124
  }
110
- function isexe(path4, options, cb) {
111
- fs5.stat(path4, function(er, stat) {
112
- cb(er, er ? false : checkStat(stat, path4, options));
125
+ function isexe(path7, options, cb) {
126
+ fs7.stat(path7, function(er, stat) {
127
+ cb(er, er ? false : checkStat(stat, path7, options));
113
128
  });
114
129
  }
115
- function sync(path4, options) {
116
- return checkStat(fs5.statSync(path4), path4, options);
130
+ function sync(path7, options) {
131
+ return checkStat(fs7.statSync(path7), path7, options);
117
132
  }
118
133
  }
119
134
  });
@@ -123,14 +138,14 @@ var require_mode = __commonJS({
123
138
  "node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/mode.js"(exports, module) {
124
139
  module.exports = isexe;
125
140
  isexe.sync = sync;
126
- var fs5 = __require("fs");
127
- function isexe(path4, options, cb) {
128
- fs5.stat(path4, function(er, stat) {
141
+ var fs7 = __require("fs");
142
+ function isexe(path7, options, cb) {
143
+ fs7.stat(path7, function(er, stat) {
129
144
  cb(er, er ? false : checkStat(stat, options));
130
145
  });
131
146
  }
132
- function sync(path4, options) {
133
- return checkStat(fs5.statSync(path4), options);
147
+ function sync(path7, options) {
148
+ return checkStat(fs7.statSync(path7), options);
134
149
  }
135
150
  function checkStat(stat, options) {
136
151
  return stat.isFile() && checkMode(stat, options);
@@ -154,7 +169,7 @@ var require_mode = __commonJS({
154
169
  // node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/index.js
155
170
  var require_isexe = __commonJS({
156
171
  "node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/index.js"(exports, module) {
157
- var fs5 = __require("fs");
172
+ var fs7 = __require("fs");
158
173
  var core;
159
174
  if (process.platform === "win32" || global.TESTING_WINDOWS) {
160
175
  core = require_windows();
@@ -163,7 +178,7 @@ var require_isexe = __commonJS({
163
178
  }
164
179
  module.exports = isexe;
165
180
  isexe.sync = sync;
166
- function isexe(path4, options, cb) {
181
+ function isexe(path7, options, cb) {
167
182
  if (typeof options === "function") {
168
183
  cb = options;
169
184
  options = {};
@@ -173,7 +188,7 @@ var require_isexe = __commonJS({
173
188
  throw new TypeError("callback not provided");
174
189
  }
175
190
  return new Promise(function(resolve, reject) {
176
- isexe(path4, options || {}, function(er, is) {
191
+ isexe(path7, options || {}, function(er, is) {
177
192
  if (er) {
178
193
  reject(er);
179
194
  } else {
@@ -182,7 +197,7 @@ var require_isexe = __commonJS({
182
197
  });
183
198
  });
184
199
  }
185
- core(path4, options || {}, function(er, is) {
200
+ core(path7, options || {}, function(er, is) {
186
201
  if (er) {
187
202
  if (er.code === "EACCES" || options && options.ignoreErrors) {
188
203
  er = null;
@@ -192,9 +207,9 @@ var require_isexe = __commonJS({
192
207
  cb(er, is);
193
208
  });
194
209
  }
195
- function sync(path4, options) {
210
+ function sync(path7, options) {
196
211
  try {
197
- return core.sync(path4, options || {});
212
+ return core.sync(path7, options || {});
198
213
  } catch (er) {
199
214
  if (options && options.ignoreErrors || er.code === "EACCES") {
200
215
  return false;
@@ -210,7 +225,7 @@ var require_isexe = __commonJS({
210
225
  var require_which = __commonJS({
211
226
  "node_modules/.pnpm/which@2.0.2/node_modules/which/which.js"(exports, module) {
212
227
  var isWindows = process.platform === "win32" || process.env.OSTYPE === "cygwin" || process.env.OSTYPE === "msys";
213
- var path4 = __require("path");
228
+ var path7 = __require("path");
214
229
  var COLON = isWindows ? ";" : ":";
215
230
  var isexe = require_isexe();
216
231
  var getNotFoundError = (cmd) => Object.assign(new Error(`not found: ${cmd}`), { code: "ENOENT" });
@@ -248,7 +263,7 @@ var require_which = __commonJS({
248
263
  return opt.all && found.length ? resolve(found) : reject(getNotFoundError(cmd));
249
264
  const ppRaw = pathEnv[i];
250
265
  const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
251
- const pCmd = path4.join(pathPart, cmd);
266
+ const pCmd = path7.join(pathPart, cmd);
252
267
  const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
253
268
  resolve(subStep(p, i, 0));
254
269
  });
@@ -275,7 +290,7 @@ var require_which = __commonJS({
275
290
  for (let i = 0; i < pathEnv.length; i++) {
276
291
  const ppRaw = pathEnv[i];
277
292
  const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
278
- const pCmd = path4.join(pathPart, cmd);
293
+ const pCmd = path7.join(pathPart, cmd);
279
294
  const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
280
295
  for (let j = 0; j < pathExt.length; j++) {
281
296
  const cur = p + pathExt[j];
@@ -323,7 +338,7 @@ var require_path_key = __commonJS({
323
338
  var require_resolveCommand = __commonJS({
324
339
  "node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/resolveCommand.js"(exports, module) {
325
340
  "use strict";
326
- var path4 = __require("path");
341
+ var path7 = __require("path");
327
342
  var which = require_which();
328
343
  var getPathKey = require_path_key();
329
344
  function resolveCommandAttempt(parsed, withoutPathExt) {
@@ -341,7 +356,7 @@ var require_resolveCommand = __commonJS({
341
356
  try {
342
357
  resolved = which.sync(parsed.command, {
343
358
  path: env[getPathKey({ env })],
344
- pathExt: withoutPathExt ? path4.delimiter : void 0
359
+ pathExt: withoutPathExt ? path7.delimiter : void 0
345
360
  });
346
361
  } catch (e) {
347
362
  } finally {
@@ -350,7 +365,7 @@ var require_resolveCommand = __commonJS({
350
365
  }
351
366
  }
352
367
  if (resolved) {
353
- resolved = path4.resolve(hasCustomCwd ? parsed.options.cwd : "", resolved);
368
+ resolved = path7.resolve(hasCustomCwd ? parsed.options.cwd : "", resolved);
354
369
  }
355
370
  return resolved;
356
371
  }
@@ -404,8 +419,8 @@ var require_shebang_command = __commonJS({
404
419
  if (!match) {
405
420
  return null;
406
421
  }
407
- const [path4, argument] = match[0].replace(/#! ?/, "").split(" ");
408
- const binary = path4.split("/").pop();
422
+ const [path7, argument] = match[0].replace(/#! ?/, "").split(" ");
423
+ const binary = path7.split("/").pop();
409
424
  if (binary === "env") {
410
425
  return argument;
411
426
  }
@@ -418,16 +433,16 @@ var require_shebang_command = __commonJS({
418
433
  var require_readShebang = __commonJS({
419
434
  "node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/readShebang.js"(exports, module) {
420
435
  "use strict";
421
- var fs5 = __require("fs");
436
+ var fs7 = __require("fs");
422
437
  var shebangCommand = require_shebang_command();
423
438
  function readShebang(command) {
424
439
  const size = 150;
425
440
  const buffer = Buffer.alloc(size);
426
441
  let fd;
427
442
  try {
428
- fd = fs5.openSync(command, "r");
429
- fs5.readSync(fd, buffer, 0, size, 0);
430
- fs5.closeSync(fd);
443
+ fd = fs7.openSync(command, "r");
444
+ fs7.readSync(fd, buffer, 0, size, 0);
445
+ fs7.closeSync(fd);
431
446
  } catch (e) {
432
447
  }
433
448
  return shebangCommand(buffer.toString());
@@ -440,7 +455,7 @@ var require_readShebang = __commonJS({
440
455
  var require_parse = __commonJS({
441
456
  "node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/parse.js"(exports, module) {
442
457
  "use strict";
443
- var path4 = __require("path");
458
+ var path7 = __require("path");
444
459
  var resolveCommand = require_resolveCommand();
445
460
  var escape = require_escape();
446
461
  var readShebang = require_readShebang();
@@ -465,7 +480,7 @@ var require_parse = __commonJS({
465
480
  const needsShell = !isExecutableRegExp.test(commandFile);
466
481
  if (parsed.options.forceShell || needsShell) {
467
482
  const needsDoubleEscapeMetaChars = isCmdShimRegExp.test(commandFile);
468
- parsed.command = path4.normalize(parsed.command);
483
+ parsed.command = path7.normalize(parsed.command);
469
484
  parsed.command = escape.command(parsed.command);
470
485
  parsed.args = parsed.args.map((arg) => escape.argument(arg, needsDoubleEscapeMetaChars));
471
486
  const shellCommand = [parsed.command].concat(parsed.args).join(" ");
@@ -575,142 +590,719 @@ var require_cross_spawn = __commonJS({
575
590
  }
576
591
  });
577
592
 
578
- // node_modules/.pnpm/mcporter@0.13.8/node_modules/mcporter/dist/runtime-process-utils.js
579
- import { execFile } from "node:child_process";
580
- async function closeTransportAndWait(logger, transport, options = {}) {
581
- const pidBeforeClose = getTransportPid(transport);
582
- const targetsBeforeClose = pidBeforeClose ? await collectProcessTreePids(pidBeforeClose) : [];
583
- let closeError;
584
- let closeSettled = false;
585
- const closePromise = (options.close ?? (() => transport.close()))().catch((error) => {
586
- closeError = error;
587
- if (!options.throwOnCloseError) {
588
- logger.warn(`Failed to close transport cleanly: ${error.message}`);
589
- }
590
- }).finally(() => {
591
- closeSettled = true;
592
- });
593
- if (pidBeforeClose) {
594
- destroyTransportStreams(transport);
595
- await ensureProcessTreeTerminated(logger, pidBeforeClose, targetsBeforeClose);
596
- if (!closeSettled) {
597
- await Promise.race([closePromise, delay(100)]);
598
- }
599
- } else {
600
- await closePromise;
601
- }
602
- if (closeError && options.throwOnCloseError) {
603
- throw closeError;
604
- }
605
- }
606
- function getTransportPid(transport) {
607
- if ("pid" in transport) {
608
- const candidate = transport.pid;
609
- if (typeof candidate === "number" && candidate > 0) {
610
- return candidate;
593
+ // node_modules/.pnpm/mcporter@0.13.13/node_modules/mcporter/dist/daemon/connection-identity.js
594
+ import { createHash } from "node:crypto";
595
+ import fs from "node:fs/promises";
596
+ import path from "node:path";
597
+ var BROKER_ENV = /* @__PURE__ */ new Set([
598
+ "MCPORTER_DAEMON_DIR",
599
+ "MCPORTER_DAEMON_CHILD",
600
+ "MCPORTER_DAEMON_SOCKET",
601
+ "MCPORTER_DAEMON_METADATA",
602
+ "MCPORTER_CONFIG",
603
+ "MCPORTER_DISABLE_AUTORUN",
604
+ "MCPORTER_DAEMON_LOG",
605
+ "MCPORTER_DAEMON_LOG_PATH",
606
+ "MCPORTER_DAEMON_LOG_SERVERS",
607
+ "MCPORTER_NO_FORCE_EXIT"
608
+ ]);
609
+ async function effectiveDefinition(definition, inherited = process.env, purpose = "connection") {
610
+ const env = Object.fromEntries(Object.entries(resolveChromeDevtoolsRelayEnvironment(definition.env, inherited)).filter(([key, value]) => value !== void 0 && !BROKER_ENV.has(key)));
611
+ const configuredEnv = Object.fromEntries(Object.keys(definition.env ?? {}).filter((key) => !BROKER_ENV.has(key)).map((key) => [key, env[key] ?? ""]));
612
+ normalizeChromeEnvironment(definition, env);
613
+ const chrome = isExistingChromeDefinition(definition, env);
614
+ const launchCommand = definition.command.kind === "stdio" ? resolveCommandArgument(definition.command.command, env) : void 0;
615
+ const command = definition.command.kind === "stdio" ? {
616
+ ...definition.command,
617
+ command: chrome && purpose === "view" ? launchCommand : await resolveExecutable(launchCommand, env, definition.command.cwd),
618
+ args: resolveCommandArguments(definition.command.args, env),
619
+ cwd: await fs.realpath(definition.command.cwd)
620
+ } : { ...definition.command, url: new URL(definition.command.url) };
621
+ if (command.kind === "stdio") {
622
+ if (!Object.hasOwn(configuredEnv, "PWD"))
623
+ env.PWD = command.cwd;
624
+ if (!Object.hasOwn(configuredEnv, "SHLVL"))
625
+ delete env.SHLVL;
626
+ }
627
+ return { ...definition, command, env, configuredEnv, ...chrome ? { launchCommand } : {} };
628
+ }
629
+ function normalizeChromeEnvironment(definition, env) {
630
+ if (isExistingChromeDefinition(definition, env)) {
631
+ env.MCPORTER_CHROME_DEVTOOLS_RELAY_POLICY = resolveChromeDevtoolsRelayPolicy(definition.chromeDevtoolsRelay, env);
632
+ env.MCPORTER_CHROME_DEVTOOLS_RELAY_TIMEOUT_MS = String(resolveChromeDevtoolsRelayProbeTimeoutMs(env));
633
+ delete env.MCPORTER_DISABLE_CHROME_DEVTOOLS_RELAY;
634
+ if (!env.OPENCLAW_PROFILE?.trim() || env.OPENCLAW_PROFILE.trim() === "default")
635
+ delete env.OPENCLAW_PROFILE;
636
+ if (env.MCPORTER_CHROME_DEVTOOLS_RELAY_URL?.trim())
637
+ env.MCPORTER_CHROME_DEVTOOLS_RELAY_URL = new URL(env.MCPORTER_CHROME_DEVTOOLS_RELAY_URL.trim()).toString();
638
+ else
639
+ delete env.MCPORTER_CHROME_DEVTOOLS_RELAY_URL;
640
+ }
641
+ }
642
+ async function resolveExecutable(command, env, cwd) {
643
+ const roots = /[/\\]/.test(command) ? [path.resolve(cwd, command)] : (env.PATH ?? env.Path ?? "").split(path.delimiter).map((dir) => path.resolve(cwd, dir, command));
644
+ const extensions = process.platform === "win32" && !path.extname(command) ? ["", ...(env.PATHEXT ?? ".COM;.EXE;.BAT;.CMD").split(";")] : [""];
645
+ const candidates = roots.flatMap((root) => extensions.map((extension) => root + extension));
646
+ for (const candidate of candidates) {
647
+ try {
648
+ await fs.access(candidate, fs.constants.X_OK);
649
+ return path.join(await fs.realpath(path.dirname(candidate)), path.basename(candidate));
650
+ } catch {
611
651
  }
612
652
  }
613
- return null;
653
+ throw new Error("Unable to resolve configured executable from the effective PATH.");
654
+ }
655
+ function connectionIdentity(definition) {
656
+ const { name, description: _description, source: _source, sources: _sources, allowedTools: _allowed, blockedTools: _blocked, lifecycle: _lifecycle, configuredEnv: _configuredEnv, launchCommand: _launchCommand, logging: _logging, ...connection } = definition;
657
+ const credentialOwner = definition.auth || definition.command.kind === "http" ? name : void 0;
658
+ const env = { ...definition.env };
659
+ const chrome = isExistingChromeDefinition(definition);
660
+ if (chrome) {
661
+ env.MCPORTER_CHROME_DEVTOOLS_RELAY_POLICY = resolveChromeDevtoolsRelayPolicy(definition.chromeDevtoolsRelay, env);
662
+ delete env.MCPORTER_DISABLE_CHROME_DEVTOOLS_RELAY;
663
+ env.MCPORTER_CHROME_DEVTOOLS_RELAY_TIMEOUT_MS = String(resolveChromeDevtoolsRelayProbeTimeoutMs(env));
664
+ }
665
+ return createHash("sha256").update(stableJsonStringify({
666
+ ...connection,
667
+ env,
668
+ credentialOwner,
669
+ idleTimeoutMs: !chrome && definition.lifecycle?.mode === "keep-alive" ? definition.lifecycle.idleTimeoutMs : void 0,
670
+ protocolVersion: definition.protocolVersion ?? "auto",
671
+ httpFetch: definition.httpFetch ?? "default",
672
+ chromeDevtoolsRelay: chrome ? env.MCPORTER_CHROME_DEVTOOLS_RELAY_POLICY : void 0
673
+ })).digest("hex");
674
+ }
675
+ function isExistingChromeDefinition(definition, env) {
676
+ if (definition.command.kind !== "stdio")
677
+ return false;
678
+ const effectiveEnv = env ?? resolveChromeDevtoolsRelayEnvironment(definition.env);
679
+ const command = resolveCommandArgument(definition.command.command, effectiveEnv);
680
+ const args = resolveCommandArguments(definition.command.args, effectiveEnv);
681
+ return [definition.name, command, ...args].some((value) => /chrome[-_]devtools(?:[-_]mcp)?/i.test(value)) && isExistingChromeDevtoolsCommand(command, args);
614
682
  }
615
- function isProcessAlive(pid) {
683
+
684
+ // node_modules/.pnpm/mcporter@0.13.13/node_modules/mcporter/dist/daemon/browser-owner.js
685
+ import os3 from "node:os";
686
+ import path4 from "node:path";
687
+
688
+ // node_modules/.pnpm/mcporter@0.13.13/node_modules/mcporter/dist/daemon/paths.js
689
+ import fs3 from "node:fs/promises";
690
+ import { constants } from "node:fs";
691
+ import { createHash as createHash2 } from "node:crypto";
692
+
693
+ // node_modules/.pnpm/mcporter@0.13.13/node_modules/mcporter/dist/chrome-devtools-relay-handoff.js
694
+ import { spawnSync } from "node:child_process";
695
+ import { randomBytes } from "node:crypto";
696
+ import fs2 from "node:fs";
697
+ import os from "node:os";
698
+ import path2 from "node:path";
699
+ import { pathToFileURL } from "node:url";
700
+ var CHROME_RELAY_HANDOFF_ENV = "MCPORTER_CHROME_RELAY_HANDOFF_PATH";
701
+ var HANDOFF_DIR_PREFIX = "mcporter-chrome-relay-";
702
+ var HANDOFF_FILENAME = "headers.json";
703
+ var PRELOAD_FILENAME = "preload.mjs";
704
+ var WINDOWS_ACL_PATH_ENV = "MCPORTER_CHROME_RELAY_ACL_PATH";
705
+ function createChromeDevtoolsRelayHandoff(env, clientAuthorization) {
706
+ let directory;
616
707
  try {
617
- process.kill(pid, 0);
618
- return true;
619
- } catch {
620
- return false;
708
+ if (process.platform === "win32")
709
+ directory = createWindowsHandoffDirectory();
710
+ else {
711
+ directory = fs2.mkdtempSync(path2.join(os.tmpdir(), HANDOFF_DIR_PREFIX));
712
+ fs2.chmodSync(directory, 448);
713
+ }
714
+ assertSecurePath(directory, "directory");
715
+ const handoffPath = path2.join(directory, HANDOFF_FILENAME);
716
+ const preloadPath = path2.join(directory, PRELOAD_FILENAME);
717
+ writeExclusiveFile(preloadPath, renderChromeDevtoolsRelayPreloadSource());
718
+ writeExclusiveFile(handoffPath, JSON.stringify({ Authorization: clientAuthorization }));
719
+ const importFlag = `--import=${pathToFileURL(preloadPath).href}`;
720
+ const existingOptions = env.NODE_OPTIONS?.trim();
721
+ let closed = false;
722
+ return {
723
+ env: {
724
+ ...env,
725
+ NODE_OPTIONS: existingOptions ? `${existingOptions} ${importFlag}` : importFlag,
726
+ [CHROME_RELAY_HANDOFF_ENV]: handoffPath
727
+ },
728
+ handoffPath,
729
+ preloadPath,
730
+ async close() {
731
+ if (closed)
732
+ return;
733
+ closed = true;
734
+ cleanupHandoff(directory, handoffPath, preloadPath);
735
+ }
736
+ };
737
+ } catch (error) {
738
+ if (directory)
739
+ cleanupHandoff(directory, path2.join(directory, HANDOFF_FILENAME), path2.join(directory, PRELOAD_FILENAME));
740
+ const diagnostic = error instanceof Error && error.message.startsWith("Windows ACL setup failed:") ? ` ${error.message}` : "";
741
+ throw new Error(`Unable to install secure Chrome relay authorization handoff.${diagnostic}`, { cause: error });
621
742
  }
622
743
  }
623
- async function ensureProcessTreeTerminated(logger, rootPid, capturedTargets = []) {
624
- let targets = uniquePids([...capturedTargets, ...await collectProcessTreePids(rootPid)]);
625
- if (targets.length === 0 || await waitForTreeExit(targets, 700)) {
626
- return;
627
- }
628
- await sendSignalToTargets(targets, "SIGTERM");
629
- targets = uniquePids([...targets, ...await collectProcessTreePids(rootPid)]);
630
- if (await waitForTreeExit(targets, 700)) {
631
- return;
632
- }
633
- targets = uniquePids([...targets, ...await collectProcessTreePids(rootPid)]);
634
- await sendSignalToTargets(targets, "SIGKILL");
635
- if (await waitForTreeExit(targets, 500)) {
636
- return;
637
- }
638
- logger.warn(`Process tree rooted at pid=${rootPid} did not exit after SIGKILL.`);
744
+ function createWindowsHandoffDirectory() {
745
+ const directory = path2.join(os.tmpdir(), `${HANDOFF_DIR_PREFIX}${randomBytes(16).toString("hex")}`);
746
+ ensureWindowsPrivateDirectory(directory);
747
+ return directory;
639
748
  }
640
- function uniquePids(pids) {
641
- return [...new Set(pids.filter((pid) => Number.isInteger(pid) && pid > 0))];
749
+ function ensureWindowsPrivateDirectory(directory, allowExisting = false) {
750
+ const script = String.raw`
751
+ $ErrorActionPreference = 'Stop'
752
+ $stage = 'identity'
753
+ try {
754
+ $target = $env:${WINDOWS_ACL_PATH_ENV}
755
+ ${allowExisting ? "" : "if ([System.IO.Directory]::Exists($target)) { throw 'handoff path already exists' }"}
756
+ if ([System.IO.Directory]::Exists($target) -and (([System.IO.File]::GetAttributes($target) -band [System.IO.FileAttributes]::ReparsePoint) -ne 0)) { throw 'unsafe reparse point' }
757
+ $sid = [System.Security.Principal.WindowsIdentity]::GetCurrent().User
758
+ $stage = 'descriptor'
759
+ $security = New-Object System.Security.AccessControl.DirectorySecurity
760
+ $sidValue = $sid.Value
761
+ $security.SetSecurityDescriptorSddlForm("O:$($sidValue)G:$($sidValue)D:P(A;OICI;FA;;;$($sidValue))")
762
+ $directory = New-Object System.IO.DirectoryInfo -ArgumentList @($target)
763
+ $stage = 'create'
764
+ $directory.Create($security)
765
+ $stage = 'acl-read'
766
+ $check = $directory.GetAccessControl([System.Security.AccessControl.AccessControlSections]::All)
767
+ $rules = @($check.GetAccessRules($true, $true, [System.Security.Principal.SecurityIdentifier]))
768
+ $ownerSid = $check.GetOwner([System.Security.Principal.SecurityIdentifier]).Value
769
+ $stage = 'acl-verify'
770
+ if (-not $check.AreAccessRulesProtected -or $ownerSid -ne $sid.Value -or $rules.Count -ne 1) { throw 'unsafe ACL' }
771
+ $ruleSid = $rules[0].IdentityReference.Value
772
+ $hasFullControl = ($rules[0].FileSystemRights -band [System.Security.AccessControl.FileSystemRights]::FullControl) -eq [System.Security.AccessControl.FileSystemRights]::FullControl
773
+ if ($ruleSid -ne $sid.Value -or $rules[0].IsInherited -or -not $hasFullControl -or $rules[0].AccessControlType -ne [System.Security.AccessControl.AccessControlType]::Allow) { throw 'unsafe ACL' }
774
+ } catch {
775
+ $type = $_.Exception.GetType().FullName
776
+ $hresult = ('0x{0:X8}' -f ($_.Exception.HResult -band 0xffffffffL))
777
+ [Console]::Error.WriteLine("stage=$stage type=$type hresult=$hresult")
778
+ exit 1
642
779
  }
643
- function destroyTransportStreams(transport) {
644
- const candidate = transport;
645
- for (const key of ["stdin", "stdout", "stderr"]) {
780
+ `;
781
+ const result = spawnSync(resolveSystemPowerShellPath(), ["-NoLogo", "-NoProfile", "-NonInteractive", "-Command", script], {
782
+ encoding: "utf8",
783
+ env: { ...process.env, [WINDOWS_ACL_PATH_ENV]: directory },
784
+ stdio: ["ignore", "ignore", "pipe"],
785
+ windowsHide: true
786
+ });
787
+ if (result.status !== 0) {
646
788
  try {
647
- const stream = candidate[key];
648
- stream?.destroy?.();
789
+ if (!allowExisting)
790
+ fs2.rmdirSync(directory);
649
791
  } catch {
650
792
  }
793
+ const stderr = typeof result.stderr === "string" ? result.stderr.trim() : "";
794
+ const safeDetail = /^[A-Za-z0-9_.:=\- ]{1,240}$/u.test(stderr) ? stderr : `stage=spawn type=${result.error?.code ?? "unknown"} hresult=unknown`;
795
+ throw new Error(`Windows ACL setup failed: ${safeDetail}`);
651
796
  }
652
797
  }
653
- async function sendSignalToTargets(pids, signal) {
654
- const seen = /* @__PURE__ */ new Set();
655
- for (const pid of pids) {
656
- if (seen.has(pid)) {
657
- continue;
658
- }
659
- seen.add(pid);
660
- sendSignal(pid, signal);
661
- }
798
+ function resolveSystemPowerShellPath() {
799
+ const systemRoot = process.env.SystemRoot?.trim() || process.env.WINDIR?.trim();
800
+ if (!systemRoot || !path2.win32.isAbsolute(systemRoot))
801
+ throw new Error("unsafe Windows system root");
802
+ const executable = path2.win32.join(systemRoot, "System32", "WindowsPowerShell", "v1.0", "powershell.exe");
803
+ const stat = fs2.lstatSync(executable);
804
+ if (!stat.isFile() || stat.isSymbolicLink())
805
+ throw new Error("unsafe Windows PowerShell path");
806
+ return executable;
662
807
  }
663
- function sendSignal(pid, signal) {
808
+ function writeExclusiveFile(filePath, contents) {
809
+ const descriptor = fs2.openSync(filePath, fs2.constants.O_WRONLY | fs2.constants.O_CREAT | fs2.constants.O_EXCL | (fs2.constants.O_NOFOLLOW ?? 0), 384);
664
810
  try {
665
- process.kill(pid, signal);
666
- } catch (error) {
667
- if (typeof error === "object" && error && "code" in error && error.code === "ESRCH") {
668
- return;
669
- }
670
- throw error;
811
+ if (process.platform !== "win32")
812
+ fs2.fchmodSync(descriptor, 384);
813
+ fs2.writeFileSync(descriptor, contents, "utf8");
814
+ } finally {
815
+ fs2.closeSync(descriptor);
671
816
  }
817
+ assertSecurePath(filePath, "file");
672
818
  }
673
- async function listDescendantPids(rootPid) {
674
- if (!isProcessAlive(rootPid)) {
675
- return [];
676
- }
677
- if (process.platform === "win32") {
678
- return listDescendantPidsWindows(rootPid);
819
+ function assertSecurePath(filePath, kind) {
820
+ const stat = fs2.lstatSync(filePath);
821
+ if ((kind === "directory" ? !stat.isDirectory() : !stat.isFile()) || stat.isSymbolicLink())
822
+ throw new Error("unsafe");
823
+ if (process.platform === "win32")
824
+ return;
825
+ if ((stat.mode & 63) !== 0)
826
+ throw new Error("unsafe");
827
+ if (typeof process.getuid === "function" && stat.uid !== process.getuid())
828
+ throw new Error("unsafe");
829
+ }
830
+ function cleanupHandoff(directory, handoffPath, preloadPath) {
831
+ for (const filePath of [handoffPath, preloadPath]) {
832
+ try {
833
+ fs2.unlinkSync(filePath);
834
+ } catch {
835
+ }
679
836
  }
680
837
  try {
681
- const { stdout } = await execFileAsync("ps", ["-eo", "pid=,ppid="]);
682
- const children = /* @__PURE__ */ new Map();
683
- for (const line of stdout.split("\n")) {
684
- const trimmed = line.trim();
685
- if (!trimmed) {
686
- continue;
687
- }
688
- const [pidText, ppidText] = trimmed.split(/\s+/, 2);
689
- const pid = Number.parseInt(pidText ?? "", 10);
690
- const ppid = Number.parseInt(ppidText ?? "", 10);
691
- if (!Number.isFinite(pid) || !Number.isFinite(ppid)) {
692
- continue;
693
- }
694
- const bucket = children.get(ppid) ?? [];
695
- bucket.push(pid);
696
- children.set(ppid, bucket);
697
- }
698
- return collectDescendantsFromChildren(rootPid, children);
838
+ fs2.rmdirSync(directory);
699
839
  } catch {
700
- return [];
701
840
  }
702
841
  }
703
- async function listDescendantPidsWindows(rootPid) {
704
- try {
705
- const powershellScript = "Get-CimInstance Win32_Process | Select-Object ProcessId,ParentProcessId | ConvertTo-Json -Compress";
706
- const { stdout } = await execFileAsync("powershell.exe", ["-NoProfile", "-Command", powershellScript]);
707
- const trimmed = stdout.trim();
708
- if (!trimmed) {
709
- return [];
710
- }
711
- const parsed = JSON.parse(trimmed);
712
- const entries = Array.isArray(parsed) ? parsed : [parsed];
713
- const children = /* @__PURE__ */ new Map();
842
+ function renderChromeDevtoolsRelayPreloadSource() {
843
+ return `import fs from 'node:fs';
844
+ import path from 'node:path';
845
+
846
+ const targetPath = process.argv[1]?.replaceAll('\\\\', '/').toLowerCase();
847
+ if (targetPath?.includes('chrome-devtools-mcp')) {
848
+ const failureMessage = 'MCPorter Chrome relay authorization handoff unavailable.';
849
+ const fail = () => {
850
+ throw new Error(failureMessage);
851
+ };
852
+ const envName = ${JSON.stringify(CHROME_RELAY_HANDOFF_ENV)};
853
+ const handoffPath = process.env[envName];
854
+ delete process.env[envName];
855
+ if (!handoffPath || !path.isAbsolute(handoffPath)) fail();
856
+
857
+ const directoryStat = (() => {
858
+ try {
859
+ return fs.lstatSync(path.dirname(handoffPath));
860
+ } catch {
861
+ return fail();
862
+ }
863
+ })();
864
+ if (!directoryStat.isDirectory() || directoryStat.isSymbolicLink()) fail();
865
+ if (process.platform !== 'win32') {
866
+ if ((directoryStat.mode & 0o077) !== 0) fail();
867
+ if (typeof process.getuid === 'function' && directoryStat.uid !== process.getuid()) fail();
868
+ }
869
+
870
+ const descriptor = (() => {
871
+ try {
872
+ return fs.openSync(handoffPath, fs.constants.O_RDONLY | (fs.constants.O_NOFOLLOW ?? 0));
873
+ } catch {
874
+ return fail();
875
+ }
876
+ })();
877
+
878
+ let raw = '';
879
+ let consumed = false;
880
+ try {
881
+ const stat = fs.fstatSync(descriptor);
882
+ if (!stat.isFile() || stat.size <= 0 || stat.size > 4_096) fail();
883
+ if (process.platform !== 'win32') {
884
+ if ((stat.mode & 0o077) !== 0) fail();
885
+ if (typeof process.getuid === 'function' && stat.uid !== process.getuid()) fail();
886
+ }
887
+ raw = fs.readFileSync(descriptor, 'utf8');
888
+ try {
889
+ fs.unlinkSync(handoffPath);
890
+ consumed = true;
891
+ } catch {
892
+ try {
893
+ fs.ftruncateSync(descriptor, 0);
894
+ consumed = true;
895
+ } catch {
896
+ fail();
897
+ }
898
+ }
899
+ } finally {
900
+ fs.closeSync(descriptor);
901
+ }
902
+ if (!consumed) fail();
903
+
904
+ let parsed;
905
+ try {
906
+ parsed = JSON.parse(raw);
907
+ } catch {
908
+ fail();
909
+ }
910
+ if (!parsed || typeof parsed !== 'object' || Array.isArray(parsed)) fail();
911
+ const entries = Object.entries(parsed);
912
+ if (entries.length !== 1 || entries[0]?.[0] !== 'Authorization') fail();
913
+ const authorization = entries[0]?.[1];
914
+ if (typeof authorization !== 'string' || !/^Bearer [A-Za-z0-9_-]{43}$/u.test(authorization)) fail();
915
+
916
+ const terminatorIndex = process.argv.indexOf('--', 2);
917
+ const insertionIndex = terminatorIndex >= 0 ? terminatorIndex : process.argv.length;
918
+ process.argv.splice(insertionIndex, 0, '--wsHeaders', JSON.stringify({ Authorization: authorization }));
919
+ }
920
+ `;
921
+ }
922
+
923
+ // node_modules/.pnpm/mcporter@0.13.13/node_modules/mcporter/dist/daemon/paths.js
924
+ import os2 from "node:os";
925
+ import path3 from "node:path";
926
+ function daemonBaseDir() {
927
+ const override = process.env.MCPORTER_DAEMON_DIR?.trim();
928
+ if (override)
929
+ return path3.resolve(override);
930
+ return path3.join(os2.userInfo().homedir, ".mcporter");
931
+ }
932
+ function daemonRunDir() {
933
+ return path3.join(daemonBaseDir(), "daemon");
934
+ }
935
+ var verifiedWindowsDirectory;
936
+ async function secureDaemonDirectory() {
937
+ if (process.platform === "win32") {
938
+ const directory = daemonRunDir();
939
+ const previous = await fs3.lstat(directory).catch((error) => {
940
+ if (error.code !== "ENOENT")
941
+ throw error;
942
+ return void 0;
943
+ });
944
+ await verifyWindowsDaemonDirectory(directory, previous);
945
+ return;
946
+ }
947
+ await fs3.mkdir(daemonRunDir(), { recursive: true, mode: 448 });
948
+ assertPosixDaemonDirectory(await fs3.lstat(daemonRunDir()), false);
949
+ }
950
+ async function verifyWindowsDaemonDirectory(directory, previous) {
951
+ if (previous && (!previous.isDirectory() || previous.isSymbolicLink()))
952
+ throw new Error("Unsafe daemon directory.");
953
+ if (verifiedWindowsDirectory?.path !== directory || !previous || previous.dev !== verifiedWindowsDirectory.dev || previous.ino !== verifiedWindowsDirectory.ino || previous.birthtimeMs !== verifiedWindowsDirectory.birthtimeMs) {
954
+ ensureWindowsPrivateDirectory(directory, true);
955
+ const info = await fs3.lstat(directory);
956
+ if (!info.isDirectory() || info.isSymbolicLink())
957
+ throw new Error("Unsafe daemon directory.");
958
+ verifiedWindowsDirectory = { path: directory, dev: info.dev, ino: info.ino, birthtimeMs: info.birthtimeMs };
959
+ }
960
+ }
961
+ function assertPosixDaemonDirectory(info, allowLegacy) {
962
+ if (info.isDirectory() && !info.isSymbolicLink() && info.uid === process.getuid?.()) {
963
+ const mode = info.mode & 4095;
964
+ if (mode === 448 || allowLegacy && mode === 493)
965
+ return;
966
+ if (mode === 493)
967
+ throw new Error("Legacy daemon directory has mode 0755. Inspect with daemon migrate; after draining all old clients, run daemon migrate --stop-legacy --confirmed-drained to upgrade it to mode 0700.");
968
+ }
969
+ throw new Error("Daemon directory must be a current-user-owned directory (mode 0700), without symlinks.");
970
+ }
971
+ async function inspectLegacyDaemonDirectory(directory) {
972
+ const info = await fs3.lstat(directory).catch((error) => {
973
+ if (error.code !== "ENOENT")
974
+ throw error;
975
+ return void 0;
976
+ });
977
+ if (!info)
978
+ return false;
979
+ if (process.platform === "win32") {
980
+ await verifyWindowsDaemonDirectory(directory, info);
981
+ } else
982
+ assertPosixDaemonDirectory(info, true);
983
+ return true;
984
+ }
985
+ async function upgradeLegacyDaemonDirectory(directory) {
986
+ if (!await inspectLegacyDaemonDirectory(directory) || process.platform === "win32")
987
+ return;
988
+ const before = await fs3.lstat(directory);
989
+ assertPosixDaemonDirectory(before, true);
990
+ const handle = await fs3.open(directory, constants.O_RDONLY | constants.O_DIRECTORY | constants.O_NOFOLLOW);
991
+ const assertIdentity = (info) => {
992
+ assertPosixDaemonDirectory(info, true);
993
+ if (info.dev !== before.dev || info.ino !== before.ino)
994
+ throw new Error("Daemon directory changed during migration; inspect it before retrying.");
995
+ };
996
+ try {
997
+ const opened = await handle.stat();
998
+ assertIdentity(opened);
999
+ assertIdentity(await fs3.lstat(directory));
1000
+ if ((opened.mode & 4095) === 493)
1001
+ await handle.chmod(448);
1002
+ assertPosixDaemonDirectory(await handle.stat(), false);
1003
+ const after = await fs3.lstat(directory);
1004
+ assertIdentity(after);
1005
+ assertPosixDaemonDirectory(after, false);
1006
+ } finally {
1007
+ await handle.close();
1008
+ }
1009
+ }
1010
+ function getDaemonMetadataPath(_configKey) {
1011
+ return path3.join(daemonRunDir(), "user.json");
1012
+ }
1013
+ function getDaemonSocketPath(_configKey) {
1014
+ if (process.platform === "win32")
1015
+ return `\\\\.\\pipe\\mcporter-user-${createHash2("sha256").update(daemonRunDir().toLowerCase()).digest("hex").slice(0, 24)}`;
1016
+ return path3.join(daemonRunDir(), "user.sock");
1017
+ }
1018
+ function getDaemonLogPath(_configKey) {
1019
+ return path3.join(daemonRunDir(), "user.log");
1020
+ }
1021
+
1022
+ // node_modules/.pnpm/mcporter@0.13.13/node_modules/mcporter/dist/daemon/browser-owner.js
1023
+ var BrowserOwnerConflict = class extends Error {
1024
+ code = "browser_owner_conflict";
1025
+ constructor(reason) {
1026
+ super(`Existing Chrome request refused: ${reason}. Use the canonical Chrome definition; if changing an existing owner, drain and stop the daemon first. This request was not retried.`);
1027
+ }
1028
+ };
1029
+ function isCanonicalChromeNamespace() {
1030
+ return path4.resolve(daemonBaseDir()) === path4.join(os3.userInfo().homedir, ".mcporter");
1031
+ }
1032
+ async function canonicalUserConfiguration() {
1033
+ if (!isCanonicalChromeNamespace())
1034
+ return { definitions: [] };
1035
+ const home = os3.userInfo().homedir;
1036
+ const file = mcporterConfigCandidates({ home }).find(pathExists);
1037
+ if (!file)
1038
+ return { definitions: [] };
1039
+ const definitions = [];
1040
+ const canonicalEnv = { ...process.env, HOME: home };
1041
+ if (canonicalEnv.USERPROFILE !== void 0)
1042
+ canonicalEnv.USERPROFILE = home;
1043
+ for (const name of Object.keys(canonicalEnv))
1044
+ if (name.startsWith("MCPORTER_CHROME_DEVTOOLS_RELAY_") || name === "MCPORTER_DISABLE_CHROME_DEVTOOLS_RELAY" || name.startsWith("OPENCLAW_"))
1045
+ delete canonicalEnv[name];
1046
+ const raw = await readConfigFile(file, true);
1047
+ for (const [name, entry] of Object.entries(raw.mcpServers)) {
1048
+ const launchTokens = [
1049
+ name,
1050
+ ...Array.isArray(entry.command) ? entry.command : [entry.command ?? ""],
1051
+ ...entry.args ?? []
1052
+ ];
1053
+ if (!launchTokens.some((token) => /chrome[-_]devtools(?:[-_]mcp)?/i.test(token)))
1054
+ continue;
1055
+ const definition = normalizeServerEntry(name, entry, path4.dirname(file), { kind: "local", path: file }, [], {
1056
+ env: canonicalEnv,
1057
+ home
1058
+ });
1059
+ if (supportedOwner(definition))
1060
+ definitions.push(await effectiveDefinition(definition, canonicalEnv));
1061
+ }
1062
+ return { definitions, idleTimeoutMs: raw.daemonIdleTimeoutMs ?? raw.daemon_idle_timeout_ms };
1063
+ }
1064
+ function supportedOwner(definition) {
1065
+ return isExistingChromeDefinition(definition) && definition.command.kind === "stdio" && resolveChromeDevtoolsAutoConnectCommand(definition.command.command, definition.command.args).enabled;
1066
+ }
1067
+ var BrowserOwner = class {
1068
+ identity;
1069
+ logicalIdentity;
1070
+ discoveryFailure;
1071
+ get discoveryDecision() {
1072
+ return this.discoveryFailure;
1073
+ }
1074
+ canonicalKeys;
1075
+ canonical;
1076
+ get reserved() {
1077
+ return this.identity !== void 0;
1078
+ }
1079
+ constructor(canonical) {
1080
+ this.canonical = canonical.filter(supportedOwner);
1081
+ this.canonicalKeys = new Set(this.canonical.map(connectionIdentity));
1082
+ }
1083
+ reserve(definition) {
1084
+ if (!isExistingChromeDefinition(definition))
1085
+ return definition;
1086
+ if (!isCanonicalChromeNamespace())
1087
+ throw new BrowserOwnerConflict("existing local Chrome is forbidden in an isolated daemon directory");
1088
+ if (definition.command.kind !== "stdio")
1089
+ return definition;
1090
+ if (!resolveChromeDevtoolsAutoConnectCommand(definition.command.command, definition.command.args).enabled)
1091
+ throw new BrowserOwnerConflict("connection or browser-selection flags and ambiguous wrappers may reach an existing browser; only canonical auto-connect is supported");
1092
+ const configured = this.canonical[0];
1093
+ if (this.canonicalKeys.size !== 1 || !configured)
1094
+ throw new BrowserOwnerConflict("canonical global Chrome definitions are missing or conflicting");
1095
+ const overrides = definition.configuredEnv ?? definition.env;
1096
+ if (definition.chromeDevtoolsRelay && resolveChromeDevtoolsRelayPolicy(definition.chromeDevtoolsRelay, overrides ?? {}) !== resolveChromeDevtoolsRelayPolicy(configured.chromeDevtoolsRelay, configured.env))
1097
+ throw new BrowserOwnerConflict("canonical relay policy differs");
1098
+ const env = { ...configured.env, ...overrides };
1099
+ normalizeChromeEnvironment(definition, env);
1100
+ const command = configured.command.kind === "stdio" && definition.command.command === configured.launchCommand ? { ...definition.command, command: configured.command.command } : definition.command;
1101
+ const candidate = { ...definition, command, env };
1102
+ const identity = connectionIdentity(candidate);
1103
+ if (!this.canonicalKeys.has(identity))
1104
+ throw new BrowserOwnerConflict("request does not match the complete canonical global Chrome connection contract");
1105
+ const policy = resolveChromeDevtoolsRelayPolicy(definition.chromeDevtoolsRelay, env);
1106
+ if (policy !== resolveChromeDevtoolsRelayPolicy(configured.chromeDevtoolsRelay, configured.env))
1107
+ throw new BrowserOwnerConflict("canonical relay policy differs");
1108
+ if (this.identity && this.identity !== identity)
1109
+ throw new BrowserOwnerConflict("an incompatible pending or live connection already owns the browser");
1110
+ this.identity = identity;
1111
+ return configured;
1112
+ }
1113
+ async resolveIdentity(definition) {
1114
+ const resolve = () => resolveChromeDevtoolsRelayRuntimeIdentity(chromeDevtoolsRelayEnvironmentKeys([definition], definition.env), definition.env);
1115
+ if (!this.logicalIdentity) {
1116
+ this.logicalIdentity = resolve().catch((error) => {
1117
+ this.logicalIdentity = void 0;
1118
+ throw error;
1119
+ });
1120
+ }
1121
+ let retained;
1122
+ let current;
1123
+ try {
1124
+ retained = await this.logicalIdentity;
1125
+ current = await resolve();
1126
+ } catch (error) {
1127
+ if (error instanceof ChromeDevtoolsRelayDiscoveryError) {
1128
+ this.discoveryFailure = error.decision;
1129
+ }
1130
+ throw error;
1131
+ }
1132
+ if (retained !== current)
1133
+ throw new BrowserOwnerConflict("relay endpoint, credential generation or security context changed; explicit retirement is required");
1134
+ this.discoveryFailure = void 0;
1135
+ return retained;
1136
+ }
1137
+ };
1138
+
1139
+ // node_modules/.pnpm/mcporter@0.13.13/node_modules/mcporter/dist/daemon/transport-authority.js
1140
+ var authority = /* @__PURE__ */ Symbol("broker transport authority");
1141
+ function authorizeBrokerDefinition(definition, validateRequest) {
1142
+ Object.defineProperty(definition, authority, { value: { validateRequest }, enumerable: true });
1143
+ }
1144
+ function validateBrokerRequestAuthority(definition) {
1145
+ return definition?.[authority]?.validateRequest?.();
1146
+ }
1147
+ function isBrokerDefinition(definition) {
1148
+ return Boolean(definition?.[authority]);
1149
+ }
1150
+ function assertChromeBrokerAuthority(definition) {
1151
+ if (isExistingChromeDefinition(definition) && !isBrokerDefinition(definition)) {
1152
+ throw new BrowserOwnerConflict("programmatic or ephemeral Chrome attachment must use the daemon-backed runtime");
1153
+ }
1154
+ }
1155
+
1156
+ // node_modules/.pnpm/mcporter@0.13.13/node_modules/mcporter/dist/runtime-process-utils.js
1157
+ import { execFile } from "node:child_process";
1158
+ import { setTimeout as delay } from "node:timers/promises";
1159
+ async function captureTransportProcessTree(transport) {
1160
+ const pid = getTransportPid(transport);
1161
+ return { pid, targets: pid ? await collectProcessTreePids(pid) : [] };
1162
+ }
1163
+ async function closeTransportAndWait(logger, transport, options = {}) {
1164
+ const processTree = options.processTree ?? await captureTransportProcessTree(transport);
1165
+ const pidBeforeClose = processTree.pid;
1166
+ const targetsBeforeClose = processTree.targets;
1167
+ let closeError;
1168
+ let closeSettled = false;
1169
+ const closePromise = (options.close ?? (() => transport.close()))().catch((error) => {
1170
+ closeError = error;
1171
+ if (!options.throwOnCloseError) {
1172
+ logger.warn(`Failed to close transport cleanly: ${error.message}`);
1173
+ }
1174
+ }).finally(() => {
1175
+ closeSettled = true;
1176
+ });
1177
+ if (pidBeforeClose) {
1178
+ destroyTransportStreams(transport);
1179
+ await ensureProcessTreeTerminated(logger, pidBeforeClose, targetsBeforeClose, options.requireRetirement);
1180
+ if (!closeSettled) {
1181
+ await Promise.race([closePromise, delay(100)]);
1182
+ }
1183
+ } else {
1184
+ await closePromise;
1185
+ }
1186
+ if (closeError && options.throwOnCloseError) {
1187
+ if (options.requireRetirement)
1188
+ throw Object.assign(new Error("Transport retirement failed.", { cause: closeError }), {
1189
+ code: "transport_retirement_failed"
1190
+ });
1191
+ throw closeError;
1192
+ }
1193
+ }
1194
+ function getTransportPid(transport) {
1195
+ if ("pid" in transport) {
1196
+ const candidate = transport.pid;
1197
+ if (typeof candidate === "number" && candidate > 0) {
1198
+ return candidate;
1199
+ }
1200
+ }
1201
+ return null;
1202
+ }
1203
+ function isProcessAlive(pid) {
1204
+ try {
1205
+ process.kill(pid, 0);
1206
+ return true;
1207
+ } catch {
1208
+ return false;
1209
+ }
1210
+ }
1211
+ async function ensureProcessTreeTerminated(logger, rootPid, capturedTargets = [], requireRetirement = false) {
1212
+ let targets = uniquePids([...capturedTargets, ...await collectProcessTreePids(rootPid)]);
1213
+ if (targets.length === 0 || await waitForTreeExit(targets, 700)) {
1214
+ return;
1215
+ }
1216
+ await sendSignalToTargets(targets, "SIGTERM");
1217
+ targets = uniquePids([...targets, ...await collectProcessTreePids(rootPid)]);
1218
+ if (await waitForTreeExit(targets, 700)) {
1219
+ return;
1220
+ }
1221
+ targets = uniquePids([...targets, ...await collectProcessTreePids(rootPid)]);
1222
+ await sendSignalToTargets(targets, "SIGKILL");
1223
+ if (await waitForTreeExit(targets, 500)) {
1224
+ return;
1225
+ }
1226
+ if (requireRetirement)
1227
+ throw Object.assign(new Error("Transport process retirement could not be verified."), {
1228
+ code: "transport_retirement_failed"
1229
+ });
1230
+ logger.warn(`Process tree rooted at pid=${rootPid} did not exit after SIGKILL.`);
1231
+ }
1232
+ function uniquePids(pids) {
1233
+ return [...new Set(pids.filter((pid) => Number.isInteger(pid) && pid > 0))];
1234
+ }
1235
+ function destroyTransportStreams(transport) {
1236
+ const candidate = transport;
1237
+ for (const key of ["stdin", "stdout", "stderr"]) {
1238
+ try {
1239
+ const stream = candidate[key];
1240
+ stream?.destroy?.();
1241
+ } catch {
1242
+ }
1243
+ }
1244
+ }
1245
+ async function sendSignalToTargets(pids, signal) {
1246
+ const seen = /* @__PURE__ */ new Set();
1247
+ for (const pid of pids) {
1248
+ if (seen.has(pid)) {
1249
+ continue;
1250
+ }
1251
+ seen.add(pid);
1252
+ sendSignal(pid, signal);
1253
+ }
1254
+ }
1255
+ function sendSignal(pid, signal) {
1256
+ try {
1257
+ process.kill(pid, signal);
1258
+ } catch (error) {
1259
+ if (typeof error === "object" && error && "code" in error && error.code === "ESRCH") {
1260
+ return;
1261
+ }
1262
+ throw error;
1263
+ }
1264
+ }
1265
+ async function listDescendantPids(rootPid) {
1266
+ if (!isProcessAlive(rootPid)) {
1267
+ return [];
1268
+ }
1269
+ if (process.platform === "win32") {
1270
+ return listDescendantPidsWindows(rootPid);
1271
+ }
1272
+ try {
1273
+ const { stdout } = await execFileAsync("ps", ["-eo", "pid=,ppid="]);
1274
+ const children = /* @__PURE__ */ new Map();
1275
+ for (const line of stdout.split("\n")) {
1276
+ const trimmed = line.trim();
1277
+ if (!trimmed) {
1278
+ continue;
1279
+ }
1280
+ const [pidText, ppidText] = trimmed.split(/\s+/, 2);
1281
+ const pid = Number.parseInt(pidText ?? "", 10);
1282
+ const ppid = Number.parseInt(ppidText ?? "", 10);
1283
+ if (!Number.isFinite(pid) || !Number.isFinite(ppid)) {
1284
+ continue;
1285
+ }
1286
+ const bucket = children.get(ppid) ?? [];
1287
+ bucket.push(pid);
1288
+ children.set(ppid, bucket);
1289
+ }
1290
+ return collectDescendantsFromChildren(rootPid, children);
1291
+ } catch {
1292
+ return [];
1293
+ }
1294
+ }
1295
+ async function listDescendantPidsWindows(rootPid) {
1296
+ try {
1297
+ const powershellScript = "Get-CimInstance Win32_Process | Select-Object ProcessId,ParentProcessId | ConvertTo-Json -Compress";
1298
+ const { stdout } = await execFileAsync("powershell.exe", ["-NoProfile", "-Command", powershellScript]);
1299
+ const trimmed = stdout.trim();
1300
+ if (!trimmed) {
1301
+ return [];
1302
+ }
1303
+ const parsed = JSON.parse(trimmed);
1304
+ const entries = Array.isArray(parsed) ? parsed : [parsed];
1305
+ const children = /* @__PURE__ */ new Map();
714
1306
  for (const entry of entries) {
715
1307
  const pidCandidate = entry?.ProcessId;
716
1308
  const ppidCandidate = entry?.ParentProcessId;
@@ -778,11 +1370,8 @@ async function waitForTreeExit(pids, durationMs) {
778
1370
  await delay(remaining);
779
1371
  }
780
1372
  }
781
- function delay(ms) {
782
- return new Promise((resolve) => setTimeout(resolve, ms));
783
- }
784
1373
 
785
- // node_modules/.pnpm/mcporter@0.13.8/node_modules/mcporter/dist/runtime/errors.js
1374
+ // node_modules/.pnpm/mcporter@0.13.13/node_modules/mcporter/dist/runtime/errors.js
786
1375
  var NON_FATAL_MCP_ERROR_CODES = /* @__PURE__ */ new Set([
787
1376
  ProtocolErrorCode.InvalidRequest,
788
1377
  ProtocolErrorCode.MethodNotFound,
@@ -804,8 +1393,8 @@ function protocolErrorCode(error) {
804
1393
  return typeof error.code === "number" ? error.code : void 0;
805
1394
  }
806
1395
 
807
- // node_modules/.pnpm/mcporter@0.13.8/node_modules/mcporter/dist/runtime/replay-transport.js
808
- import fs from "node:fs";
1396
+ // node_modules/.pnpm/mcporter@0.13.13/node_modules/mcporter/dist/runtime/replay-transport.js
1397
+ import fs4 from "node:fs";
809
1398
  import { isDeepStrictEqual } from "node:util";
810
1399
  var CLIENT_IDENTITY_META_KEYS = [
811
1400
  "io.modelcontextprotocol/clientInfo",
@@ -860,7 +1449,7 @@ var ReplayTransport = class {
860
1449
  };
861
1450
  function readRecordedMessages(recordPath) {
862
1451
  try {
863
- const contents = fs.readFileSync(recordPath, "utf8");
1452
+ const contents = fs4.readFileSync(recordPath, "utf8");
864
1453
  return contents.split(/\r?\n/).map((line) => line.trim()).filter((line) => line.length > 0).map((line, index) => {
865
1454
  try {
866
1455
  return JSON.parse(line);
@@ -997,44 +1586,250 @@ function adaptInitializeResponse(method, response, requestParams) {
997
1586
  if (typeof protocolVersion !== "string" || !isJsonRpcRecord(response.result)) {
998
1587
  return response;
999
1588
  }
1000
- return {
1001
- ...response,
1002
- result: { ...response.result, protocolVersion }
1003
- };
1004
- }
1005
- function isJsonRpcRecord(value) {
1006
- return typeof value === "object" && value !== null && !Array.isArray(value);
1007
- }
1008
- function withActiveRequestId(response, requestId) {
1009
- if (requestId === void 0) {
1010
- return response;
1589
+ return {
1590
+ ...response,
1591
+ result: { ...response.result, protocolVersion }
1592
+ };
1593
+ }
1594
+ function isJsonRpcRecord(value) {
1595
+ return typeof value === "object" && value !== null && !Array.isArray(value);
1596
+ }
1597
+ function withActiveRequestId(response, requestId) {
1598
+ if (requestId === void 0) {
1599
+ return response;
1600
+ }
1601
+ return {
1602
+ ...response,
1603
+ id: requestId
1604
+ };
1605
+ }
1606
+ function formatReplayMismatch(server, request, expected) {
1607
+ const expectedText = expected ? `${expected.method} ${JSON.stringify(expected.params ?? {})}` : "no remaining recorded recv";
1608
+ return `Replay mismatch for server '${server}': request ${request.method} ${JSON.stringify(request.params ?? {})} did not match next expected recv ${expectedText}.`;
1609
+ }
1610
+ function formatReplayRemainder(server, expectedSends) {
1611
+ const expected = expectedSends[0];
1612
+ const count = expectedSends.length;
1613
+ const requestText = count === 1 ? "request" : "requests";
1614
+ const expectedText = expected ? `${expected.method} ${JSON.stringify(expected.params ?? {})}` : "no remaining recorded recv";
1615
+ return `Replay ended for server '${server}' with ${count} recorded ${requestText} still unused; next expected recv ${expectedText}.`;
1616
+ }
1617
+
1618
+ // node_modules/.pnpm/@modelcontextprotocol+client@2.0.0/node_modules/@modelcontextprotocol/client/dist/stdio.mjs
1619
+ var import_cross_spawn = __toESM(require_cross_spawn(), 1);
1620
+ import process2 from "node:process";
1621
+ import { PassThrough } from "node:stream";
1622
+ var DEFAULT_INHERITED_ENV_VARS = process2.platform === "win32" ? [
1623
+ "APPDATA",
1624
+ "HOMEDRIVE",
1625
+ "HOMEPATH",
1626
+ "LOCALAPPDATA",
1627
+ "PATH",
1628
+ "PROCESSOR_ARCHITECTURE",
1629
+ "SYSTEMDRIVE",
1630
+ "SYSTEMROOT",
1631
+ "TEMP",
1632
+ "USERNAME",
1633
+ "USERPROFILE",
1634
+ "PROGRAMFILES"
1635
+ ] : [
1636
+ "HOME",
1637
+ "LOGNAME",
1638
+ "PATH",
1639
+ "SHELL",
1640
+ "TERM",
1641
+ "USER"
1642
+ ];
1643
+ function getDefaultEnvironment() {
1644
+ const env = {};
1645
+ for (const key of DEFAULT_INHERITED_ENV_VARS) {
1646
+ const value = process2.env[key];
1647
+ if (value === void 0) continue;
1648
+ if (value.startsWith("()")) continue;
1649
+ env[key] = value;
1650
+ }
1651
+ return env;
1652
+ }
1653
+ var StdioClientTransport = class {
1654
+ _process;
1655
+ _readBuffer;
1656
+ _serverParams;
1657
+ _stderrStream = null;
1658
+ onclose;
1659
+ onerror;
1660
+ onmessage;
1661
+ constructor(server) {
1662
+ this._serverParams = server;
1663
+ this._readBuffer = new ReadBuffer({ maxBufferSize: server.maxBufferSize });
1664
+ if (server.stderr === "pipe" || server.stderr === "overlapped") this._stderrStream = new PassThrough();
1665
+ }
1666
+ /**
1667
+ * Starts the server process and prepares to communicate with it.
1668
+ */
1669
+ async start() {
1670
+ if (this._process) throw new Error("StdioClientTransport already started! If using Client class, note that connect() calls start() automatically.");
1671
+ return new Promise((resolve, reject) => {
1672
+ this._process = (0, import_cross_spawn.default)(this._serverParams.command, this._serverParams.args ?? [], {
1673
+ env: {
1674
+ ...getDefaultEnvironment(),
1675
+ ...this._serverParams.env
1676
+ },
1677
+ stdio: [
1678
+ "pipe",
1679
+ "pipe",
1680
+ this._serverParams.stderr ?? "inherit"
1681
+ ],
1682
+ shell: false,
1683
+ windowsHide: process2.platform === "win32",
1684
+ cwd: this._serverParams.cwd
1685
+ });
1686
+ this._process.on("error", (error) => {
1687
+ reject(error);
1688
+ this.onerror?.(error);
1689
+ });
1690
+ this._process.on("spawn", () => {
1691
+ resolve();
1692
+ });
1693
+ this._process.on("close", (_code) => {
1694
+ this._process = void 0;
1695
+ this.onclose?.();
1696
+ });
1697
+ this._process.stdin?.on("error", (error) => {
1698
+ this.onerror?.(error);
1699
+ });
1700
+ this._process.stdout?.on("data", (chunk) => {
1701
+ try {
1702
+ this._readBuffer.append(chunk);
1703
+ this.processReadBuffer();
1704
+ } catch (error) {
1705
+ this.onerror?.(error);
1706
+ this.close().catch(() => {
1707
+ });
1708
+ }
1709
+ });
1710
+ this._process.stdout?.on("error", (error) => {
1711
+ this.onerror?.(error);
1712
+ });
1713
+ if (this._stderrStream && this._process.stderr) this._process.stderr.pipe(this._stderrStream);
1714
+ });
1715
+ }
1716
+ /**
1717
+ * The `stderr` stream of the child process, if {@linkcode StdioServerParameters.stderr} was set to `"pipe"` or `"overlapped"`.
1718
+ *
1719
+ * If `stderr` piping was requested, a `PassThrough` stream is returned _immediately_, allowing callers to
1720
+ * attach listeners before the `start` method is invoked. This prevents loss of any early
1721
+ * error output emitted by the child process.
1722
+ */
1723
+ get stderr() {
1724
+ if (this._stderrStream) return this._stderrStream;
1725
+ return this._process?.stderr ?? null;
1726
+ }
1727
+ /**
1728
+ * The child process pid spawned by this transport.
1729
+ *
1730
+ * This is only available after the transport has been started.
1731
+ */
1732
+ get pid() {
1733
+ return this._process?.pid ?? null;
1734
+ }
1735
+ processReadBuffer() {
1736
+ while (true) try {
1737
+ const message = this._readBuffer.readMessage();
1738
+ if (message === null) break;
1739
+ this.onmessage?.(message);
1740
+ } catch (error) {
1741
+ this.onerror?.(error);
1742
+ }
1743
+ }
1744
+ /**
1745
+ * Reap a disposable probe sibling (see the version-negotiation sibling
1746
+ * flow): signal-first teardown awaiting process `exit` — never the `close`
1747
+ * event, so a helper process holding the child's stdio pipes can never
1748
+ * block disposal. Not part of the public transport lifecycle.
1749
+ *
1750
+ * @internal
1751
+ */
1752
+ async _dispose() {
1753
+ const proc = this._process;
1754
+ this._process = void 0;
1755
+ if (proc && proc.exitCode === null && proc.signalCode === null) {
1756
+ const exited = new Promise((resolve) => proc.once("exit", () => resolve()));
1757
+ try {
1758
+ proc.stdin?.end();
1759
+ } catch {
1760
+ }
1761
+ try {
1762
+ proc.kill("SIGTERM");
1763
+ } catch {
1764
+ }
1765
+ await Promise.race([exited, new Promise((resolve) => setTimeout(resolve, 1e3).unref())]);
1766
+ if (proc.exitCode === null && proc.signalCode === null) try {
1767
+ proc.kill("SIGKILL");
1768
+ } catch {
1769
+ }
1770
+ await exited;
1771
+ }
1772
+ try {
1773
+ proc?.stdout?.destroy();
1774
+ } catch {
1775
+ }
1776
+ try {
1777
+ proc?.stdin?.destroy();
1778
+ } catch {
1779
+ }
1780
+ try {
1781
+ proc?.stderr?.destroy();
1782
+ } catch {
1783
+ }
1784
+ this._readBuffer.clear();
1785
+ }
1786
+ async close() {
1787
+ if (this._process) {
1788
+ const processToClose = this._process;
1789
+ this._process = void 0;
1790
+ const closePromise = new Promise((resolve) => {
1791
+ processToClose.once("close", () => {
1792
+ resolve();
1793
+ });
1794
+ });
1795
+ try {
1796
+ processToClose.stdin?.end();
1797
+ } catch {
1798
+ }
1799
+ await Promise.race([closePromise, new Promise((resolve) => setTimeout(resolve, 2e3).unref())]);
1800
+ if (processToClose.exitCode === null) {
1801
+ try {
1802
+ processToClose.kill("SIGTERM");
1803
+ } catch {
1804
+ }
1805
+ await Promise.race([closePromise, new Promise((resolve) => setTimeout(resolve, 2e3).unref())]);
1806
+ }
1807
+ if (processToClose.exitCode === null) try {
1808
+ processToClose.kill("SIGKILL");
1809
+ } catch {
1810
+ }
1811
+ }
1812
+ this._readBuffer.clear();
1813
+ }
1814
+ send(message) {
1815
+ return new Promise((resolve) => {
1816
+ if (!this._process?.stdin) throw new SdkError(SdkErrorCode.NotConnected, "Not connected");
1817
+ const json = serializeMessage(message);
1818
+ if (this._process.stdin.write(json)) resolve();
1819
+ else this._process.stdin.once("drain", resolve);
1820
+ });
1011
1821
  }
1012
- return {
1013
- ...response,
1014
- id: requestId
1015
- };
1016
- }
1017
- function formatReplayMismatch(server, request, expected) {
1018
- const expectedText = expected ? `${expected.method} ${JSON.stringify(expected.params ?? {})}` : "no remaining recorded recv";
1019
- return `Replay mismatch for server '${server}': request ${request.method} ${JSON.stringify(request.params ?? {})} did not match next expected recv ${expectedText}.`;
1020
- }
1021
- function formatReplayRemainder(server, expectedSends) {
1022
- const expected = expectedSends[0];
1023
- const count = expectedSends.length;
1024
- const requestText = count === 1 ? "request" : "requests";
1025
- const expectedText = expected ? `${expected.method} ${JSON.stringify(expected.params ?? {})}` : "no remaining recorded recv";
1026
- return `Replay ended for server '${server}' with ${count} recorded ${requestText} still unused; next expected recv ${expectedText}.`;
1027
- }
1822
+ };
1028
1823
 
1029
- // node_modules/.pnpm/mcporter@0.13.8/node_modules/mcporter/dist/chrome-devtools-compat.js
1030
- import fs3 from "node:fs";
1031
- import os from "node:os";
1032
- import path2 from "node:path";
1033
- import { fileURLToPath, pathToFileURL } from "node:url";
1824
+ // node_modules/.pnpm/mcporter@0.13.13/node_modules/mcporter/dist/chrome-devtools-compat.js
1825
+ import fs6 from "node:fs";
1826
+ import os4 from "node:os";
1827
+ import path6 from "node:path";
1828
+ import { fileURLToPath, pathToFileURL as pathToFileURL2 } from "node:url";
1034
1829
 
1035
- // node_modules/.pnpm/mcporter@0.13.8/node_modules/mcporter/dist/chrome-devtools-auto-connect-patch.js
1036
- import fs2 from "node:fs";
1037
- import path from "node:path";
1830
+ // node_modules/.pnpm/mcporter@0.13.13/node_modules/mcporter/dist/chrome-devtools-auto-connect-patch.js
1831
+ import fs5 from "node:fs";
1832
+ import path5 from "node:path";
1038
1833
  var MARKER = "MCPORTER_DEVTOOLS_TIMEOUT_PATCH";
1039
1834
  var HELPER = `// ${MARKER}
1040
1835
  const MCPORTER_DEVTOOLS_DETECTION_TIMEOUT = 1_000;
@@ -1064,7 +1859,7 @@ var PATCHED_DETECTION_BLOCK = `if (await mcporterWithTimeout(page.hasDevTools(),
1064
1859
  }`;
1065
1860
  patchChromeDevtoolsMcp();
1066
1861
  function patchChromeDevtoolsMcp(mainPath = process.argv[1]) {
1067
- patchChromeDevtoolsMcpWithDependencies(mainPath, fs2, path, MARKER, HELPER, DETECTION_BLOCK, PATCHED_DETECTION_BLOCK);
1862
+ patchChromeDevtoolsMcpWithDependencies(mainPath, fs5, path5, MARKER, HELPER, DETECTION_BLOCK, PATCHED_DETECTION_BLOCK);
1068
1863
  }
1069
1864
  function renderChromeDevtoolsAutoConnectPatchSource() {
1070
1865
  return `import fs from 'node:fs';
@@ -1119,7 +1914,7 @@ ${helper}`);
1119
1914
  }
1120
1915
  }
1121
1916
 
1122
- // node_modules/.pnpm/mcporter@0.13.8/node_modules/mcporter/dist/chrome-devtools-compat.js
1917
+ // node_modules/.pnpm/mcporter@0.13.13/node_modules/mcporter/dist/chrome-devtools-compat.js
1123
1918
  var FALLBACK_PATCH_FILENAME = "mcporter-chrome-devtools-auto-connect-patch.js";
1124
1919
  function applyChromeDevtoolsCompat(env, command, args) {
1125
1920
  if (!shouldApplyChromeDevtoolsCompat(command, args, env)) {
@@ -1129,7 +1924,7 @@ function applyChromeDevtoolsCompat(env, command, args) {
1129
1924
  if (!patchPath) {
1130
1925
  return { env, applied: false };
1131
1926
  }
1132
- const importFlag = `--import=${pathToFileURL(patchPath).href}`;
1927
+ const importFlag = `--import=${pathToFileURL2(patchPath).href}`;
1133
1928
  const existingOptions = env.NODE_OPTIONS?.trim();
1134
1929
  if (existingOptions?.includes(importFlag)) {
1135
1930
  return { env, applied: true, patchPath };
@@ -1149,256 +1944,31 @@ function shouldApplyChromeDevtoolsCompat(command, args, env = process.env) {
1149
1944
  }
1150
1945
  return resolveChromeDevtoolsAutoConnectCommand(command, args).enabled;
1151
1946
  }
1152
- function resolveChromeDevtoolsCompatPatchPath(candidates = defaultChromeDevtoolsPatchCandidates(), fallbackDir = os.tmpdir()) {
1153
- const existing = candidates.find((candidate) => fs3.existsSync(candidate));
1947
+ function resolveChromeDevtoolsCompatPatchPath(candidates = defaultChromeDevtoolsPatchCandidates(), fallbackDir = os4.tmpdir()) {
1948
+ const existing = candidates.find((candidate) => fs6.existsSync(candidate));
1154
1949
  if (existing) {
1155
- return existing;
1156
- }
1157
- return writeFallbackPatch(fallbackDir);
1158
- }
1159
- function defaultChromeDevtoolsPatchCandidates() {
1160
- const here = path2.dirname(fileURLToPath(import.meta.url));
1161
- return [
1162
- path2.join(here, "chrome-devtools-auto-connect-patch.js"),
1163
- path2.resolve(here, "..", "dist", "chrome-devtools-auto-connect-patch.js")
1164
- ];
1165
- }
1166
- function writeFallbackPatch(fallbackDir) {
1167
- const patchPath = path2.join(fallbackDir, FALLBACK_PATCH_FILENAME);
1168
- try {
1169
- fs3.writeFileSync(patchPath, renderChromeDevtoolsAutoConnectPatchSource(), { mode: 384 });
1170
- return patchPath;
1171
- } catch {
1172
- return void 0;
1173
- }
1174
- }
1175
-
1176
- // node_modules/.pnpm/mcporter@0.13.8/node_modules/mcporter/dist/chrome-devtools-relay-handoff.js
1177
- import { spawnSync } from "node:child_process";
1178
- import { randomBytes } from "node:crypto";
1179
- import fs4 from "node:fs";
1180
- import os2 from "node:os";
1181
- import path3 from "node:path";
1182
- import { pathToFileURL as pathToFileURL2 } from "node:url";
1183
- var CHROME_RELAY_HANDOFF_ENV = "MCPORTER_CHROME_RELAY_HANDOFF_PATH";
1184
- var HANDOFF_DIR_PREFIX = "mcporter-chrome-relay-";
1185
- var HANDOFF_FILENAME = "headers.json";
1186
- var PRELOAD_FILENAME = "preload.mjs";
1187
- var WINDOWS_ACL_PATH_ENV = "MCPORTER_CHROME_RELAY_ACL_PATH";
1188
- function createChromeDevtoolsRelayHandoff(env, clientAuthorization) {
1189
- let directory;
1190
- try {
1191
- if (process.platform === "win32")
1192
- directory = createWindowsHandoffDirectory();
1193
- else {
1194
- directory = fs4.mkdtempSync(path3.join(os2.tmpdir(), HANDOFF_DIR_PREFIX));
1195
- fs4.chmodSync(directory, 448);
1196
- }
1197
- assertSecurePath(directory, "directory");
1198
- const handoffPath = path3.join(directory, HANDOFF_FILENAME);
1199
- const preloadPath = path3.join(directory, PRELOAD_FILENAME);
1200
- writeExclusiveFile(preloadPath, renderChromeDevtoolsRelayPreloadSource());
1201
- writeExclusiveFile(handoffPath, JSON.stringify({ Authorization: clientAuthorization }));
1202
- const importFlag = `--import=${pathToFileURL2(preloadPath).href}`;
1203
- const existingOptions = env.NODE_OPTIONS?.trim();
1204
- let closed = false;
1205
- return {
1206
- env: {
1207
- ...env,
1208
- NODE_OPTIONS: existingOptions ? `${existingOptions} ${importFlag}` : importFlag,
1209
- [CHROME_RELAY_HANDOFF_ENV]: handoffPath
1210
- },
1211
- handoffPath,
1212
- preloadPath,
1213
- async close() {
1214
- if (closed)
1215
- return;
1216
- closed = true;
1217
- cleanupHandoff(directory, handoffPath, preloadPath);
1218
- }
1219
- };
1220
- } catch (error) {
1221
- if (directory)
1222
- cleanupHandoff(directory, path3.join(directory, HANDOFF_FILENAME), path3.join(directory, PRELOAD_FILENAME));
1223
- const diagnostic = error instanceof Error && error.message.startsWith("Windows ACL setup failed:") ? ` ${error.message}` : "";
1224
- throw new Error(`Unable to install secure Chrome relay authorization handoff.${diagnostic}`, { cause: error });
1225
- }
1226
- }
1227
- function createWindowsHandoffDirectory() {
1228
- const directory = path3.join(os2.tmpdir(), `${HANDOFF_DIR_PREFIX}${randomBytes(16).toString("hex")}`);
1229
- const script = String.raw`
1230
- $ErrorActionPreference = 'Stop'
1231
- $stage = 'identity'
1232
- try {
1233
- $target = $env:${WINDOWS_ACL_PATH_ENV}
1234
- if ([System.IO.Directory]::Exists($target)) { throw 'handoff path already exists' }
1235
- $sid = [System.Security.Principal.WindowsIdentity]::GetCurrent().User
1236
- $stage = 'descriptor'
1237
- $security = New-Object System.Security.AccessControl.DirectorySecurity
1238
- $sidValue = $sid.Value
1239
- $security.SetSecurityDescriptorSddlForm("O:$($sidValue)G:$($sidValue)D:P(A;OICI;FA;;;$($sidValue))")
1240
- $directory = New-Object System.IO.DirectoryInfo -ArgumentList @($target)
1241
- $stage = 'create'
1242
- $directory.Create($security)
1243
- $stage = 'acl-read'
1244
- $check = $directory.GetAccessControl([System.Security.AccessControl.AccessControlSections]::All)
1245
- $rules = @($check.GetAccessRules($true, $true, [System.Security.Principal.SecurityIdentifier]))
1246
- $ownerSid = $check.GetOwner([System.Security.Principal.SecurityIdentifier]).Value
1247
- $stage = 'acl-verify'
1248
- if (-not $check.AreAccessRulesProtected -or $ownerSid -ne $sid.Value -or $rules.Count -ne 1) { throw 'unsafe ACL' }
1249
- $ruleSid = $rules[0].IdentityReference.Value
1250
- $hasFullControl = ($rules[0].FileSystemRights -band [System.Security.AccessControl.FileSystemRights]::FullControl) -eq [System.Security.AccessControl.FileSystemRights]::FullControl
1251
- if ($ruleSid -ne $sid.Value -or $rules[0].IsInherited -or -not $hasFullControl -or $rules[0].AccessControlType -ne [System.Security.AccessControl.AccessControlType]::Allow) { throw 'unsafe ACL' }
1252
- } catch {
1253
- $type = $_.Exception.GetType().FullName
1254
- $hresult = ('0x{0:X8}' -f ($_.Exception.HResult -band 0xffffffffL))
1255
- [Console]::Error.WriteLine("stage=$stage type=$type hresult=$hresult")
1256
- exit 1
1257
- }
1258
- `;
1259
- const result = spawnSync(resolveSystemPowerShellPath(), ["-NoLogo", "-NoProfile", "-NonInteractive", "-Command", script], {
1260
- encoding: "utf8",
1261
- env: { ...process.env, [WINDOWS_ACL_PATH_ENV]: directory },
1262
- stdio: ["ignore", "ignore", "pipe"],
1263
- windowsHide: true
1264
- });
1265
- if (result.status !== 0) {
1266
- try {
1267
- fs4.rmdirSync(directory);
1268
- } catch {
1269
- }
1270
- const stderr = typeof result.stderr === "string" ? result.stderr.trim() : "";
1271
- const safeDetail = /^[A-Za-z0-9_.:=\- ]{1,240}$/u.test(stderr) ? stderr : `stage=spawn type=${result.error?.code ?? "unknown"} hresult=unknown`;
1272
- throw new Error(`Windows ACL setup failed: ${safeDetail}`);
1273
- }
1274
- return directory;
1275
- }
1276
- function resolveSystemPowerShellPath() {
1277
- const systemRoot = process.env.SystemRoot?.trim() || process.env.WINDIR?.trim();
1278
- if (!systemRoot || !path3.win32.isAbsolute(systemRoot))
1279
- throw new Error("unsafe Windows system root");
1280
- const executable = path3.win32.join(systemRoot, "System32", "WindowsPowerShell", "v1.0", "powershell.exe");
1281
- const stat = fs4.lstatSync(executable);
1282
- if (!stat.isFile() || stat.isSymbolicLink())
1283
- throw new Error("unsafe Windows PowerShell path");
1284
- return executable;
1285
- }
1286
- function writeExclusiveFile(filePath, contents) {
1287
- const descriptor = fs4.openSync(filePath, fs4.constants.O_WRONLY | fs4.constants.O_CREAT | fs4.constants.O_EXCL | (fs4.constants.O_NOFOLLOW ?? 0), 384);
1288
- try {
1289
- if (process.platform !== "win32")
1290
- fs4.fchmodSync(descriptor, 384);
1291
- fs4.writeFileSync(descriptor, contents, "utf8");
1292
- } finally {
1293
- fs4.closeSync(descriptor);
1294
- }
1295
- assertSecurePath(filePath, "file");
1296
- }
1297
- function assertSecurePath(filePath, kind) {
1298
- const stat = fs4.lstatSync(filePath);
1299
- if ((kind === "directory" ? !stat.isDirectory() : !stat.isFile()) || stat.isSymbolicLink())
1300
- throw new Error("unsafe");
1301
- if (process.platform === "win32")
1302
- return;
1303
- if ((stat.mode & 63) !== 0)
1304
- throw new Error("unsafe");
1305
- if (typeof process.getuid === "function" && stat.uid !== process.getuid())
1306
- throw new Error("unsafe");
1307
- }
1308
- function cleanupHandoff(directory, handoffPath, preloadPath) {
1309
- for (const filePath of [handoffPath, preloadPath]) {
1310
- try {
1311
- fs4.unlinkSync(filePath);
1312
- } catch {
1313
- }
1314
- }
1315
- try {
1316
- fs4.rmdirSync(directory);
1317
- } catch {
1318
- }
1319
- }
1320
- function renderChromeDevtoolsRelayPreloadSource() {
1321
- return `import fs from 'node:fs';
1322
- import path from 'node:path';
1323
-
1324
- const targetPath = process.argv[1]?.replaceAll('\\\\', '/').toLowerCase();
1325
- if (targetPath?.includes('chrome-devtools-mcp')) {
1326
- const failureMessage = 'MCPorter Chrome relay authorization handoff unavailable.';
1327
- const fail = () => {
1328
- throw new Error(failureMessage);
1329
- };
1330
- const envName = ${JSON.stringify(CHROME_RELAY_HANDOFF_ENV)};
1331
- const handoffPath = process.env[envName];
1332
- delete process.env[envName];
1333
- if (!handoffPath || !path.isAbsolute(handoffPath)) fail();
1334
-
1335
- const directoryStat = (() => {
1336
- try {
1337
- return fs.lstatSync(path.dirname(handoffPath));
1338
- } catch {
1339
- return fail();
1340
- }
1341
- })();
1342
- if (!directoryStat.isDirectory() || directoryStat.isSymbolicLink()) fail();
1343
- if (process.platform !== 'win32') {
1344
- if ((directoryStat.mode & 0o077) !== 0) fail();
1345
- if (typeof process.getuid === 'function' && directoryStat.uid !== process.getuid()) fail();
1346
- }
1347
-
1348
- const descriptor = (() => {
1349
- try {
1350
- return fs.openSync(handoffPath, fs.constants.O_RDONLY | (fs.constants.O_NOFOLLOW ?? 0));
1351
- } catch {
1352
- return fail();
1353
- }
1354
- })();
1355
-
1356
- let raw = '';
1357
- let consumed = false;
1358
- try {
1359
- const stat = fs.fstatSync(descriptor);
1360
- if (!stat.isFile() || stat.size <= 0 || stat.size > 4_096) fail();
1361
- if (process.platform !== 'win32') {
1362
- if ((stat.mode & 0o077) !== 0) fail();
1363
- if (typeof process.getuid === 'function' && stat.uid !== process.getuid()) fail();
1364
- }
1365
- raw = fs.readFileSync(descriptor, 'utf8');
1366
- try {
1367
- fs.unlinkSync(handoffPath);
1368
- consumed = true;
1369
- } catch {
1370
- try {
1371
- fs.ftruncateSync(descriptor, 0);
1372
- consumed = true;
1373
- } catch {
1374
- fail();
1375
- }
1376
- }
1377
- } finally {
1378
- fs.closeSync(descriptor);
1950
+ return existing;
1379
1951
  }
1380
- if (!consumed) fail();
1381
-
1382
- let parsed;
1952
+ return writeFallbackPatch(fallbackDir);
1953
+ }
1954
+ function defaultChromeDevtoolsPatchCandidates() {
1955
+ const here = path6.dirname(fileURLToPath(import.meta.url));
1956
+ return [
1957
+ path6.join(here, "chrome-devtools-auto-connect-patch.js"),
1958
+ path6.resolve(here, "..", "dist", "chrome-devtools-auto-connect-patch.js")
1959
+ ];
1960
+ }
1961
+ function writeFallbackPatch(fallbackDir) {
1962
+ const patchPath = path6.join(fallbackDir, FALLBACK_PATCH_FILENAME);
1383
1963
  try {
1384
- parsed = JSON.parse(raw);
1964
+ fs6.writeFileSync(patchPath, renderChromeDevtoolsAutoConnectPatchSource(), { mode: 384 });
1965
+ return patchPath;
1385
1966
  } catch {
1386
- fail();
1967
+ return void 0;
1387
1968
  }
1388
- if (!parsed || typeof parsed !== 'object' || Array.isArray(parsed)) fail();
1389
- const entries = Object.entries(parsed);
1390
- if (entries.length !== 1 || entries[0]?.[0] !== 'Authorization') fail();
1391
- const authorization = entries[0]?.[1];
1392
- if (typeof authorization !== 'string' || !/^Bearer [A-Za-z0-9_-]{43}$/u.test(authorization)) fail();
1393
-
1394
- const terminatorIndex = process.argv.indexOf('--', 2);
1395
- const insertionIndex = terminatorIndex >= 0 ? terminatorIndex : process.argv.length;
1396
- process.argv.splice(insertionIndex, 0, '--wsHeaders', JSON.stringify({ Authorization: authorization }));
1397
- }
1398
- `;
1399
1969
  }
1400
1970
 
1401
- // node_modules/.pnpm/mcporter@0.13.8/node_modules/mcporter/dist/runtime/cached-auth.js
1971
+ // node_modules/.pnpm/mcporter@0.13.13/node_modules/mcporter/dist/runtime/cached-auth.js
1402
1972
  function hasAuthorizationHeader(headers) {
1403
1973
  return Boolean(headers && Object.keys(headers).some((key) => key.toLowerCase() === "authorization"));
1404
1974
  }
@@ -1461,15 +2031,15 @@ async function applyCachedAuthIfAvailable(definition, logger, allowCachedAuth) {
1461
2031
  }
1462
2032
  }
1463
2033
 
1464
- // node_modules/.pnpm/mcporter@0.13.8/node_modules/mcporter/dist/runtime-header-utils.js
1465
- function materializeHeaders(headers, serverName) {
2034
+ // node_modules/.pnpm/mcporter@0.13.13/node_modules/mcporter/dist/runtime-header-utils.js
2035
+ function materializeHeaders(headers, serverName, env = process.env) {
1466
2036
  if (!headers) {
1467
2037
  return void 0;
1468
2038
  }
1469
2039
  const resolved = {};
1470
2040
  for (const [key, value] of Object.entries(headers)) {
1471
2041
  try {
1472
- resolved[key] = resolveEnvPlaceholders(value);
2042
+ resolved[key] = resolveEnvPlaceholders(value, env);
1473
2043
  } catch (error) {
1474
2044
  const message = error instanceof Error ? error.message : String(error);
1475
2045
  throw new Error(`Failed to resolve header '${key}' for server '${serverName}': ${message}`, { cause: error });
@@ -1478,7 +2048,7 @@ function materializeHeaders(headers, serverName) {
1478
2048
  return resolved;
1479
2049
  }
1480
2050
 
1481
- // node_modules/.pnpm/mcporter@0.13.8/node_modules/mcporter/dist/runtime/node-http-fetch.js
2051
+ // node_modules/.pnpm/mcporter@0.13.13/node_modules/mcporter/dist/runtime/node-http-fetch.js
1482
2052
  import http from "node:http";
1483
2053
  import https from "node:https";
1484
2054
  import { Buffer as Buffer2 } from "node:buffer";
@@ -1637,7 +2207,7 @@ async function materializeRequestBody(body) {
1637
2207
  throw new TypeError("node-http1 fetch does not support streaming request bodies.");
1638
2208
  }
1639
2209
 
1640
- // node_modules/.pnpm/mcporter@0.13.8/node_modules/mcporter/dist/runtime/http-transport.js
2210
+ // node_modules/.pnpm/mcporter@0.13.13/node_modules/mcporter/dist/runtime/http-transport.js
1641
2211
  function extractTransportStatusCode(error) {
1642
2212
  if (!error || typeof error !== "object")
1643
2213
  return void 0;
@@ -1688,7 +2258,7 @@ function createHttpTransportOptions(definition, oauthSession, shouldEstablishOAu
1688
2258
  const command = definition.command;
1689
2259
  if (command.kind !== "http")
1690
2260
  throw new Error(`Server '${definition.name}' is not configured for HTTP transport.`);
1691
- const resolvedHeaders = materializeHeaders(command.headers, definition.name);
2261
+ const resolvedHeaders = materializeHeaders(command.headers, definition.name, definition.env);
1692
2262
  const effectiveHeaders = shouldEstablishOAuth ? removeAuthorizationHeader(resolvedHeaders) : resolvedHeaders;
1693
2263
  const trackedFetch = trackStandaloneSseFetch(resolveHttpFetchOverride(definition));
1694
2264
  return {
@@ -1699,10 +2269,7 @@ function createHttpTransportOptions(definition, oauthSession, shouldEstablishOAu
1699
2269
  };
1700
2270
  }
1701
2271
  function trackStandaloneSseFetch(fetchOverride) {
1702
- let markStarted;
1703
- const started = new Promise((resolve) => {
1704
- markStarted = resolve;
1705
- });
2272
+ const { promise: started, resolve: markStarted } = Promise.withResolvers();
1706
2273
  const baseFetch = fetchOverride ?? ((input, init) => fetch(input, init));
1707
2274
  return {
1708
2275
  started,
@@ -1763,8 +2330,7 @@ async function connectHttpTransport(client, transport, oauthSession, logger, con
1763
2330
  return await connectWithAuth(client, transport, oauthSession, logger, connectOptions);
1764
2331
  } catch (error) {
1765
2332
  if (!connectOptions.signal?.aborted) {
1766
- await closeTransportAndWait(logger, transport).catch(() => {
1767
- });
2333
+ await closeTransportAndWait(logger, transport, { throwOnCloseError: true, requireRetirement: true });
1768
2334
  }
1769
2335
  throw error;
1770
2336
  }
@@ -1861,227 +2427,25 @@ async function connectSseFallbackTransport(client, definition, command, transpor
1861
2427
  }
1862
2428
  }
1863
2429
 
1864
- // node_modules/.pnpm/@modelcontextprotocol+client@2.0.0/node_modules/@modelcontextprotocol/client/dist/stdio.mjs
1865
- var import_cross_spawn = __toESM(require_cross_spawn(), 1);
1866
- import process2 from "node:process";
1867
- import { PassThrough } from "node:stream";
1868
- var DEFAULT_INHERITED_ENV_VARS = process2.platform === "win32" ? [
1869
- "APPDATA",
1870
- "HOMEDRIVE",
1871
- "HOMEPATH",
1872
- "LOCALAPPDATA",
1873
- "PATH",
1874
- "PROCESSOR_ARCHITECTURE",
1875
- "SYSTEMDRIVE",
1876
- "SYSTEMROOT",
1877
- "TEMP",
1878
- "USERNAME",
1879
- "USERPROFILE",
1880
- "PROGRAMFILES"
1881
- ] : [
1882
- "HOME",
1883
- "LOGNAME",
1884
- "PATH",
1885
- "SHELL",
1886
- "TERM",
1887
- "USER"
1888
- ];
1889
- function getDefaultEnvironment() {
1890
- const env = {};
1891
- for (const key of DEFAULT_INHERITED_ENV_VARS) {
1892
- const value = process2.env[key];
1893
- if (value === void 0) continue;
1894
- if (value.startsWith("()")) continue;
1895
- env[key] = value;
1896
- }
1897
- return env;
1898
- }
1899
- var StdioClientTransport = class {
1900
- _process;
1901
- _readBuffer;
1902
- _serverParams;
1903
- _stderrStream = null;
1904
- onclose;
1905
- onerror;
1906
- onmessage;
1907
- constructor(server) {
1908
- this._serverParams = server;
1909
- this._readBuffer = new ReadBuffer({ maxBufferSize: server.maxBufferSize });
1910
- if (server.stderr === "pipe" || server.stderr === "overlapped") this._stderrStream = new PassThrough();
1911
- }
1912
- /**
1913
- * Starts the server process and prepares to communicate with it.
1914
- */
1915
- async start() {
1916
- if (this._process) throw new Error("StdioClientTransport already started! If using Client class, note that connect() calls start() automatically.");
1917
- return new Promise((resolve, reject) => {
1918
- this._process = (0, import_cross_spawn.default)(this._serverParams.command, this._serverParams.args ?? [], {
1919
- env: {
1920
- ...getDefaultEnvironment(),
1921
- ...this._serverParams.env
1922
- },
1923
- stdio: [
1924
- "pipe",
1925
- "pipe",
1926
- this._serverParams.stderr ?? "inherit"
1927
- ],
1928
- shell: false,
1929
- windowsHide: process2.platform === "win32",
1930
- cwd: this._serverParams.cwd
1931
- });
1932
- this._process.on("error", (error) => {
1933
- reject(error);
1934
- this.onerror?.(error);
1935
- });
1936
- this._process.on("spawn", () => {
1937
- resolve();
1938
- });
1939
- this._process.on("close", (_code) => {
1940
- this._process = void 0;
1941
- this.onclose?.();
1942
- });
1943
- this._process.stdin?.on("error", (error) => {
1944
- this.onerror?.(error);
1945
- });
1946
- this._process.stdout?.on("data", (chunk) => {
1947
- try {
1948
- this._readBuffer.append(chunk);
1949
- this.processReadBuffer();
1950
- } catch (error) {
1951
- this.onerror?.(error);
1952
- this.close().catch(() => {
1953
- });
1954
- }
1955
- });
1956
- this._process.stdout?.on("error", (error) => {
1957
- this.onerror?.(error);
1958
- });
1959
- if (this._stderrStream && this._process.stderr) this._process.stderr.pipe(this._stderrStream);
1960
- });
1961
- }
1962
- /**
1963
- * The `stderr` stream of the child process, if {@linkcode StdioServerParameters.stderr} was set to `"pipe"` or `"overlapped"`.
1964
- *
1965
- * If `stderr` piping was requested, a `PassThrough` stream is returned _immediately_, allowing callers to
1966
- * attach listeners before the `start` method is invoked. This prevents loss of any early
1967
- * error output emitted by the child process.
1968
- */
1969
- get stderr() {
1970
- if (this._stderrStream) return this._stderrStream;
1971
- return this._process?.stderr ?? null;
1972
- }
1973
- /**
1974
- * The child process pid spawned by this transport.
1975
- *
1976
- * This is only available after the transport has been started.
1977
- */
1978
- get pid() {
1979
- return this._process?.pid ?? null;
1980
- }
1981
- processReadBuffer() {
1982
- while (true) try {
1983
- const message = this._readBuffer.readMessage();
1984
- if (message === null) break;
1985
- this.onmessage?.(message);
1986
- } catch (error) {
1987
- this.onerror?.(error);
1988
- }
1989
- }
1990
- /**
1991
- * Reap a disposable probe sibling (see the version-negotiation sibling
1992
- * flow): signal-first teardown awaiting process `exit` — never the `close`
1993
- * event, so a helper process holding the child's stdio pipes can never
1994
- * block disposal. Not part of the public transport lifecycle.
1995
- *
1996
- * @internal
1997
- */
1998
- async _dispose() {
1999
- const proc = this._process;
2000
- this._process = void 0;
2001
- if (proc && proc.exitCode === null && proc.signalCode === null) {
2002
- const exited = new Promise((resolve) => proc.once("exit", () => resolve()));
2003
- try {
2004
- proc.stdin?.end();
2005
- } catch {
2006
- }
2007
- try {
2008
- proc.kill("SIGTERM");
2009
- } catch {
2010
- }
2011
- await Promise.race([exited, new Promise((resolve) => setTimeout(resolve, 1e3).unref())]);
2012
- if (proc.exitCode === null && proc.signalCode === null) try {
2013
- proc.kill("SIGKILL");
2014
- } catch {
2015
- }
2016
- await exited;
2017
- }
2018
- try {
2019
- proc?.stdout?.destroy();
2020
- } catch {
2021
- }
2022
- try {
2023
- proc?.stdin?.destroy();
2024
- } catch {
2025
- }
2026
- try {
2027
- proc?.stderr?.destroy();
2028
- } catch {
2029
- }
2030
- this._readBuffer.clear();
2031
- }
2032
- async close() {
2033
- if (this._process) {
2034
- const processToClose = this._process;
2035
- this._process = void 0;
2036
- const closePromise = new Promise((resolve) => {
2037
- processToClose.once("close", () => {
2038
- resolve();
2039
- });
2040
- });
2041
- try {
2042
- processToClose.stdin?.end();
2043
- } catch {
2044
- }
2045
- await Promise.race([closePromise, new Promise((resolve) => setTimeout(resolve, 2e3).unref())]);
2046
- if (processToClose.exitCode === null) {
2047
- try {
2048
- processToClose.kill("SIGTERM");
2049
- } catch {
2050
- }
2051
- await Promise.race([closePromise, new Promise((resolve) => setTimeout(resolve, 2e3).unref())]);
2052
- }
2053
- if (processToClose.exitCode === null) try {
2054
- processToClose.kill("SIGKILL");
2055
- } catch {
2056
- }
2057
- }
2058
- this._readBuffer.clear();
2059
- }
2060
- send(message) {
2061
- return new Promise((resolve) => {
2062
- if (!this._process?.stdin) throw new SdkError(SdkErrorCode.NotConnected, "Not connected");
2063
- const json = serializeMessage(message);
2064
- if (this._process.stdin.write(json)) resolve();
2065
- else this._process.stdin.once("drain", resolve);
2066
- });
2067
- }
2068
- };
2069
-
2070
- // node_modules/.pnpm/mcporter@0.13.8/node_modules/mcporter/dist/runtime/stdio-transport.js
2430
+ // node_modules/.pnpm/mcporter@0.13.13/node_modules/mcporter/dist/runtime/stdio-transport.js
2071
2431
  var McporterStdioTransport = class extends StdioClientTransport {
2072
2432
  parameters;
2073
2433
  meta;
2074
2434
  closing = false;
2435
+ closePromise;
2436
+ closeNotified = false;
2075
2437
  closeDelegate;
2076
2438
  messageDelegate;
2077
2439
  closeInterceptor = () => {
2078
2440
  this.meta.code = this.closing ? 0 : 1;
2079
2441
  flushStdioLogs(this.meta);
2080
2442
  void this.cleanup();
2081
- this.closeDelegate?.();
2443
+ this.notifyClosed();
2082
2444
  };
2083
2445
  messageInterceptor = (message) => {
2084
- if (STDIO_TRACE_ENABLED)
2446
+ if (this.parameters.lifetime?.aborted)
2447
+ return;
2448
+ if (STDIO_TRACE_ENABLED && !this.parameters.redactDiagnostics)
2085
2449
  this.meta.stdoutChunks?.push(JSON.stringify(message));
2086
2450
  this.messageDelegate?.(message);
2087
2451
  };
@@ -2101,7 +2465,8 @@ var McporterStdioTransport = class extends StdioClientTransport {
2101
2465
  if (stderr) {
2102
2466
  stderr.setEncoding?.("utf8");
2103
2467
  const handleChunk = (chunk) => {
2104
- this.meta.stderrChunks.push(Buffer.isBuffer(chunk) ? chunk.toString("utf8") : String(chunk));
2468
+ if (!this.parameters.redactDiagnostics)
2469
+ this.meta.stderrChunks.push(Buffer.isBuffer(chunk) ? chunk.toString("utf8") : String(chunk));
2105
2470
  };
2106
2471
  stderr.on("data", handleChunk);
2107
2472
  stderr.on("error", ignoreStdioEmitterError);
@@ -2109,24 +2474,34 @@ var McporterStdioTransport = class extends StdioClientTransport {
2109
2474
  }
2110
2475
  }
2111
2476
  async start() {
2112
- if (STDIO_TRACE_ENABLED)
2477
+ this.assertOpen();
2478
+ if (STDIO_TRACE_ENABLED && !this.parameters.redactDiagnostics)
2113
2479
  console.log("[mcporter] STDIO trace: start() invoked for stdio transport.");
2114
2480
  this.installInterceptors();
2115
2481
  await super.start();
2116
- if (STDIO_TRACE_ENABLED) {
2482
+ this.assertOpen();
2483
+ if (STDIO_TRACE_ENABLED && !this.parameters.redactDiagnostics) {
2117
2484
  console.log(`[mcporter] STDIO trace: spawned ${this.meta.command ?? "stdio server"} (pid=${this.pid ?? "unknown"}).`);
2118
2485
  }
2119
2486
  }
2120
2487
  async send(message) {
2488
+ this.assertOpen();
2121
2489
  this.installInterceptors();
2122
- if (STDIO_TRACE_ENABLED)
2490
+ if (STDIO_TRACE_ENABLED && !this.parameters.redactDiagnostics)
2123
2491
  this.meta.stdinChunks?.push(JSON.stringify(message));
2124
2492
  await super.send(message);
2125
2493
  }
2126
- async close() {
2494
+ close() {
2495
+ if (this.closePromise)
2496
+ return this.closePromise;
2127
2497
  this.closing = true;
2128
2498
  this.installInterceptors();
2499
+ this.closePromise = this.closeOnce();
2500
+ return this.closePromise;
2501
+ }
2502
+ async closeOnce() {
2129
2503
  try {
2504
+ await this.parameters.prepareClose?.();
2130
2505
  await super.close();
2131
2506
  } finally {
2132
2507
  this.meta.code ??= 0;
@@ -2134,6 +2509,20 @@ var McporterStdioTransport = class extends StdioClientTransport {
2134
2509
  await this.cleanup();
2135
2510
  }
2136
2511
  }
2512
+ assertOpen() {
2513
+ if (this.closing || this.parameters.lifetime?.aborted)
2514
+ throw new SdkError(SdkErrorCode.ConnectionClosed, "Transport connection closed.");
2515
+ }
2516
+ notifyClosed() {
2517
+ if (this.closeNotified)
2518
+ return;
2519
+ this.closeNotified = true;
2520
+ this.closeDelegate?.();
2521
+ }
2522
+ notifyConnectionClosed() {
2523
+ this.installInterceptors();
2524
+ this.notifyClosed();
2525
+ }
2137
2526
  cleanup() {
2138
2527
  this.cleanupPromise ??= Promise.resolve(this.parameters.cleanup?.()).catch(() => {
2139
2528
  });
@@ -2151,7 +2540,7 @@ var McporterStdioTransport = class extends StdioClientTransport {
2151
2540
  }
2152
2541
  };
2153
2542
 
2154
- // node_modules/.pnpm/mcporter@0.13.8/node_modules/mcporter/dist/runtime/transport.js
2543
+ // node_modules/.pnpm/mcporter@0.13.13/node_modules/mcporter/dist/runtime/transport.js
2155
2544
  function shouldUseModeForServer(definition, serverFilter) {
2156
2545
  return !serverFilter || serverFilter === definition.name;
2157
2546
  }
@@ -2212,9 +2601,16 @@ async function createReplayClientContext(definition, replayPath, clientInfo, opt
2212
2601
  return { client, transport, definition, oauthSession: void 0 };
2213
2602
  }
2214
2603
  async function createStdioClientContext(client, definition, logger, options) {
2215
- const mergedEnv = resolveChromeDevtoolsRelayEnvironment(definition.env);
2216
- const command = resolveCommandArgument(definition.command.command);
2217
- const resolvedArgs = resolveCommandArguments(definition.command.args);
2604
+ const mergedEnv = {
2605
+ ...Object.fromEntries(DEFAULT_INHERITED_ENV_VARS.map((key) => [key, void 0])),
2606
+ ...definition.env
2607
+ };
2608
+ if (isBrokerDefinition(definition) && isExistingChromeDefinition(definition) && resolveChromeDevtoolsRelayPolicy(definition.chromeDevtoolsRelay, definition.env) !== "off") {
2609
+ mergedEnv.MCPORTER_CHROME_DEVTOOLS_RELAY_POLICY = "require";
2610
+ delete mergedEnv.MCPORTER_DISABLE_CHROME_DEVTOOLS_RELAY;
2611
+ }
2612
+ const command = resolveCommandArgument(definition.command.command, mergedEnv);
2613
+ const resolvedArgs = resolveCommandArguments(definition.command.args, mergedEnv);
2218
2614
  const publishRelayDecision = (decision) => {
2219
2615
  if (decision.reason === "not-eligible")
2220
2616
  return;
@@ -2224,7 +2620,7 @@ async function createStdioClientContext(client, definition, logger, options) {
2224
2620
  let relayDecision;
2225
2621
  let relay;
2226
2622
  try {
2227
- relay = await rewriteChromeDevtoolsArgsForRelay(command, resolvedArgs, mergedEnv, { onDecision: (decision) => relayDecision = decision }, definition.chromeDevtoolsRelay);
2623
+ relay = await rewriteChromeDevtoolsArgsForRelay(command, resolvedArgs, mergedEnv, { onDecision: (decision) => relayDecision = decision }, isBrokerDefinition(definition) && isExistingChromeDefinition(definition) && resolveChromeDevtoolsRelayPolicy(definition.chromeDevtoolsRelay, definition.env) !== "off" ? "require" : definition.chromeDevtoolsRelay);
2228
2624
  } catch (error) {
2229
2625
  if (relayDecision)
2230
2626
  publishRelayDecision(relayDecision);
@@ -2234,6 +2630,9 @@ async function createStdioClientContext(client, definition, logger, options) {
2234
2630
  let activeProxy = relay.proxy;
2235
2631
  let handoff;
2236
2632
  let rawTransport;
2633
+ let processTree;
2634
+ const captureProcesses = () => processTree ??= captureTransportProcessTree(rawTransport);
2635
+ let onProxyClosed;
2237
2636
  try {
2238
2637
  if (activeProxy) {
2239
2638
  try {
@@ -2266,7 +2665,12 @@ async function createStdioClientContext(client, definition, logger, options) {
2266
2665
  args: commandArgs,
2267
2666
  cwd: definition.command.cwd,
2268
2667
  env: compat.env,
2668
+ redactDiagnostics: isBrokerDefinition(definition),
2669
+ lifetime: activeProxy?.signal,
2670
+ prepareClose: activeProxy ? async () => void await captureProcesses() : void 0,
2269
2671
  cleanup: activeProxy ? async () => {
2672
+ if (onProxyClosed)
2673
+ activeProxy?.signal.removeEventListener("abort", onProxyClosed);
2270
2674
  await handoff?.close();
2271
2675
  await activeProxy?.close();
2272
2676
  } : void 0
@@ -2282,15 +2686,40 @@ async function createStdioClientContext(client, definition, logger, options) {
2282
2686
  try {
2283
2687
  transport = wrapRecordTransport(rawTransport, definition, options);
2284
2688
  } catch (error) {
2285
- await closeTransportAndWait(logger, rawTransport).catch(() => {
2286
- });
2689
+ await closeTransportAndWait(logger, rawTransport, { throwOnCloseError: true, requireRetirement: true });
2287
2690
  throw error;
2288
2691
  }
2692
+ let connected = false;
2693
+ let setupRetirement;
2694
+ const retireSetup = () => setupRetirement ??= (async () => {
2695
+ const captured = await captureProcesses();
2696
+ await closeTransportAndWait(logger, transport, {
2697
+ throwOnCloseError: true,
2698
+ requireRetirement: true,
2699
+ processTree: captured
2700
+ });
2701
+ })();
2702
+ onProxyClosed = () => {
2703
+ if (connected) {
2704
+ rawTransport.notifyConnectionClosed();
2705
+ } else {
2706
+ void retireSetup().catch(() => {
2707
+ });
2708
+ }
2709
+ };
2710
+ activeProxy?.signal.addEventListener("abort", onProxyClosed, { once: true });
2711
+ if (activeProxy?.signal.aborted)
2712
+ onProxyClosed();
2289
2713
  try {
2290
2714
  await client.connect(transport, { signal: options.signal });
2715
+ if (activeProxy?.signal.aborted)
2716
+ throw new SdkError(SdkErrorCode.ConnectionClosed, "Chrome relay connection closed during setup.");
2717
+ connected = true;
2291
2718
  } catch (error) {
2292
- await closeTransportAndWait(logger, transport).catch(() => {
2293
- });
2719
+ const upstreamLost = activeProxy?.signal.aborted && activeProxy.signal.reason === "upstream";
2720
+ await retireSetup();
2721
+ if (upstreamLost)
2722
+ throw new SdkError(SdkErrorCode.ConnectionClosed, "Chrome relay connection closed during setup.");
2294
2723
  throw error;
2295
2724
  }
2296
2725
  return { client, transport, definition, oauthSession: void 0 };
@@ -2299,8 +2728,10 @@ async function createClientContext(definition, logger, clientInfo, options = {})
2299
2728
  if (options.replayPath && shouldUseModeForServer(definition, process.env.MCPORTER_REPLAY_SERVER)) {
2300
2729
  return createReplayClientContext(definition, options.replayPath, clientInfo, options);
2301
2730
  }
2302
- const activeDefinition = await applyCachedAuthIfAvailable(definition, logger, options.allowCachedAuth);
2303
- return withEnvOverrides(activeDefinition.env, async () => {
2731
+ assertChromeBrokerAuthority(definition);
2732
+ const env = isBrokerDefinition(definition) ? definition.env : resolveChromeDevtoolsRelayEnvironment(definition.env);
2733
+ return withRuntimeEnvironment(env ?? {}, async () => {
2734
+ const activeDefinition = await applyCachedAuthIfAvailable({ ...definition, env }, logger, options.allowCachedAuth);
2304
2735
  if (activeDefinition.command.kind === "stdio") {
2305
2736
  const stdioDefinition = activeDefinition;
2306
2737
  try {
@@ -2327,7 +2758,7 @@ async function createClientContext(definition, logger, clientInfo, options = {})
2327
2758
  });
2328
2759
  }
2329
2760
 
2330
- // node_modules/.pnpm/mcporter@0.13.8/node_modules/mcporter/dist/runtime/connection-cache.js
2761
+ // node_modules/.pnpm/mcporter@0.13.13/node_modules/mcporter/dist/runtime/connection-cache.js
2331
2762
  var RuntimeConnectionCache = class {
2332
2763
  definitions;
2333
2764
  options;
@@ -2704,11 +3135,12 @@ var RuntimeConnectionCache = class {
2704
3135
  }
2705
3136
  }
2706
3137
  async closeContext(context) {
2707
- const propagateReplayCloseErrors = context.transport instanceof ReplayTransport;
3138
+ const propagateReplayCloseErrors = context.transport instanceof ReplayTransport || isBrokerDefinition(context.definition);
2708
3139
  let closeError;
2709
3140
  try {
2710
3141
  await closeTransportAndWait(this.logger, context.transport, {
2711
3142
  throwOnCloseError: propagateReplayCloseErrors,
3143
+ requireRetirement: isBrokerDefinition(context.definition),
2712
3144
  close: async () => {
2713
3145
  let firstError;
2714
3146
  const clientClose = context.client.close;
@@ -2741,7 +3173,7 @@ var RuntimeConnectionCache = class {
2741
3173
  }
2742
3174
  }
2743
3175
  async resetConnectionOnError(server, error, failedContext) {
2744
- if (!shouldResetConnection(error)) {
3176
+ if (isBrokerDefinition(this.definitions.get(server.trim())) || !shouldResetConnection(error)) {
2745
3177
  return;
2746
3178
  }
2747
3179
  const normalized = server.trim();
@@ -2845,10 +3277,7 @@ var RuntimeConnectionCache = class {
2845
3277
  }
2846
3278
  async enterConnectionSetup(server) {
2847
3279
  const previous = this.connectionSetupTails.get(server) ?? Promise.resolve();
2848
- let releaseCurrent;
2849
- const current = new Promise((resolve) => {
2850
- releaseCurrent = resolve;
2851
- });
3280
+ const { promise: current, resolve: releaseCurrent } = Promise.withResolvers();
2852
3281
  const tail = previous.catch(() => {
2853
3282
  }).then(() => current);
2854
3283
  this.connectionSetupTails.set(server, tail);
@@ -2880,7 +3309,7 @@ function connectionInfoFromClient(client) {
2880
3309
  };
2881
3310
  }
2882
3311
 
2883
- // node_modules/.pnpm/mcporter@0.13.8/node_modules/mcporter/dist/tool-filters.js
3312
+ // node_modules/.pnpm/mcporter@0.13.13/node_modules/mcporter/dist/tool-filters.js
2884
3313
  function validateToolFilters(name, filter) {
2885
3314
  if (filter.allowedTools !== void 0 && filter.blockedTools !== void 0) {
2886
3315
  throw new Error(`Server '${name}' cannot specify both allowedTools and blockedTools.`);
@@ -2902,7 +3331,7 @@ function filterTools(tools, filter) {
2902
3331
  return tools.filter((tool) => isToolAllowed(tool.name, filter));
2903
3332
  }
2904
3333
 
2905
- // node_modules/.pnpm/mcporter@0.13.8/node_modules/mcporter/dist/runtime.js
3334
+ // node_modules/.pnpm/mcporter@0.13.13/node_modules/mcporter/dist/runtime.js
2906
3335
  var PACKAGE_NAME = "mcporter";
2907
3336
  var OAUTH_CODE_TIMEOUT_MS = resolveOAuthTimeoutFromEnv();
2908
3337
  var MAX_RESOURCE_LIST_PAGES = 100;
@@ -2929,6 +3358,7 @@ var McpRuntime = class {
2929
3358
  definitions;
2930
3359
  connectionCache;
2931
3360
  logger;
3361
+ clientInfo;
2932
3362
  constructor(servers, options = {}) {
2933
3363
  for (const server of servers) {
2934
3364
  validateToolFilters(server.name, server);
@@ -2939,6 +3369,7 @@ var McpRuntime = class {
2939
3369
  name: PACKAGE_NAME,
2940
3370
  version: MCPORTER_VERSION
2941
3371
  };
3372
+ this.clientInfo = clientInfo;
2942
3373
  const recordSession = process.env.MCPORTER_RECORD;
2943
3374
  const replaySession = process.env.MCPORTER_REPLAY;
2944
3375
  if (recordSession && replaySession) {
@@ -2964,6 +3395,9 @@ var McpRuntime = class {
2964
3395
  elicitationHandler: options.elicitationHandler ?? defaultResponder.handler
2965
3396
  });
2966
3397
  }
3398
+ getClientInfo() {
3399
+ return { ...this.clientInfo };
3400
+ }
2967
3401
  // listServers returns configured names sorted alphabetically for stable CLI output.
2968
3402
  listServers() {
2969
3403
  return [...this.definitions.keys()].toSorted((a, b) => a.localeCompare(b));
@@ -3013,6 +3447,7 @@ var McpRuntime = class {
3013
3447
  let closeError;
3014
3448
  let tools = [];
3015
3449
  try {
3450
+ await validateBrokerRequestAuthority(this.definitions.get(server.trim()));
3016
3451
  const listPromise = context.client.listTools(void 0, timeoutMs ? { timeout: timeoutMs, resetTimeoutOnProgress: true, maxTotalTimeout: timeoutMs } : void 0);
3017
3452
  const response = timeoutMs ? await raceWithTimeout(listPromise, timeoutMs) : await listPromise;
3018
3453
  tools = (response.tools ?? []).map((tool) => ({
@@ -3057,6 +3492,7 @@ var McpRuntime = class {
3057
3492
  arguments: options.args ?? {}
3058
3493
  };
3059
3494
  const timeoutMs = normalizeTimeout(options.timeoutMs);
3495
+ await validateBrokerRequestAuthority(definition);
3060
3496
  const resultPromise = client.callTool(params, {
3061
3497
  timeout: timeoutMs,
3062
3498
  // Long runs (e.g., GPT-5 Pro) emit progress/logging; allow that to refresh the timer.
@@ -3086,8 +3522,10 @@ var McpRuntime = class {
3086
3522
  const { client } = context;
3087
3523
  const requestParams = params;
3088
3524
  if (requestParams.cursor !== void 0) {
3525
+ await validateBrokerRequestAuthority(this.definitions.get(server.trim()));
3089
3526
  return await client.listResources(requestParams);
3090
3527
  }
3528
+ await validateBrokerRequestAuthority(this.definitions.get(server.trim()));
3091
3529
  let response = await client.request({ method: "resources/list", params: requestParams }, specTypeSchemas.ListResourcesResult);
3092
3530
  const resources = [...response.resources];
3093
3531
  const seenCursors = /* @__PURE__ */ new Set();
@@ -3095,6 +3533,7 @@ var McpRuntime = class {
3095
3533
  if (seenCursors.has(response.nextCursor))
3096
3534
  break;
3097
3535
  seenCursors.add(response.nextCursor);
3536
+ await validateBrokerRequestAuthority(this.definitions.get(server.trim()));
3098
3537
  response = await client.request({ method: "resources/list", params: { ...requestParams, cursor: response.nextCursor } }, specTypeSchemas.ListResourcesResult);
3099
3538
  resources.push(...response.resources);
3100
3539
  }
@@ -3114,6 +3553,7 @@ var McpRuntime = class {
3114
3553
  disableOAuth: effectiveDisableOAuth
3115
3554
  });
3116
3555
  const { client } = context;
3556
+ await validateBrokerRequestAuthority(this.definitions.get(server.trim()));
3117
3557
  return await client.readResource({ uri });
3118
3558
  } catch (error) {
3119
3559
  await this.resetConnectionOnError(server, error, context);
@@ -3144,6 +3584,23 @@ function createConsoleLogger(level = resolveLogLevelFromEnv()) {
3144
3584
  }
3145
3585
 
3146
3586
  export {
3587
+ effectiveDefinition,
3588
+ connectionIdentity,
3589
+ isExistingChromeDefinition,
3590
+ resolveSystemPowerShellPath,
3591
+ daemonRunDir,
3592
+ secureDaemonDirectory,
3593
+ inspectLegacyDaemonDirectory,
3594
+ upgradeLegacyDaemonDirectory,
3595
+ getDaemonMetadataPath,
3596
+ getDaemonSocketPath,
3597
+ getDaemonLogPath,
3598
+ BrowserOwnerConflict,
3599
+ canonicalUserConfiguration,
3600
+ BrowserOwner,
3601
+ authorizeBrokerDefinition,
3602
+ isToolAllowed,
3603
+ filterTools,
3147
3604
  createRuntime,
3148
3605
  callOnce
3149
3606
  };