@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.
- package/dist/api/mcp.d.ts +3 -3
- package/dist/api/mcp.d.ts.map +1 -1
- package/dist/api/mcp.js +1 -1
- package/dist/api/mcp.js.map +1 -1
- package/dist/{child-agent-completions.d.ts → child/agent-completions.d.ts} +2 -2
- package/dist/child/agent-completions.d.ts.map +1 -0
- package/dist/{child-agent-completions.js → child/agent-completions.js} +1 -1
- package/dist/child/agent-completions.js.map +1 -0
- package/dist/{child-agent-store.d.ts → child/agent-store.d.ts} +1 -1
- package/dist/child/agent-store.d.ts.map +1 -0
- package/dist/{child-agent-store.js → child/agent-store.js} +1 -1
- package/dist/child/agent-store.js.map +1 -0
- package/dist/{child-agent.d.ts → child/agent.d.ts} +2 -2
- package/dist/child/agent.d.ts.map +1 -0
- package/dist/{child-agent.js → child/agent.js} +5 -5
- package/dist/child/agent.js.map +1 -0
- package/dist/{child-session.d.ts → child/session.d.ts} +4 -4
- package/dist/child/session.d.ts.map +1 -0
- package/dist/{child-session.js → child/session.js} +2 -2
- package/dist/child/session.js.map +1 -0
- package/dist/connector-tools.d.ts +1 -1
- package/dist/connector-tools.js +2 -2
- package/dist/inspect.d.ts +1 -1
- package/dist/inspect.js +1 -1
- package/dist/{mcp-catalog.d.ts → mcp/catalog.d.ts} +3 -3
- package/dist/mcp/catalog.d.ts.map +1 -0
- package/dist/{mcp-catalog.js → mcp/catalog.js} +2 -2
- package/dist/mcp/catalog.js.map +1 -0
- package/dist/{mcp-command-context.d.ts → mcp/cli/command-context.d.ts} +1 -1
- package/dist/mcp/cli/command-context.d.ts.map +1 -0
- package/dist/{mcp-command-context.js → mcp/cli/command-context.js} +1 -1
- package/dist/mcp/cli/command-context.js.map +1 -0
- package/dist/{mcp-cli-core.d.ts → mcp/cli/core.d.ts} +14 -8
- package/dist/mcp/cli/core.d.ts.map +1 -0
- package/dist/{mcp-cli-core.js → mcp/cli/core.js} +105 -146
- package/dist/mcp/cli/core.js.map +1 -0
- package/dist/mcp/cli/help.d.ts +6 -0
- package/dist/mcp/cli/help.d.ts.map +1 -0
- package/dist/mcp/cli/help.js +116 -0
- package/dist/mcp/cli/help.js.map +1 -0
- package/dist/mcp/cli/index.d.ts +3 -0
- package/dist/mcp/cli/index.d.ts.map +1 -0
- package/dist/{mcp-cli.js → mcp/cli/index.js} +4 -4
- package/dist/mcp/cli/index.js.map +1 -0
- package/dist/{mcp-cli-policy.d.ts → mcp/cli/policy.d.ts} +2 -2
- package/dist/mcp/cli/policy.d.ts.map +1 -0
- package/dist/{mcp-cli-policy.js → mcp/cli/policy.js} +2 -2
- package/dist/mcp/cli/policy.js.map +1 -0
- package/dist/mcp/cli/run-worker.d.ts +2 -0
- package/dist/mcp/cli/run-worker.d.ts.map +1 -0
- package/dist/mcp/cli/run-worker.js +54 -0
- package/dist/mcp/cli/run-worker.js.map +1 -0
- package/dist/mcp/client-entry.d.ts +3 -0
- package/dist/mcp/client-entry.d.ts.map +1 -0
- package/dist/{mcp-client.js → mcp/client-entry.js} +3 -3
- package/dist/mcp/client-entry.js.map +1 -0
- package/dist/{mcp-contract.d.ts → mcp/contract.d.ts} +2 -2
- package/dist/mcp/contract.d.ts.map +1 -0
- package/dist/{mcp-contract.js → mcp/contract.js} +1 -1
- package/dist/mcp/contract.js.map +1 -0
- package/dist/{mcp-daemon-client.d.ts → mcp/daemon/client.d.ts} +3 -2
- package/dist/mcp/daemon/client.d.ts.map +1 -0
- package/dist/{mcp-daemon-client.js → mcp/daemon/client.js} +12 -8
- package/dist/mcp/daemon/client.js.map +1 -0
- package/dist/mcp/daemon/index.d.ts +3 -0
- package/dist/mcp/daemon/index.d.ts.map +1 -0
- package/dist/mcp/daemon/index.js +453 -0
- package/dist/{mcp-daemon.js.map → mcp/daemon/index.js.map} +1 -1
- package/dist/{mcp-daemon-protocol.d.ts → mcp/daemon/protocol.d.ts} +2 -2
- package/dist/mcp/daemon/protocol.d.ts.map +1 -0
- package/dist/{mcp-daemon-protocol.js → mcp/daemon/protocol.js} +1 -1
- package/dist/mcp/daemon/protocol.js.map +1 -0
- package/dist/{mcp.d.ts → mcp/index.d.ts} +5 -5
- package/dist/mcp/index.d.ts.map +1 -0
- package/dist/{mcp.js → mcp/index.js} +16 -10
- package/dist/mcp/index.js.map +1 -0
- package/dist/{mcp-policy.d.ts → mcp/policy.d.ts} +3 -3
- package/dist/mcp/policy.d.ts.map +1 -0
- package/dist/{mcp-policy.js → mcp/policy.js} +1 -1
- package/dist/mcp/policy.js.map +1 -0
- package/dist/{mcp-tools.d.ts → mcp/tools.d.ts} +4 -4
- package/dist/mcp/tools.d.ts.map +1 -0
- package/dist/{mcp-tools.js → mcp/tools.js} +4 -4
- package/dist/mcp/tools.js.map +1 -0
- package/dist/{mcp-trace-context.d.ts → mcp/trace-context.d.ts} +2 -2
- package/dist/mcp/trace-context.d.ts.map +1 -0
- package/dist/{mcp-trace-context.js → mcp/trace-context.js} +1 -1
- package/dist/mcp/trace-context.js.map +1 -0
- package/dist/mcp-chunks/{auth-command-4WFRNU2I.js → auth-command-GQFV6QYP.js} +24 -27
- package/dist/mcp-chunks/call-arguments-VT7JLNJY.js +16 -0
- package/dist/mcp-chunks/{call-command-JBIKXOGC.js → call-command-LMAREWKD.js} +45 -45
- package/dist/mcp-chunks/{chunk-3JGS7LQB.js → chunk-2HOMVWSA.js} +2 -2
- package/dist/mcp-chunks/{chunk-G6OMDUNG.js → chunk-2P2HVZ3G.js} +1 -1
- package/dist/mcp-chunks/{chunk-ED2WN5BI.js → chunk-34QXE62Y.js} +175 -147
- package/dist/mcp-chunks/{chunk-Y3EDWN2P.js → chunk-5B7GRMUK.js} +1 -1
- package/dist/mcp-chunks/chunk-5BMCVE2J.js +516 -0
- package/dist/mcp-chunks/{chunk-V5AYEKSL.js → chunk-6QZQZXDJ.js} +52 -81
- package/dist/mcp-chunks/{chunk-3R2WK3NB.js → chunk-6RG6AD5X.js} +6 -6
- package/dist/mcp-chunks/{chunk-SNKXMWDB.js → chunk-77BZYP72.js} +1 -1
- package/dist/mcp-chunks/chunk-7PFJCLXL.js +123 -0
- package/dist/mcp-chunks/chunk-7WL4TMON.js +31 -0
- package/dist/mcp-chunks/{chunk-ELA77TDC.js → chunk-C2VLY7ED.js} +4 -4
- package/dist/mcp-chunks/{chunk-FAJPJTOC.js → chunk-CLR6DJV3.js} +1 -1
- package/dist/mcp-chunks/{chunk-ZOAQDFAO.js → chunk-D6B2M5V7.js} +1 -1
- package/dist/mcp-chunks/{chunk-WTMJMM3B.js → chunk-D6SVCPN6.js} +3 -30
- package/dist/mcp-chunks/chunk-FBVRU4Y3.js +1195 -0
- package/dist/mcp-chunks/{chunk-EMSNQHZZ.js → chunk-FONFU4G5.js} +1 -1
- package/dist/mcp-chunks/{chunk-BWW4XRUC.js → chunk-H4KL74PV.js} +303 -161
- package/dist/mcp-chunks/{chunk-ITR7FQM3.js → chunk-H7ARMBV7.js} +4 -9
- package/dist/mcp-chunks/{chunk-EPT4MYOF.js → chunk-HZ2SX5U6.js} +39 -34
- package/dist/mcp-chunks/{chunk-36VIJRYY.js → chunk-I6UMKX5E.js} +4 -4
- package/dist/mcp-chunks/{chunk-ASG4OY3M.js → chunk-IF6LRV3J.js} +21 -28
- package/dist/mcp-chunks/{chunk-KW3ANJ36.js → chunk-JVYCENPP.js} +4 -4
- package/dist/mcp-chunks/{chunk-AIKLVBYU.js → chunk-KOWNVUL2.js} +34 -7
- package/dist/mcp-chunks/{chunk-B2LNXGAP.js → chunk-KQCLM7R7.js} +4 -4
- package/dist/mcp-chunks/{chunk-OP3IW2V6.js → chunk-L6OOGZVA.js} +2 -2
- package/dist/mcp-chunks/{chunk-MOEZ43ZL.js → chunk-LCBDVFVA.js} +1 -1
- package/dist/mcp-chunks/{chunk-ITCCROID.js → chunk-LIEFPSSB.js} +5 -5
- package/dist/mcp-chunks/{chunk-GUXMP7QB.js → chunk-LQIE4PKL.js} +2 -2
- package/dist/mcp-chunks/{chunk-WYLHHXI6.js → chunk-LXHPDKEF.js} +26 -11
- package/dist/mcp-chunks/{chunk-6YZW3XAE.js → chunk-MJFZM5EV.js} +5 -5
- package/dist/mcp-chunks/{chunk-TPHPAEDH.js → chunk-NQW3ES2G.js} +2 -8
- package/dist/mcp-chunks/{chunk-IPNSPKQK.js → chunk-O2VOMKAS.js} +15 -17
- package/dist/mcp-chunks/{chunk-QZUC2T72.js → chunk-O4JIUOWF.js} +2 -2
- package/dist/mcp-chunks/{chunk-C2KNLFZR.js → chunk-P3UVILEW.js} +2 -2
- package/dist/mcp-chunks/{chunk-7WOKCV6Q.js → chunk-P463YBJM.js} +1 -1
- package/dist/mcp-chunks/{chunk-GQ6NSIDS.js → chunk-PJCMJ65D.js} +1175 -718
- package/dist/mcp-chunks/{chunk-CZKDJZER.js → chunk-QALB3DRW.js} +1 -1
- package/dist/mcp-chunks/{chunk-JG4TRUPF.js → chunk-QJNF3A3F.js} +1 -1
- package/dist/mcp-chunks/{chunk-HLRCUHNO.js → chunk-RIHPVCGI.js} +1 -1
- package/dist/mcp-chunks/{chunk-RD7NHCRK.js → chunk-RZIJUJGL.js} +60 -1074
- package/dist/mcp-chunks/{chunk-4ZNBWL65.js → chunk-S2YF442K.js} +2 -2
- package/dist/mcp-chunks/chunk-S5F3HEZZ.js +37060 -0
- package/dist/mcp-chunks/{chunk-TF2YTYE4.js → chunk-S6GJ42I2.js} +1 -1
- package/dist/mcp-chunks/chunk-T4MQCFIK.js +982 -0
- package/dist/mcp-chunks/{chunk-SCOMDV54.js → chunk-TUQGOYK6.js} +1 -1
- package/dist/mcp-chunks/{chunk-YIRGLKDA.js → chunk-TYYSBILI.js} +46 -27
- package/dist/mcp-chunks/{chunk-FS5JIKT6.js → chunk-UHO6KIUJ.js} +6 -6
- package/dist/mcp-chunks/{chunk-RSTKSBVF.js → chunk-UIPG6W7N.js} +2 -2
- package/dist/mcp-chunks/{chunk-IME7DGLJ.js → chunk-UKM35J67.js} +2 -2
- package/dist/mcp-chunks/{chunk-FX5NYWBH.js → chunk-UYJZJXC2.js} +3 -3
- package/dist/mcp-chunks/{chunk-HCOKLSOB.js → chunk-VJIAHZZG.js} +4 -4
- package/dist/mcp-chunks/{chunk-IYWYVHHD.js → chunk-WHJUDBPR.js} +1 -1
- package/dist/mcp-chunks/{chunk-53NRFMB3.js → chunk-XNHGMWN2.js} +46 -25
- package/dist/mcp-chunks/{cli-XU26MUCN.js → cli-JI7MEAAX.js} +111 -79
- package/dist/mcp-chunks/client-QU7ABSNB.js +30 -0
- package/dist/mcp-chunks/{config-command-UQMMIK2U.js → config-command-GRZLKD3R.js} +36 -29
- package/dist/mcp-chunks/daemon-command-3266CYHO.js +30 -0
- package/dist/mcp-chunks/{dist-DM2RXZMU.js → dist-USMCQ22V.js} +105 -47
- package/dist/mcp-chunks/{emit-ts-command-KAOL6DAN.js → emit-ts-command-7VLESP7H.js} +20 -19
- package/dist/mcp-chunks/{generate-cli-runner-AK6XNRTK.js → generate-cli-runner-SSW2B72K.js} +54 -51
- package/dist/mcp-chunks/generated-daemon-runtime-7CFVWLC7.js +30 -0
- package/dist/mcp-chunks/{inspect-cli-command-6FVJO7H2.js → inspect-cli-command-NCGCMOIS.js} +9 -10
- package/dist/mcp-chunks/{launch-EIT73HX4.js → launch-NBONSPNK.js} +1 -1
- package/dist/mcp-chunks/{lifecycle-QH4TUI3K.js → lifecycle-CXAKUCN4.js} +1 -1
- package/dist/mcp-chunks/{list-command-UOB2XZK7.js → list-command-5T4UF4PF.js} +61 -75
- package/dist/mcp-chunks/{output-utils-6YXH23T7.js → output-utils-YFTWQZ5V.js} +3 -3
- package/dist/mcp-chunks/{prompt-CH6TK0bC-ZB6RFAXR.js → prompt-CH6TK0bC-6DI4RA4E.js} +1 -1
- package/dist/mcp-chunks/{record-command-FO5TTERC.js → record-command-TE5O7WBL.js} +5 -5
- package/dist/mcp-chunks/{replay-command-SCBPCGQ7.js → replay-command-QCUL5ASR.js} +6 -6
- package/dist/mcp-chunks/{resource-command-S2J7XEMV.js → resource-command-XMGF7EAK.js} +9 -10
- package/dist/mcp-chunks/{result-utils-OME6HGS6.js → result-utils-HKB42M7Y.js} +3 -4
- package/dist/mcp-chunks/runtime-3X2XVS6X.js +37 -0
- package/dist/mcp-chunks/runtime-wrapper-MI3HF45J.js +10 -0
- package/dist/mcp-chunks/{serve-command-DDBZZSG6.js → serve-command-5HV3ZE25.js} +30 -34
- package/dist/mcp-chunks/{timeouts-HNGNKDQN.js → timeouts-YBFBTLV2.js} +8 -5
- package/dist/mcp-chunks/{vault-command-TJZYS3YI.js → vault-command-FC2PD5U6.js} +4 -6
- package/dist/mcp-chunks/webapi-IFUPO72B.js +2481 -0
- package/dist/mcp-daemon.js +35 -33
- package/dist/mcp-run-worker.js +28 -32
- package/dist/pi-extension.d.ts +1 -1
- package/dist/pi-extension.js +8 -8
- package/dist/pi-extension.js.map +1 -1
- package/dist/{recipe-agent.d.ts → recipe/agent.d.ts} +3 -3
- package/dist/recipe/agent.d.ts.map +1 -0
- package/dist/{recipe-agent.js → recipe/agent.js} +5 -5
- package/dist/recipe/agent.js.map +1 -0
- package/dist/{recipe-extensions.d.ts → recipe/extensions.d.ts} +1 -1
- package/dist/recipe/extensions.d.ts.map +1 -0
- package/dist/{recipe-extensions.js → recipe/extensions.js} +1 -1
- package/dist/recipe/extensions.js.map +1 -0
- package/dist/{recipe-mcp-config.d.ts → recipe/mcp-config.d.ts} +2 -2
- package/dist/recipe/mcp-config.d.ts.map +1 -0
- package/dist/{recipe-mcp-config.js → recipe/mcp-config.js} +1 -1
- package/dist/recipe/mcp-config.js.map +1 -0
- package/dist/{recipe-model.d.ts → recipe/model.d.ts} +1 -1
- package/dist/recipe/model.d.ts.map +1 -0
- package/dist/{recipe-model.js → recipe/model.js} +1 -1
- package/dist/recipe/model.js.map +1 -0
- package/dist/{recipe-package.d.ts → recipe/package.d.ts} +1 -1
- package/dist/recipe/package.d.ts.map +1 -0
- package/dist/{recipe-package.js → recipe/package.js} +1 -1
- package/dist/recipe/package.js.map +1 -0
- package/dist/recipe/resolve.d.ts +6 -6
- package/dist/recipe/resolve.d.ts.map +1 -1
- package/dist/recipe/resolve.js +4 -4
- package/dist/recipe/resolve.js.map +1 -1
- package/dist/{recipe-session.d.ts → recipe/session.d.ts} +1 -1
- package/dist/recipe/session.d.ts.map +1 -0
- package/dist/{recipe-session.js → recipe/session.js} +1 -1
- package/dist/recipe/session.js.map +1 -0
- package/dist/{recipe-skills.d.ts → recipe/skills.d.ts} +1 -1
- package/dist/recipe/skills.d.ts.map +1 -0
- package/dist/{recipe-skills.js → recipe/skills.js} +2 -2
- package/dist/recipe/skills.js.map +1 -0
- package/dist/run-controller.js +2 -2
- package/dist/session.d.ts +1 -1
- package/dist/session.d.ts.map +1 -1
- package/dist/session.js +5 -5
- package/dist/session.js.map +1 -1
- package/docs/channels.md +1 -1
- package/docs/pi-extension.md +1 -1
- package/docs/recipe-format.md +8 -4
- package/docs/recipe-templates.md +46 -0
- package/docs/slack.md +1 -1
- package/package.json +14 -14
- package/dist/child-agent-completions.d.ts.map +0 -1
- package/dist/child-agent-completions.js.map +0 -1
- package/dist/child-agent-store.d.ts.map +0 -1
- package/dist/child-agent-store.js.map +0 -1
- package/dist/child-agent.d.ts.map +0 -1
- package/dist/child-agent.js.map +0 -1
- package/dist/child-session.d.ts.map +0 -1
- package/dist/child-session.js.map +0 -1
- package/dist/mcp-catalog.d.ts.map +0 -1
- package/dist/mcp-catalog.js.map +0 -1
- package/dist/mcp-chunks/call-arguments-4DWPBLQP.js +0 -15
- package/dist/mcp-chunks/chunk-3Z7MFS6K.js +0 -86
- package/dist/mcp-chunks/chunk-AD3FQ73K.js +0 -39
- package/dist/mcp-chunks/chunk-DTZHEVKC.js +0 -12
- package/dist/mcp-chunks/chunk-H3JCYHGS.js +0 -1018
- package/dist/mcp-chunks/chunk-HN7WPMCA.js +0 -18904
- package/dist/mcp-chunks/chunk-I5GI2A2D.js +0 -92
- package/dist/mcp-chunks/chunk-IRTJXFWA.js +0 -28
- package/dist/mcp-chunks/chunk-NTHUNCXJ.js +0 -526
- package/dist/mcp-chunks/chunk-OD3MSMXY.js +0 -15
- package/dist/mcp-chunks/chunk-PZ323CXI.js +0 -17394
- package/dist/mcp-chunks/client-OT34CKRH.js +0 -21
- package/dist/mcp-chunks/daemon-command-YCIOZGPZ.js +0 -35
- package/dist/mcp-chunks/runtime-QIPMLIJI.js +0 -39
- package/dist/mcp-chunks/runtime-wrapper-X4YFKMJI.js +0 -16
- package/dist/mcp-chunks/webapi-4GWO2UBA.js +0 -3508
- package/dist/mcp-cli-core.d.ts.map +0 -1
- package/dist/mcp-cli-core.js.map +0 -1
- package/dist/mcp-cli-help.d.ts +0 -2
- package/dist/mcp-cli-help.d.ts.map +0 -1
- package/dist/mcp-cli-help.js +0 -36
- package/dist/mcp-cli-help.js.map +0 -1
- package/dist/mcp-cli-policy.d.ts.map +0 -1
- package/dist/mcp-cli-policy.js.map +0 -1
- package/dist/mcp-cli.d.ts +0 -3
- package/dist/mcp-cli.d.ts.map +0 -1
- package/dist/mcp-cli.js.map +0 -1
- package/dist/mcp-client.d.ts +0 -3
- package/dist/mcp-client.d.ts.map +0 -1
- package/dist/mcp-client.js.map +0 -1
- package/dist/mcp-command-context.d.ts.map +0 -1
- package/dist/mcp-command-context.js.map +0 -1
- package/dist/mcp-contract.d.ts.map +0 -1
- package/dist/mcp-contract.js.map +0 -1
- package/dist/mcp-daemon-client.d.ts.map +0 -1
- package/dist/mcp-daemon-client.js.map +0 -1
- package/dist/mcp-daemon-protocol.d.ts.map +0 -1
- package/dist/mcp-daemon-protocol.js.map +0 -1
- package/dist/mcp-daemon.d.ts +0 -3
- package/dist/mcp-daemon.d.ts.map +0 -1
- package/dist/mcp-policy.d.ts.map +0 -1
- package/dist/mcp-policy.js.map +0 -1
- package/dist/mcp-run-worker.d.ts +0 -2
- package/dist/mcp-run-worker.d.ts.map +0 -1
- package/dist/mcp-run-worker.js.map +0 -1
- package/dist/mcp-tools.d.ts.map +0 -1
- package/dist/mcp-tools.js.map +0 -1
- package/dist/mcp-trace-context.d.ts.map +0 -1
- package/dist/mcp-trace-context.js.map +0 -1
- package/dist/mcp.d.ts.map +0 -1
- package/dist/mcp.js.map +0 -1
- package/dist/recipe-agent.d.ts.map +0 -1
- package/dist/recipe-agent.js.map +0 -1
- package/dist/recipe-extensions.d.ts.map +0 -1
- package/dist/recipe-extensions.js.map +0 -1
- package/dist/recipe-mcp-config.d.ts.map +0 -1
- package/dist/recipe-mcp-config.js.map +0 -1
- package/dist/recipe-model.d.ts.map +0 -1
- package/dist/recipe-model.js.map +0 -1
- package/dist/recipe-package.d.ts.map +0 -1
- package/dist/recipe-package.js.map +0 -1
- package/dist/recipe-session.d.ts.map +0 -1
- package/dist/recipe-session.js.map +0 -1
- package/dist/recipe-skills.d.ts.map +0 -1
- package/dist/recipe-skills.js.map +0 -1
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
import { createRequire as __createRequire } from "node:module"; const require = __createRequire(import.meta.url);
|
|
2
|
-
import {
|
|
3
|
-
resolveEnvPlaceholders
|
|
4
|
-
} from "./chunk-WTMJMM3B.js";
|
|
5
|
-
|
|
6
|
-
// node_modules/.pnpm/mcporter@0.13.8/node_modules/mcporter/dist/runtime/utils.js
|
|
7
|
-
var ENV_PLACEHOLDER_PATTERN = /\$\{(?:env:[^}]*|[A-Za-z_][A-Za-z0-9_]*(?::-[^}]*)?)\}/;
|
|
8
|
-
var MAX_TIMER_DELAY_MS = 2147483647;
|
|
9
|
-
function resolveCommandArgument(value, env = process.env) {
|
|
10
|
-
if (!value) {
|
|
11
|
-
return value;
|
|
12
|
-
}
|
|
13
|
-
if (!value.includes("$")) {
|
|
14
|
-
return value;
|
|
15
|
-
}
|
|
16
|
-
const needsInterpolation = value.startsWith("$env:") || ENV_PLACEHOLDER_PATTERN.test(value);
|
|
17
|
-
if (!needsInterpolation) {
|
|
18
|
-
return value;
|
|
19
|
-
}
|
|
20
|
-
return resolveEnvPlaceholders(value, env);
|
|
21
|
-
}
|
|
22
|
-
function resolveCommandArguments(args, env = process.env) {
|
|
23
|
-
if (args.length === 0) {
|
|
24
|
-
return [];
|
|
25
|
-
}
|
|
26
|
-
return args.map((arg) => resolveCommandArgument(arg, env));
|
|
27
|
-
}
|
|
28
|
-
function normalizeTimeout(raw) {
|
|
29
|
-
if (raw == null) {
|
|
30
|
-
return void 0;
|
|
31
|
-
}
|
|
32
|
-
if (!Number.isFinite(raw)) {
|
|
33
|
-
return void 0;
|
|
34
|
-
}
|
|
35
|
-
const coerced = Math.trunc(raw);
|
|
36
|
-
return coerced > 0 ? Math.min(coerced, MAX_TIMER_DELAY_MS) : void 0;
|
|
37
|
-
}
|
|
38
|
-
function raceWithTimeout(promise, timeoutMs) {
|
|
39
|
-
return new Promise((resolve, reject) => {
|
|
40
|
-
const delayMs = Number.isFinite(timeoutMs) ? Math.min(Math.max(Math.trunc(timeoutMs), 1), MAX_TIMER_DELAY_MS) : MAX_TIMER_DELAY_MS;
|
|
41
|
-
const cancelTimeout = scheduleDeadline(() => {
|
|
42
|
-
reject(new Error("Timeout"));
|
|
43
|
-
}, delayMs);
|
|
44
|
-
promise.then((value) => {
|
|
45
|
-
cancelTimeout();
|
|
46
|
-
resolve(value);
|
|
47
|
-
}, (error) => {
|
|
48
|
-
cancelTimeout();
|
|
49
|
-
reject(error);
|
|
50
|
-
});
|
|
51
|
-
});
|
|
52
|
-
}
|
|
53
|
-
function scheduleDeadline(callback, delayMs) {
|
|
54
|
-
const deadline = performance.now() + delayMs;
|
|
55
|
-
let timer;
|
|
56
|
-
let cancelled = false;
|
|
57
|
-
const scheduleNext = () => {
|
|
58
|
-
if (cancelled)
|
|
59
|
-
return;
|
|
60
|
-
const remainingMs = deadline - performance.now();
|
|
61
|
-
if (remainingMs <= 0) {
|
|
62
|
-
callback();
|
|
63
|
-
} else if (remainingMs > 864e5) {
|
|
64
|
-
timer = setTimeout(scheduleNext, 864e5);
|
|
65
|
-
} else if (remainingMs > 36e5) {
|
|
66
|
-
timer = setTimeout(scheduleNext, 36e5);
|
|
67
|
-
} else if (remainingMs > 6e4) {
|
|
68
|
-
timer = setTimeout(scheduleNext, 6e4);
|
|
69
|
-
} else if (remainingMs > 1e3) {
|
|
70
|
-
timer = setTimeout(scheduleNext, 1e3);
|
|
71
|
-
} else if (remainingMs > 100) {
|
|
72
|
-
timer = setTimeout(scheduleNext, 100);
|
|
73
|
-
} else if (remainingMs > 10) {
|
|
74
|
-
timer = setTimeout(scheduleNext, 10);
|
|
75
|
-
} else {
|
|
76
|
-
timer = setTimeout(scheduleNext, 1);
|
|
77
|
-
}
|
|
78
|
-
};
|
|
79
|
-
scheduleNext();
|
|
80
|
-
return () => {
|
|
81
|
-
cancelled = true;
|
|
82
|
-
if (timer)
|
|
83
|
-
clearTimeout(timer);
|
|
84
|
-
};
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
export {
|
|
88
|
-
resolveCommandArgument,
|
|
89
|
-
resolveCommandArguments,
|
|
90
|
-
normalizeTimeout,
|
|
91
|
-
raceWithTimeout
|
|
92
|
-
};
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { createRequire as __createRequire } from "node:module"; const require = __createRequire(import.meta.url);
|
|
2
|
-
import {
|
|
3
|
-
analyzeConnectionError
|
|
4
|
-
} from "./chunk-QZUC2T72.js";
|
|
5
|
-
|
|
6
|
-
// node_modules/.pnpm/mcporter@0.13.8/node_modules/mcporter/dist/runtime-oauth-support.js
|
|
7
|
-
function maybeEnableOAuth(definition, logger) {
|
|
8
|
-
if (definition.auth === "oauth" || definition.auth === "refreshable_bearer") {
|
|
9
|
-
return void 0;
|
|
10
|
-
}
|
|
11
|
-
if (definition.command.kind !== "http") {
|
|
12
|
-
return void 0;
|
|
13
|
-
}
|
|
14
|
-
logger.info(`Detected OAuth requirement for '${definition.name}'. Launching browser flow...`);
|
|
15
|
-
return {
|
|
16
|
-
...definition,
|
|
17
|
-
auth: "oauth"
|
|
18
|
-
};
|
|
19
|
-
}
|
|
20
|
-
function isUnauthorizedError(error) {
|
|
21
|
-
const issue = analyzeConnectionError(error);
|
|
22
|
-
return issue.kind === "auth";
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
export {
|
|
26
|
-
maybeEnableOAuth,
|
|
27
|
-
isUnauthorizedError
|
|
28
|
-
};
|
|
@@ -1,526 +0,0 @@
|
|
|
1
|
-
import { createRequire as __createRequire } from "node:module"; const require = __createRequire(import.meta.url);
|
|
2
|
-
import {
|
|
3
|
-
DAEMON_PROTOCOL_VERSION,
|
|
4
|
-
DaemonFrameDecoder,
|
|
5
|
-
isDaemonProgressFrame,
|
|
6
|
-
resolveProgressTiming
|
|
7
|
-
} from "./chunk-3Z7MFS6K.js";
|
|
8
|
-
import {
|
|
9
|
-
CHROME_DEVTOOLS_RELAY_RUNTIME_IDENTITY_VERSION,
|
|
10
|
-
resolveChromeDevtoolsRelayRuntimeIdentity
|
|
11
|
-
} from "./chunk-BWW4XRUC.js";
|
|
12
|
-
import {
|
|
13
|
-
suppressBrowserLaunchFromEnv
|
|
14
|
-
} from "./chunk-DTZHEVKC.js";
|
|
15
|
-
import {
|
|
16
|
-
listConfigLayerPaths
|
|
17
|
-
} from "./chunk-RD7NHCRK.js";
|
|
18
|
-
import {
|
|
19
|
-
isProcessRunning,
|
|
20
|
-
withFileLock
|
|
21
|
-
} from "./chunk-ITR7FQM3.js";
|
|
22
|
-
import {
|
|
23
|
-
mcporterDir
|
|
24
|
-
} from "./chunk-FS5JIKT6.js";
|
|
25
|
-
import {
|
|
26
|
-
expandHome
|
|
27
|
-
} from "./chunk-WTMJMM3B.js";
|
|
28
|
-
import {
|
|
29
|
-
keepAliveIdleTimeout
|
|
30
|
-
} from "./chunk-JG4TRUPF.js";
|
|
31
|
-
|
|
32
|
-
// node_modules/.pnpm/mcporter@0.13.8/node_modules/mcporter/dist/daemon/client.js
|
|
33
|
-
import crypto, { randomUUID } from "node:crypto";
|
|
34
|
-
import fs2 from "node:fs/promises";
|
|
35
|
-
import net from "node:net";
|
|
36
|
-
import path3 from "node:path";
|
|
37
|
-
|
|
38
|
-
// node_modules/.pnpm/mcporter@0.13.8/node_modules/mcporter/dist/daemon/config-layers.js
|
|
39
|
-
import fs from "node:fs/promises";
|
|
40
|
-
import path from "node:path";
|
|
41
|
-
async function statConfigMtime(configPath) {
|
|
42
|
-
try {
|
|
43
|
-
const stats = await fs.stat(configPath);
|
|
44
|
-
return stats.mtimeMs;
|
|
45
|
-
} catch {
|
|
46
|
-
return null;
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
async function collectConfigLayers(options, fallbackConfigPath) {
|
|
50
|
-
const layerPaths = await listConfigLayerPaths(options, options.rootDir ?? process.cwd());
|
|
51
|
-
const entries = await Promise.all(layerPaths.map(async (layerPath) => ({ path: layerPath, mtimeMs: await statConfigMtime(layerPath) })));
|
|
52
|
-
const fallback = fallbackConfigPath ?? options.configPath;
|
|
53
|
-
if (entries.length === 0 && fallback) {
|
|
54
|
-
entries.push({ path: path.resolve(fallback), mtimeMs: await statConfigMtime(fallback) });
|
|
55
|
-
}
|
|
56
|
-
return entries;
|
|
57
|
-
}
|
|
58
|
-
function normalizeConfigLayers(layers) {
|
|
59
|
-
const normalized = layers.map((entry) => ({
|
|
60
|
-
path: path.isAbsolute(entry.path) ? entry.path : path.resolve(entry.path),
|
|
61
|
-
mtimeMs: entry.mtimeMs ?? null
|
|
62
|
-
}));
|
|
63
|
-
if (normalized.length < 2) {
|
|
64
|
-
return normalized;
|
|
65
|
-
}
|
|
66
|
-
return normalized.toSorted((a, b) => a.path < b.path ? -1 : a.path > b.path ? 1 : 0);
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
// node_modules/.pnpm/mcporter@0.13.8/node_modules/mcporter/dist/daemon/paths.js
|
|
70
|
-
import path2 from "node:path";
|
|
71
|
-
function resolveBaseDir() {
|
|
72
|
-
const override = process.env.MCPORTER_DAEMON_DIR;
|
|
73
|
-
if (override && override.trim().length > 0) {
|
|
74
|
-
return path2.resolve(expandHome(override.trim()));
|
|
75
|
-
}
|
|
76
|
-
return mcporterDir("state");
|
|
77
|
-
}
|
|
78
|
-
function ensureRunDir() {
|
|
79
|
-
return path2.join(resolveBaseDir(), "daemon");
|
|
80
|
-
}
|
|
81
|
-
function getDaemonMetadataPath(configKey) {
|
|
82
|
-
return path2.join(ensureRunDir(), `daemon-${configKey}.json`);
|
|
83
|
-
}
|
|
84
|
-
function getDaemonSocketPath(configKey) {
|
|
85
|
-
const runDir = ensureRunDir();
|
|
86
|
-
if (process.platform === "win32") {
|
|
87
|
-
return `\\\\.\\pipe\\mcporter-daemon-${configKey}`;
|
|
88
|
-
}
|
|
89
|
-
return path2.join(runDir, `daemon-${configKey}.sock`);
|
|
90
|
-
}
|
|
91
|
-
function getDaemonLogPath(configKey) {
|
|
92
|
-
return path2.join(ensureRunDir(), `daemon-${configKey}.log`);
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
// node_modules/.pnpm/mcporter@0.13.8/node_modules/mcporter/dist/daemon/request-utils.js
|
|
96
|
-
function delay(ms) {
|
|
97
|
-
return new Promise((resolve) => {
|
|
98
|
-
setTimeout(resolve, ms);
|
|
99
|
-
});
|
|
100
|
-
}
|
|
101
|
-
function ensureManaged(server, managedServers) {
|
|
102
|
-
if (!managedServers.has(server)) {
|
|
103
|
-
throw new Error(`Server '${server}' is not managed by the daemon.`);
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
function markActivity(server, activity) {
|
|
107
|
-
const entry = activity.get(server);
|
|
108
|
-
if (entry) {
|
|
109
|
-
entry.connected = true;
|
|
110
|
-
entry.lastUsedAt = Date.now();
|
|
111
|
-
} else {
|
|
112
|
-
activity.set(server, { connected: true, lastUsedAt: Date.now() });
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
async function evictIdleServers(runtime, managedServers, activity) {
|
|
116
|
-
const now = Date.now();
|
|
117
|
-
await Promise.all(Array.from(managedServers.entries()).map(async ([name, definition]) => {
|
|
118
|
-
const timeout = keepAliveIdleTimeout(definition);
|
|
119
|
-
if (!timeout) {
|
|
120
|
-
return;
|
|
121
|
-
}
|
|
122
|
-
const entry = activity.get(name);
|
|
123
|
-
if (!entry?.lastUsedAt) {
|
|
124
|
-
return;
|
|
125
|
-
}
|
|
126
|
-
if (now - entry.lastUsedAt < timeout) {
|
|
127
|
-
return;
|
|
128
|
-
}
|
|
129
|
-
await runtime.close(name).catch(() => {
|
|
130
|
-
});
|
|
131
|
-
activity.set(name, { connected: false });
|
|
132
|
-
}));
|
|
133
|
-
}
|
|
134
|
-
function shouldShutdownDaemonForIdle(lastActivityAt, now, idleTimeoutMs, activeRequests = 0) {
|
|
135
|
-
return activeRequests <= 0 && typeof idleTimeoutMs === "number" && idleTimeoutMs > 0 && now - lastActivityAt >= idleTimeoutMs;
|
|
136
|
-
}
|
|
137
|
-
function daemonIdleWatcherInterval(idleTimeoutMs) {
|
|
138
|
-
if (!idleTimeoutMs) {
|
|
139
|
-
return 3e4;
|
|
140
|
-
}
|
|
141
|
-
return Math.min(3e4, Math.max(100, Math.floor(idleTimeoutMs / 2)));
|
|
142
|
-
}
|
|
143
|
-
function buildErrorResponse(id, code, error) {
|
|
144
|
-
let message = code;
|
|
145
|
-
if (error instanceof Error) {
|
|
146
|
-
message = error.message;
|
|
147
|
-
} else if (typeof error === "string") {
|
|
148
|
-
message = error;
|
|
149
|
-
}
|
|
150
|
-
return {
|
|
151
|
-
id,
|
|
152
|
-
ok: false,
|
|
153
|
-
error: {
|
|
154
|
-
code,
|
|
155
|
-
message
|
|
156
|
-
}
|
|
157
|
-
};
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
// node_modules/.pnpm/mcporter@0.13.8/node_modules/mcporter/dist/daemon/startup-readiness.js
|
|
161
|
-
var DAEMON_STARTUP_TIMEOUT_MS = 45e3;
|
|
162
|
-
var DAEMON_STARTUP_SLOW_NOTICE_MS = 5e3;
|
|
163
|
-
var DAEMON_STARTUP_POLL_INTERVAL_MS = 100;
|
|
164
|
-
async function waitForDaemonReady(probe, timing = {}) {
|
|
165
|
-
const now = timing.now ?? Date.now;
|
|
166
|
-
const wait = timing.delay ?? delay2;
|
|
167
|
-
const reportSlowStart = timing.reportSlowStart ?? defaultSlowStartReporter;
|
|
168
|
-
const startedAt = now();
|
|
169
|
-
const deadline = startedAt + DAEMON_STARTUP_TIMEOUT_MS;
|
|
170
|
-
let reportedSlowStart = false;
|
|
171
|
-
while (true) {
|
|
172
|
-
const remainingBeforeProbe = deadline - now();
|
|
173
|
-
if (remainingBeforeProbe <= 0) {
|
|
174
|
-
throw daemonStartupTimeoutError();
|
|
175
|
-
}
|
|
176
|
-
const result = await probe(Math.min(DAEMON_STARTUP_POLL_INTERVAL_MS, remainingBeforeProbe));
|
|
177
|
-
if (result !== null) {
|
|
178
|
-
return result;
|
|
179
|
-
}
|
|
180
|
-
const currentTime = now();
|
|
181
|
-
if (currentTime >= deadline) {
|
|
182
|
-
throw daemonStartupTimeoutError();
|
|
183
|
-
}
|
|
184
|
-
if (!reportedSlowStart && currentTime - startedAt >= DAEMON_STARTUP_SLOW_NOTICE_MS) {
|
|
185
|
-
reportedSlowStart = true;
|
|
186
|
-
reportSlowStart();
|
|
187
|
-
}
|
|
188
|
-
await wait(Math.min(DAEMON_STARTUP_POLL_INTERVAL_MS, deadline - currentTime));
|
|
189
|
-
}
|
|
190
|
-
}
|
|
191
|
-
function defaultSlowStartReporter() {
|
|
192
|
-
console.error("[mcporter] Daemon startup is taking longer than usual; Chrome relay discovery can take up to 30 seconds.");
|
|
193
|
-
}
|
|
194
|
-
function daemonStartupTimeoutError() {
|
|
195
|
-
return new Error("MCPorter daemon did not become ready within 45 seconds. Run 'mcporter daemon start --foreground --log' to diagnose startup.");
|
|
196
|
-
}
|
|
197
|
-
function delay2(ms) {
|
|
198
|
-
return new Promise((resolve) => {
|
|
199
|
-
setTimeout(resolve, ms);
|
|
200
|
-
});
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
// node_modules/.pnpm/mcporter@0.13.8/node_modules/mcporter/dist/daemon/client.js
|
|
204
|
-
var DEFAULT_DAEMON_TIMEOUT_MS = 3e4;
|
|
205
|
-
var MIN_DAEMON_STATUS_TIMEOUT_MS = 1e3;
|
|
206
|
-
function resolveDaemonPaths(configPath) {
|
|
207
|
-
const key = deriveConfigKey(configPath);
|
|
208
|
-
return {
|
|
209
|
-
key,
|
|
210
|
-
socketPath: getDaemonSocketPath(key),
|
|
211
|
-
metadataPath: getDaemonMetadataPath(key)
|
|
212
|
-
};
|
|
213
|
-
}
|
|
214
|
-
var DaemonClient = class {
|
|
215
|
-
options;
|
|
216
|
-
socketPath;
|
|
217
|
-
metadataPath;
|
|
218
|
-
startingPromise = null;
|
|
219
|
-
constructor(options) {
|
|
220
|
-
this.options = options;
|
|
221
|
-
const paths = resolveDaemonPaths(options.configPath);
|
|
222
|
-
this.socketPath = paths.socketPath;
|
|
223
|
-
this.metadataPath = paths.metadataPath;
|
|
224
|
-
}
|
|
225
|
-
async callTool(params) {
|
|
226
|
-
return this.invoke("callTool", params, params.timeoutMs);
|
|
227
|
-
}
|
|
228
|
-
async listTools(params) {
|
|
229
|
-
return this.invoke("listTools", params, params.timeoutMs);
|
|
230
|
-
}
|
|
231
|
-
async listResources(params) {
|
|
232
|
-
return this.invoke("listResources", params);
|
|
233
|
-
}
|
|
234
|
-
async readResource(params) {
|
|
235
|
-
return this.invoke("readResource", params);
|
|
236
|
-
}
|
|
237
|
-
async closeServer(params) {
|
|
238
|
-
await this.invoke("closeServer", params);
|
|
239
|
-
}
|
|
240
|
-
async status(timeoutMs) {
|
|
241
|
-
return await this.readVerifiedStatus(timeoutMs);
|
|
242
|
-
}
|
|
243
|
-
async stop() {
|
|
244
|
-
try {
|
|
245
|
-
await this.sendRequest("stop", {});
|
|
246
|
-
} catch (error) {
|
|
247
|
-
if (isTransportError(error)) {
|
|
248
|
-
return;
|
|
249
|
-
}
|
|
250
|
-
throw error;
|
|
251
|
-
}
|
|
252
|
-
}
|
|
253
|
-
async invoke(method, params, timeoutMs) {
|
|
254
|
-
await this.ensureDaemon(timeoutMs);
|
|
255
|
-
try {
|
|
256
|
-
return await this.sendRequest(method, params, timeoutMs);
|
|
257
|
-
} catch (error) {
|
|
258
|
-
if (isTransportError(error)) {
|
|
259
|
-
await this.restartDaemon();
|
|
260
|
-
return await this.sendRequest(method, params, timeoutMs);
|
|
261
|
-
}
|
|
262
|
-
throw error;
|
|
263
|
-
}
|
|
264
|
-
}
|
|
265
|
-
async ensureDaemon(timeoutMs) {
|
|
266
|
-
const statusTimeoutMs = resolveDaemonStatusTimeout(timeoutMs);
|
|
267
|
-
const metadata = await readDaemonMetadata(this.metadataPath);
|
|
268
|
-
const configState = await this.checkConfigState(metadata);
|
|
269
|
-
if (configState === "stale") {
|
|
270
|
-
await this.restartDaemon({ reason: "stale-config", expectedPid: metadata?.pid });
|
|
271
|
-
return;
|
|
272
|
-
}
|
|
273
|
-
if (configState === "fresh") {
|
|
274
|
-
if (await this.isResponsive(statusTimeoutMs)) {
|
|
275
|
-
return;
|
|
276
|
-
}
|
|
277
|
-
}
|
|
278
|
-
await this.startDaemon({ preflightTimeoutMs: statusTimeoutMs });
|
|
279
|
-
}
|
|
280
|
-
async restartDaemon(options = {}) {
|
|
281
|
-
await this.startingWithLock(async () => {
|
|
282
|
-
const currentStatus = await this.readVerifiedStatus();
|
|
283
|
-
if (currentStatus && options.expectedPid !== void 0 && currentStatus.pid !== options.expectedPid && await this.checkConfigState() === "fresh") {
|
|
284
|
-
return;
|
|
285
|
-
}
|
|
286
|
-
if (options.reason === "stale-config" && currentStatus && await this.checkConfigState() === "fresh") {
|
|
287
|
-
return;
|
|
288
|
-
}
|
|
289
|
-
await this.stop().catch(() => {
|
|
290
|
-
});
|
|
291
|
-
await this.waitForStopped();
|
|
292
|
-
await this.launchDaemonAndWait();
|
|
293
|
-
});
|
|
294
|
-
}
|
|
295
|
-
async startDaemon(options = {}) {
|
|
296
|
-
await this.startingWithLock(async () => {
|
|
297
|
-
if (await this.isResponsive(options.preflightTimeoutMs)) {
|
|
298
|
-
return;
|
|
299
|
-
}
|
|
300
|
-
await this.launchDaemonAndWait();
|
|
301
|
-
});
|
|
302
|
-
}
|
|
303
|
-
async startingWithLock(task) {
|
|
304
|
-
if (this.startingPromise) {
|
|
305
|
-
await this.startingPromise;
|
|
306
|
-
return;
|
|
307
|
-
}
|
|
308
|
-
this.startingPromise = withFileLock(this.metadataPath, async () => {
|
|
309
|
-
await task();
|
|
310
|
-
}).finally(() => {
|
|
311
|
-
this.startingPromise = null;
|
|
312
|
-
});
|
|
313
|
-
await this.startingPromise;
|
|
314
|
-
}
|
|
315
|
-
async launchDaemonAndWait() {
|
|
316
|
-
const { launchDaemonDetached } = await import("./launch-EIT73HX4.js");
|
|
317
|
-
launchDaemonDetached({
|
|
318
|
-
configPath: this.options.configPath,
|
|
319
|
-
configExplicit: this.options.configExplicit,
|
|
320
|
-
rootDir: this.options.rootDir,
|
|
321
|
-
metadataPath: this.metadataPath,
|
|
322
|
-
socketPath: this.socketPath
|
|
323
|
-
});
|
|
324
|
-
await this.waitForReady();
|
|
325
|
-
}
|
|
326
|
-
async waitForStopped() {
|
|
327
|
-
const deadline = Date.now() + 5e3;
|
|
328
|
-
while (Date.now() < deadline) {
|
|
329
|
-
if (!await this.isResponsive()) {
|
|
330
|
-
return;
|
|
331
|
-
}
|
|
332
|
-
await delay(100);
|
|
333
|
-
}
|
|
334
|
-
throw new Error("Daemon did not stop before restart could begin.");
|
|
335
|
-
}
|
|
336
|
-
async waitForReady() {
|
|
337
|
-
await waitForDaemonReady((timeoutMs) => this.readVerifiedStatus(timeoutMs));
|
|
338
|
-
}
|
|
339
|
-
async isResponsive(timeoutMs) {
|
|
340
|
-
return await this.readVerifiedStatus(timeoutMs) !== null;
|
|
341
|
-
}
|
|
342
|
-
async readVerifiedStatus(timeoutMs) {
|
|
343
|
-
const metadata = await readDaemonMetadata(this.metadataPath);
|
|
344
|
-
if (!metadata || metadata.socketPath !== this.socketPath || !isProcessRunning(metadata.pid)) {
|
|
345
|
-
return null;
|
|
346
|
-
}
|
|
347
|
-
try {
|
|
348
|
-
const status = await this.sendRequest("status", {}, timeoutMs);
|
|
349
|
-
if (status.pid !== metadata.pid || status.socketPath !== metadata.socketPath) {
|
|
350
|
-
return null;
|
|
351
|
-
}
|
|
352
|
-
return status;
|
|
353
|
-
} catch (error) {
|
|
354
|
-
if (isTransportError(error)) {
|
|
355
|
-
return null;
|
|
356
|
-
}
|
|
357
|
-
throw error;
|
|
358
|
-
}
|
|
359
|
-
}
|
|
360
|
-
async checkConfigState(metadata) {
|
|
361
|
-
metadata ??= await readDaemonMetadata(this.metadataPath);
|
|
362
|
-
if (!metadata) {
|
|
363
|
-
return "missing";
|
|
364
|
-
}
|
|
365
|
-
const currentLayers = normalizeConfigLayers(await collectConfigLayers({
|
|
366
|
-
configPath: this.options.configExplicit ? this.options.configPath : void 0,
|
|
367
|
-
rootDir: this.options.rootDir
|
|
368
|
-
}, this.options.configPath));
|
|
369
|
-
const metadataLayers = normalizeConfigLayers(metadata.configLayers ?? [{ path: metadata.configPath, mtimeMs: metadata.configMtimeMs ?? null }]);
|
|
370
|
-
if (currentLayers.length !== metadataLayers.length) {
|
|
371
|
-
return "stale";
|
|
372
|
-
}
|
|
373
|
-
for (let i = 0; i < currentLayers.length; i += 1) {
|
|
374
|
-
const current = currentLayers[i];
|
|
375
|
-
const previous = metadataLayers[i];
|
|
376
|
-
if (!current || !previous || current.path !== previous.path || current.mtimeMs !== previous.mtimeMs) {
|
|
377
|
-
return "stale";
|
|
378
|
-
}
|
|
379
|
-
}
|
|
380
|
-
if (metadata.relayRuntimeIdentityVersion !== CHROME_DEVTOOLS_RELAY_RUNTIME_IDENTITY_VERSION || !metadata.relayEnvironmentKeys || metadata.relayRuntimeIdentity !== await resolveChromeDevtoolsRelayRuntimeIdentity(metadata.relayEnvironmentKeys, process.env, this.options.chromeDevtoolsRelayIdentity)) {
|
|
381
|
-
return "stale";
|
|
382
|
-
}
|
|
383
|
-
if ((metadata.oauthNoBrowser ?? false) !== suppressBrowserLaunchFromEnv()) {
|
|
384
|
-
return "stale";
|
|
385
|
-
}
|
|
386
|
-
return "fresh";
|
|
387
|
-
}
|
|
388
|
-
async sendRequest(method, params, timeoutOverrideMs) {
|
|
389
|
-
const progressTiming = resolveProgressTiming(resolveDaemonTimeout(timeoutOverrideMs));
|
|
390
|
-
const request = {
|
|
391
|
-
id: randomUUID(),
|
|
392
|
-
method,
|
|
393
|
-
params,
|
|
394
|
-
protocolVersion: DAEMON_PROTOCOL_VERSION,
|
|
395
|
-
progressIntervalMs: progressTiming.progressIntervalMs
|
|
396
|
-
};
|
|
397
|
-
const payload = JSON.stringify(request);
|
|
398
|
-
const parsed = await new Promise((resolve, reject) => {
|
|
399
|
-
const socket = net.createConnection(this.socketPath);
|
|
400
|
-
const decoder = new DaemonFrameDecoder();
|
|
401
|
-
let response;
|
|
402
|
-
let settled = false;
|
|
403
|
-
const finishReject = (error) => {
|
|
404
|
-
if (settled) {
|
|
405
|
-
return;
|
|
406
|
-
}
|
|
407
|
-
settled = true;
|
|
408
|
-
reject(error);
|
|
409
|
-
};
|
|
410
|
-
const finishResolve = (value) => {
|
|
411
|
-
if (settled) {
|
|
412
|
-
return;
|
|
413
|
-
}
|
|
414
|
-
settled = true;
|
|
415
|
-
resolve(value);
|
|
416
|
-
};
|
|
417
|
-
socket.setTimeout(progressTiming.idleTimeoutMs);
|
|
418
|
-
socket.on("timeout", () => {
|
|
419
|
-
socket.destroy(transportError("Daemon request timed out.", "ETIMEDOUT"));
|
|
420
|
-
});
|
|
421
|
-
const consume = (frames) => {
|
|
422
|
-
for (const frame of frames) {
|
|
423
|
-
if (isDaemonProgressFrame(frame)) {
|
|
424
|
-
if (frame.id === request.id) {
|
|
425
|
-
socket.setTimeout(progressTiming.idleTimeoutMs);
|
|
426
|
-
}
|
|
427
|
-
continue;
|
|
428
|
-
}
|
|
429
|
-
response = frame;
|
|
430
|
-
socket.setTimeout(0);
|
|
431
|
-
}
|
|
432
|
-
};
|
|
433
|
-
socket.on("connect", () => {
|
|
434
|
-
socket.write(payload, (error) => {
|
|
435
|
-
if (error) {
|
|
436
|
-
finishReject(error);
|
|
437
|
-
}
|
|
438
|
-
});
|
|
439
|
-
});
|
|
440
|
-
socket.on("data", (chunk) => {
|
|
441
|
-
consume(decoder.push(chunk.toString()));
|
|
442
|
-
});
|
|
443
|
-
socket.on("end", () => {
|
|
444
|
-
consume(decoder.flush());
|
|
445
|
-
if (response) {
|
|
446
|
-
finishResolve(response);
|
|
447
|
-
return;
|
|
448
|
-
}
|
|
449
|
-
finishReject(decoder.malformed ? transportError("Failed to parse daemon response.", "ECONNRESET") : transportError("Empty daemon response.", "ECONNRESET"));
|
|
450
|
-
});
|
|
451
|
-
socket.on("error", (error) => {
|
|
452
|
-
finishReject(error);
|
|
453
|
-
});
|
|
454
|
-
});
|
|
455
|
-
for (const notice of parsed.notices ?? []) {
|
|
456
|
-
console.warn(`[mcporter] ${notice}`);
|
|
457
|
-
}
|
|
458
|
-
if (!parsed.ok) {
|
|
459
|
-
const error = new Error(parsed.error?.message ?? "Daemon error");
|
|
460
|
-
error.code = parsed.error?.code;
|
|
461
|
-
throw error;
|
|
462
|
-
}
|
|
463
|
-
return parsed.result;
|
|
464
|
-
}
|
|
465
|
-
};
|
|
466
|
-
function transportError(message, code) {
|
|
467
|
-
const error = new Error(message);
|
|
468
|
-
error.code = code;
|
|
469
|
-
return error;
|
|
470
|
-
}
|
|
471
|
-
function deriveConfigKey(configPath) {
|
|
472
|
-
const absolute = path3.resolve(configPath);
|
|
473
|
-
return crypto.hash("sha1", absolute, "hex").slice(0, 12);
|
|
474
|
-
}
|
|
475
|
-
function isTransportError(error) {
|
|
476
|
-
if (!error || typeof error !== "object") {
|
|
477
|
-
return false;
|
|
478
|
-
}
|
|
479
|
-
const code = error.code;
|
|
480
|
-
return code === "ECONNREFUSED" || code === "ENOENT" || code === "ETIMEDOUT" || code === "ECONNRESET";
|
|
481
|
-
}
|
|
482
|
-
function resolveDaemonTimeout(override) {
|
|
483
|
-
if (typeof override === "number" && Number.isFinite(override) && override > 0) {
|
|
484
|
-
return override;
|
|
485
|
-
}
|
|
486
|
-
const raw = process.env.MCPORTER_DAEMON_TIMEOUT_MS;
|
|
487
|
-
if (!raw) {
|
|
488
|
-
return DEFAULT_DAEMON_TIMEOUT_MS;
|
|
489
|
-
}
|
|
490
|
-
const parsed = Number.parseInt(raw, 10);
|
|
491
|
-
if (!Number.isFinite(parsed) || parsed <= 0) {
|
|
492
|
-
return DEFAULT_DAEMON_TIMEOUT_MS;
|
|
493
|
-
}
|
|
494
|
-
return parsed;
|
|
495
|
-
}
|
|
496
|
-
function resolveDaemonStatusTimeout(override) {
|
|
497
|
-
if (typeof override !== "number" || !Number.isFinite(override) || override <= 0) {
|
|
498
|
-
return void 0;
|
|
499
|
-
}
|
|
500
|
-
return Math.max(override, MIN_DAEMON_STATUS_TIMEOUT_MS);
|
|
501
|
-
}
|
|
502
|
-
async function readDaemonMetadata(metadataPath) {
|
|
503
|
-
try {
|
|
504
|
-
const raw = await fs2.readFile(metadataPath, "utf8");
|
|
505
|
-
return JSON.parse(raw);
|
|
506
|
-
} catch {
|
|
507
|
-
return null;
|
|
508
|
-
}
|
|
509
|
-
}
|
|
510
|
-
|
|
511
|
-
export {
|
|
512
|
-
statConfigMtime,
|
|
513
|
-
collectConfigLayers,
|
|
514
|
-
normalizeConfigLayers,
|
|
515
|
-
getDaemonLogPath,
|
|
516
|
-
delay,
|
|
517
|
-
ensureManaged,
|
|
518
|
-
markActivity,
|
|
519
|
-
evictIdleServers,
|
|
520
|
-
shouldShutdownDaemonForIdle,
|
|
521
|
-
daemonIdleWatcherInterval,
|
|
522
|
-
buildErrorResponse,
|
|
523
|
-
waitForDaemonReady,
|
|
524
|
-
resolveDaemonPaths,
|
|
525
|
-
DaemonClient
|
|
526
|
-
};
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { createRequire as __createRequire } from "node:module"; const require = __createRequire(import.meta.url);
|
|
2
|
-
|
|
3
|
-
// node_modules/.pnpm/mcporter@0.13.8/node_modules/mcporter/dist/version.js
|
|
4
|
-
import { createRequire } from "node:module";
|
|
5
|
-
var MCPORTER_VERSION = (() => {
|
|
6
|
-
try {
|
|
7
|
-
return createRequire(import.meta.url)("../package.json").version;
|
|
8
|
-
} catch {
|
|
9
|
-
return process.env.MCPORTER_VERSION ?? "0.0.0-dev";
|
|
10
|
-
}
|
|
11
|
-
})();
|
|
12
|
-
|
|
13
|
-
export {
|
|
14
|
-
MCPORTER_VERSION
|
|
15
|
-
};
|