@introspection-ai/recipes 0.13.0 → 0.14.0

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 (222) hide show
  1. package/README.md +45 -58
  2. package/dist/{agent-tool.d.ts → agents.d.ts} +4 -1
  3. package/dist/agents.d.ts.map +1 -0
  4. package/dist/{agent-tool.js → agents.js} +1 -1
  5. package/dist/agents.js.map +1 -0
  6. package/dist/api/extensions.d.ts +3 -0
  7. package/dist/api/extensions.d.ts.map +1 -0
  8. package/dist/api/extensions.js +2 -0
  9. package/dist/api/extensions.js.map +1 -0
  10. package/dist/api/mcp.d.ts +4 -0
  11. package/dist/api/mcp.d.ts.map +1 -0
  12. package/dist/api/mcp.js +2 -0
  13. package/dist/api/mcp.js.map +1 -0
  14. package/dist/api/session.d.ts +3 -0
  15. package/dist/api/session.d.ts.map +1 -0
  16. package/dist/api/session.js +2 -0
  17. package/dist/api/session.js.map +1 -0
  18. package/dist/child-agent.d.ts +5 -4
  19. package/dist/child-agent.d.ts.map +1 -1
  20. package/dist/child-agent.js +26 -117
  21. package/dist/child-agent.js.map +1 -1
  22. package/dist/child-session.d.ts +23 -0
  23. package/dist/child-session.d.ts.map +1 -0
  24. package/dist/child-session.js +48 -0
  25. package/dist/child-session.js.map +1 -0
  26. package/dist/extensions.d.ts +29 -0
  27. package/dist/extensions.d.ts.map +1 -0
  28. package/dist/extensions.js +119 -0
  29. package/dist/extensions.js.map +1 -0
  30. package/dist/index.d.ts +4 -13
  31. package/dist/index.d.ts.map +1 -1
  32. package/dist/index.js +2 -13
  33. package/dist/index.js.map +1 -1
  34. package/dist/inspect.d.ts +38 -5
  35. package/dist/inspect.d.ts.map +1 -1
  36. package/dist/inspect.js +92 -41
  37. package/dist/inspect.js.map +1 -1
  38. package/dist/interactions.d.ts +18 -2
  39. package/dist/interactions.d.ts.map +1 -1
  40. package/dist/interactions.js +41 -10
  41. package/dist/interactions.js.map +1 -1
  42. package/dist/mcp-catalog.d.ts +1 -0
  43. package/dist/mcp-catalog.d.ts.map +1 -1
  44. package/dist/mcp-catalog.js +14 -6
  45. package/dist/mcp-catalog.js.map +1 -1
  46. package/dist/mcp-chunks/auth-command-ZLGYIEUY.js +273 -0
  47. package/dist/mcp-chunks/call-arguments-LU3W6D3K.js +13 -0
  48. package/dist/mcp-chunks/call-command-LKTKSYTH.js +612 -0
  49. package/dist/mcp-chunks/chunk-2U4BSDC4.js +3951 -0
  50. package/dist/mcp-chunks/chunk-2XL7MG7R.js +272 -0
  51. package/dist/mcp-chunks/chunk-3BJA27PY.js +2321 -0
  52. package/dist/mcp-chunks/chunk-4SQKWYFF.js +15 -0
  53. package/dist/mcp-chunks/chunk-5QOSCSQB.js +290 -0
  54. package/dist/mcp-chunks/chunk-6W5QFASN.js +77 -0
  55. package/dist/mcp-chunks/chunk-6XCZGU3G.js +1004 -0
  56. package/dist/mcp-chunks/chunk-7FHEBT5G.js +149 -0
  57. package/dist/mcp-chunks/chunk-7KA2VJVZ.js +114 -0
  58. package/dist/mcp-chunks/chunk-7UDVSOOF.js +138 -0
  59. package/dist/mcp-chunks/chunk-BNV3TPE4.js +66 -0
  60. package/dist/mcp-chunks/chunk-BTLAWHTA.js +129 -0
  61. package/dist/mcp-chunks/chunk-BV56DXPW.js +13 -0
  62. package/dist/mcp-chunks/chunk-BWHIA4PC.js +90 -0
  63. package/dist/mcp-chunks/chunk-BZIQOWE6.js +267 -0
  64. package/dist/mcp-chunks/chunk-D3MRAZ6H.js +16140 -0
  65. package/dist/mcp-chunks/chunk-DHBE7UBH.js +750 -0
  66. package/dist/mcp-chunks/chunk-E22DYOW5.js +251 -0
  67. package/dist/mcp-chunks/chunk-ECIVB7P4.js +139 -0
  68. package/dist/mcp-chunks/chunk-HKRJ6O36.js +1076 -0
  69. package/dist/mcp-chunks/chunk-IABRYROW.js +44 -0
  70. package/dist/mcp-chunks/chunk-J6LYIZXN.js +45 -0
  71. package/dist/mcp-chunks/chunk-L7NTQVYN.js +161 -0
  72. package/dist/mcp-chunks/chunk-LEZSACDE.js +141 -0
  73. package/dist/mcp-chunks/chunk-LKIBAYKU.js +208 -0
  74. package/dist/mcp-chunks/chunk-LNH5LAJD.js +152 -0
  75. package/dist/mcp-chunks/chunk-LQQEYD76.js +124 -0
  76. package/dist/mcp-chunks/chunk-LRKZP7DJ.js +47 -0
  77. package/dist/mcp-chunks/chunk-LS7PMWSR.js +109 -0
  78. package/dist/mcp-chunks/chunk-M3TPODXI.js +95 -0
  79. package/dist/mcp-chunks/chunk-MZ2NARG7.js +400 -0
  80. package/dist/mcp-chunks/chunk-N46NEFAF.js +45 -0
  81. package/dist/mcp-chunks/chunk-NNOEGEUZ.js +17273 -0
  82. package/dist/mcp-chunks/chunk-NRAJX5E4.js +69 -0
  83. package/dist/mcp-chunks/chunk-P3PSC54P.js +869 -0
  84. package/dist/mcp-chunks/chunk-PIIYJR44.js +6341 -0
  85. package/dist/mcp-chunks/chunk-PWYFKGKG.js +385 -0
  86. package/dist/mcp-chunks/chunk-SJCCBNZ4.js +45 -0
  87. package/dist/mcp-chunks/chunk-TATVT5IT.js +194 -0
  88. package/dist/mcp-chunks/chunk-TEUKFFQL.js +29 -0
  89. package/dist/mcp-chunks/chunk-UKYNQGNE.js +150 -0
  90. package/dist/mcp-chunks/chunk-UNKB4SBV.js +37 -0
  91. package/dist/mcp-chunks/chunk-WD6BOD24.js +138 -0
  92. package/dist/mcp-chunks/chunk-WQJZMCJN.js +73 -0
  93. package/dist/mcp-chunks/chunk-XANPGTLI.js +364 -0
  94. package/dist/mcp-chunks/chunk-XQK2JSW4.js +35 -0
  95. package/dist/mcp-chunks/chunk-YHQUTU6L.js +571 -0
  96. package/dist/mcp-chunks/chunk-YVZKMV5H.js +57 -0
  97. package/dist/mcp-chunks/cli-UV4QJZZM.js +929 -0
  98. package/dist/mcp-chunks/client-S7RQUG5U.js +13 -0
  99. package/dist/mcp-chunks/config-command-NLAGKID5.js +1101 -0
  100. package/dist/mcp-chunks/daemon-command-U242Z6VY.js +26 -0
  101. package/dist/mcp-chunks/dist-LK3SHAMX.js +6478 -0
  102. package/dist/mcp-chunks/emit-ts-command-VBXVXO6V.js +386 -0
  103. package/dist/mcp-chunks/generate-cli-runner-6CAZZA3P.js +1426 -0
  104. package/dist/mcp-chunks/inspect-cli-command-3ZORTOR7.js +111 -0
  105. package/dist/mcp-chunks/launch-YKRXHXJI.js +10 -0
  106. package/dist/mcp-chunks/lifecycle-XVKRHPH3.js +16 -0
  107. package/dist/mcp-chunks/list-command-2MEGGNFQ.js +4190 -0
  108. package/dist/mcp-chunks/output-utils-NKESLAJ6.js +12 -0
  109. package/dist/mcp-chunks/prompt-B1Yc1NPt-VGOTWJMN.js +918 -0
  110. package/dist/mcp-chunks/record-command-YXHTTTT5.js +17 -0
  111. package/dist/mcp-chunks/replay-command-25HJ6AQU.js +85 -0
  112. package/dist/mcp-chunks/resource-command-OO4NYF5C.js +97 -0
  113. package/dist/mcp-chunks/result-utils-MOHHLNM7.js +15 -0
  114. package/dist/mcp-chunks/runtime-5WJ3G25Y.js +33 -0
  115. package/dist/mcp-chunks/runtime-wrapper-RPWDIDBF.js +10 -0
  116. package/dist/mcp-chunks/serve-command-DHXJZMMN.js +3302 -0
  117. package/dist/mcp-chunks/timeouts-W2XWCCXR.js +18 -0
  118. package/dist/mcp-chunks/vault-command-PIYIUEZL.js +154 -0
  119. package/dist/mcp-daemon-client.d.ts +6 -1
  120. package/dist/mcp-daemon-client.d.ts.map +1 -1
  121. package/dist/mcp-daemon-client.js +119 -2
  122. package/dist/mcp-daemon-client.js.map +1 -1
  123. package/dist/mcp-daemon-protocol.d.ts +18 -1
  124. package/dist/mcp-daemon-protocol.d.ts.map +1 -1
  125. package/dist/mcp-daemon-protocol.js +31 -0
  126. package/dist/mcp-daemon-protocol.js.map +1 -1
  127. package/dist/mcp-daemon.js +169 -76602
  128. package/dist/mcp-daemon.js.map +1 -1
  129. package/dist/mcp-policy.d.ts +11 -0
  130. package/dist/mcp-policy.d.ts.map +1 -0
  131. package/dist/mcp-policy.js +27 -0
  132. package/dist/mcp-policy.js.map +1 -0
  133. package/dist/mcp-run-worker.js +38 -76540
  134. package/dist/mcp-tools.d.ts +39 -0
  135. package/dist/mcp-tools.d.ts.map +1 -0
  136. package/dist/mcp-tools.js +493 -0
  137. package/dist/mcp-tools.js.map +1 -0
  138. package/dist/mcp.d.ts +21 -9
  139. package/dist/mcp.d.ts.map +1 -1
  140. package/dist/mcp.js +101 -31
  141. package/dist/mcp.js.map +1 -1
  142. package/dist/model-binding.d.ts +39 -0
  143. package/dist/model-binding.d.ts.map +1 -0
  144. package/dist/model-binding.js +103 -0
  145. package/dist/model-binding.js.map +1 -0
  146. package/dist/pi-extension.d.ts +2 -22
  147. package/dist/pi-extension.d.ts.map +1 -1
  148. package/dist/pi-extension.js +296 -71
  149. package/dist/pi-extension.js.map +1 -1
  150. package/dist/recipe/resolve.d.ts +43 -20
  151. package/dist/recipe/resolve.d.ts.map +1 -1
  152. package/dist/recipe/resolve.js +215 -70
  153. package/dist/recipe/resolve.js.map +1 -1
  154. package/dist/recipe-agent.d.ts +24 -27
  155. package/dist/recipe-agent.d.ts.map +1 -1
  156. package/dist/recipe-agent.js +278 -230
  157. package/dist/recipe-agent.js.map +1 -1
  158. package/dist/recipe-check.d.ts +17 -0
  159. package/dist/recipe-check.d.ts.map +1 -0
  160. package/dist/recipe-check.js +258 -0
  161. package/dist/recipe-check.js.map +1 -0
  162. package/dist/recipe-extensions.d.ts.map +1 -1
  163. package/dist/recipe-extensions.js +0 -3
  164. package/dist/recipe-extensions.js.map +1 -1
  165. package/dist/recipe-model.d.ts +3 -1
  166. package/dist/recipe-model.d.ts.map +1 -1
  167. package/dist/recipe-model.js +15 -12
  168. package/dist/recipe-model.js.map +1 -1
  169. package/dist/recipe-package.d.ts +6 -28
  170. package/dist/recipe-package.d.ts.map +1 -1
  171. package/dist/recipe-package.js +248 -191
  172. package/dist/recipe-package.js.map +1 -1
  173. package/dist/recipe-skills.d.ts.map +1 -1
  174. package/dist/recipe-skills.js +42 -29
  175. package/dist/recipe-skills.js.map +1 -1
  176. package/dist/run-controller.d.ts +10 -9
  177. package/dist/run-controller.d.ts.map +1 -1
  178. package/dist/run-controller.js +28 -21
  179. package/dist/run-controller.js.map +1 -1
  180. package/dist/session.d.ts +40 -53
  181. package/dist/session.d.ts.map +1 -1
  182. package/dist/session.js +312 -173
  183. package/dist/session.js.map +1 -1
  184. package/dist/test-utils.d.ts +7 -7
  185. package/dist/test-utils.d.ts.map +1 -1
  186. package/dist/test-utils.js +32 -15
  187. package/dist/test-utils.js.map +1 -1
  188. package/docs/agent-composition.md +41 -35
  189. package/docs/host-api.md +201 -0
  190. package/docs/index.md +8 -14
  191. package/docs/interactions.md +12 -11
  192. package/docs/mcp-auth.md +6 -6
  193. package/docs/mcp-configuration.md +72 -24
  194. package/docs/pi-extension.md +39 -11
  195. package/docs/recipe-flow.md +9 -9
  196. package/docs/recipe-format.md +90 -41
  197. package/package.json +23 -17
  198. package/vendor/mcp-client/darwin-arm64/mcp-client +0 -0
  199. package/vendor/mcp-client/darwin-x64/mcp-client +0 -0
  200. package/vendor/mcp-client/linux-arm64/mcp-client +0 -0
  201. package/vendor/recipe-check/darwin-arm64/recipe-check +0 -0
  202. package/vendor/recipe-check/darwin-x64/recipe-check +0 -0
  203. package/vendor/recipe-check/linux-arm64/recipe-check +0 -0
  204. package/vendor/recipe-check/linux-x64/recipe-check +0 -0
  205. package/vendor/recipe-check/linux-x64-musl/recipe-check +0 -0
  206. package/vendor/recipe-check/win32-x64/recipe-check.exe +0 -0
  207. package/dist/agent-tool.d.ts.map +0 -1
  208. package/dist/agent-tool.js.map +0 -1
  209. package/dist/run.d.ts +0 -28
  210. package/dist/run.d.ts.map +0 -1
  211. package/dist/run.js +0 -84
  212. package/dist/run.js.map +0 -1
  213. package/dist/testing.d.ts +0 -25
  214. package/dist/testing.d.ts.map +0 -1
  215. package/dist/testing.js +0 -96
  216. package/dist/testing.js.map +0 -1
  217. package/docs/deployment-configuration.md +0 -65
  218. package/docs/migration.md +0 -70
  219. package/docs/python-bindings-release.md +0 -47
  220. package/docs/recipe-evals.md +0 -70
  221. package/docs/recipe-judges.md +0 -152
  222. package/docs/runtime-library.md +0 -171
@@ -0,0 +1,152 @@
1
+ import { createRequire as __createRequire } from "node:module"; const require = __createRequire(import.meta.url);
2
+ import {
3
+ logWarn
4
+ } from "./chunk-UNKB4SBV.js";
5
+
6
+ // node_modules/.pnpm/mcporter@0.12.3/node_modules/mcporter/dist/cli/output-utils.js
7
+ import fs from "node:fs";
8
+ import path from "node:path";
9
+ import { inspect } from "node:util";
10
+ var RAW_INSPECT_DEPTH = 8;
11
+ var PREFERRED_OUTPUT_BY_FORMAT = {
12
+ auto: ["json", "markdown", "text", "raw"],
13
+ text: ["text", "markdown", "json", "raw"],
14
+ markdown: ["markdown", "text", "json", "raw"],
15
+ json: ["json", "raw"],
16
+ raw: ["raw"]
17
+ };
18
+ function printCallOutput(wrapped, raw, format) {
19
+ const preferredKinds = PREFERRED_OUTPUT_BY_FORMAT[format];
20
+ const renderable = resolveRenderableOutput(wrapped, raw, preferredKinds);
21
+ emitRenderableOutput(renderable, format);
22
+ }
23
+ function tailLogIfRequested(result, enabled) {
24
+ if (!enabled) {
25
+ return;
26
+ }
27
+ const candidates = [];
28
+ if (result && typeof result === "object") {
29
+ const possibleKeys = ["logPath", "logFile", "logfile"];
30
+ for (const key of possibleKeys) {
31
+ const value = result[key];
32
+ if (typeof value === "string") {
33
+ candidates.push(value);
34
+ }
35
+ }
36
+ }
37
+ for (const candidate of candidates) {
38
+ if (!path.isAbsolute(candidate)) {
39
+ logWarn(`Refusing to tail non-absolute log path: ${candidate}`);
40
+ continue;
41
+ }
42
+ if (!fs.existsSync(candidate)) {
43
+ logWarn(`Log path not found: ${candidate}`);
44
+ continue;
45
+ }
46
+ try {
47
+ const content = fs.readFileSync(candidate, "utf8");
48
+ const lines = content.trimEnd().split(/\r?\n/);
49
+ const tail = lines.slice(-20);
50
+ console.log(`--- tail ${candidate} ---`);
51
+ for (const line of tail) {
52
+ console.log(line);
53
+ }
54
+ } catch (error) {
55
+ logWarn(`Failed to read log file ${candidate}: ${error.message}`);
56
+ }
57
+ }
58
+ }
59
+ function resolveRenderableOutput(wrapped, raw, preferredKinds) {
60
+ for (const kind of preferredKinds) {
61
+ if (kind === "json") {
62
+ const jsonValue = wrapped.json();
63
+ if (jsonValue !== null) {
64
+ return { kind, value: jsonValue };
65
+ }
66
+ continue;
67
+ }
68
+ if (kind === "markdown") {
69
+ const markdown = wrapped.markdown();
70
+ if (typeof markdown === "string") {
71
+ return { kind, value: markdown };
72
+ }
73
+ continue;
74
+ }
75
+ if (kind === "text") {
76
+ const text = wrapped.text();
77
+ if (typeof text === "string") {
78
+ return { kind, value: text };
79
+ }
80
+ continue;
81
+ }
82
+ if (kind === "raw") {
83
+ return { kind, value: raw };
84
+ }
85
+ }
86
+ return { kind: "raw", value: raw };
87
+ }
88
+ function emitRenderableOutput(renderable, requestedFormat) {
89
+ if (renderable.kind === "json") {
90
+ if (!attemptPrintJson(renderable.value)) {
91
+ printRaw(renderable.value, requestedFormat);
92
+ }
93
+ return;
94
+ }
95
+ if (renderable.kind === "markdown" || renderable.kind === "text") {
96
+ console.log(String(renderable.value));
97
+ return;
98
+ }
99
+ printRaw(renderable.value, requestedFormat);
100
+ }
101
+ function attemptPrintJson(value) {
102
+ if (value === void 0) {
103
+ return false;
104
+ }
105
+ try {
106
+ if (value === null) {
107
+ console.log("null");
108
+ } else {
109
+ console.log(JSON.stringify(value, null, 2));
110
+ }
111
+ return true;
112
+ } catch {
113
+ return false;
114
+ }
115
+ }
116
+ function printRaw(raw, requestedFormat) {
117
+ if (requestedFormat === "json") {
118
+ try {
119
+ const serialized = JSON.stringify(raw, null, 2);
120
+ console.log(typeof serialized === "string" ? serialized : "null");
121
+ } catch {
122
+ console.log(JSON.stringify(String(raw)));
123
+ }
124
+ return;
125
+ }
126
+ if (typeof raw === "string") {
127
+ console.log(raw);
128
+ return;
129
+ }
130
+ if (raw === null) {
131
+ console.log("null");
132
+ return;
133
+ }
134
+ if (raw === void 0) {
135
+ console.log("undefined");
136
+ return;
137
+ }
138
+ if (typeof raw === "bigint") {
139
+ console.log(raw.toString());
140
+ return;
141
+ }
142
+ if (typeof raw === "symbol" || typeof raw === "function") {
143
+ console.log(raw.toString());
144
+ return;
145
+ }
146
+ console.log(inspect(raw, { depth: RAW_INSPECT_DEPTH, maxStringLength: null, breakLength: 80 }));
147
+ }
148
+
149
+ export {
150
+ printCallOutput,
151
+ tailLogIfRequested
152
+ };
@@ -0,0 +1,124 @@
1
+ import { createRequire as __createRequire } from "node:module"; const require = __createRequire(import.meta.url);
2
+
3
+ // node_modules/.pnpm/mcporter@0.12.3/node_modules/mcporter/dist/cli/ephemeral-flags.js
4
+ function extractEphemeralServerFlags(args, options = {}) {
5
+ let spec;
6
+ const ensureSpec = () => {
7
+ if (!spec) {
8
+ spec = {};
9
+ }
10
+ return spec;
11
+ };
12
+ const allowPersist = options.allowPersist ?? true;
13
+ let index = 0;
14
+ while (index < args.length) {
15
+ const token = args[index];
16
+ if (!token) {
17
+ index += 1;
18
+ continue;
19
+ }
20
+ if (token === "--http-url" || token === "--sse") {
21
+ const value = args[index + 1];
22
+ if (!value) {
23
+ throw new Error("Flag '--http-url' requires a value.");
24
+ }
25
+ ensureSpec().httpUrl = value;
26
+ args.splice(index, 2);
27
+ continue;
28
+ }
29
+ if (token === "--allow-http" || token === "--insecure") {
30
+ ensureSpec().allowInsecureHttp = true;
31
+ args.splice(index, 1);
32
+ continue;
33
+ }
34
+ if (token === "--stdio") {
35
+ const value = args[index + 1];
36
+ if (!value) {
37
+ throw new Error("Flag '--stdio' requires a value.");
38
+ }
39
+ ensureSpec().stdioCommand = value;
40
+ args.splice(index, 2);
41
+ continue;
42
+ }
43
+ if (token === "--stdio-arg") {
44
+ const value = args[index + 1];
45
+ if (!value) {
46
+ throw new Error("Flag '--stdio-arg' requires a value.");
47
+ }
48
+ const current = ensureSpec();
49
+ current.stdioArgs = [...current.stdioArgs ?? [], value];
50
+ args.splice(index, 2);
51
+ continue;
52
+ }
53
+ if (token === "--env") {
54
+ const value = args[index + 1];
55
+ const current = ensureSpec();
56
+ const envMap = current.env ? { ...current.env } : {};
57
+ parseKeyValue(value, envMap, "--env");
58
+ current.env = envMap;
59
+ args.splice(index, 2);
60
+ continue;
61
+ }
62
+ if (token === "--header") {
63
+ const value = args[index + 1];
64
+ const current = ensureSpec();
65
+ const headerMap = current.headers ? { ...current.headers } : {};
66
+ parseKeyValue(value, headerMap, "--header");
67
+ current.headers = headerMap;
68
+ args.splice(index, 2);
69
+ continue;
70
+ }
71
+ if (token === "--cwd") {
72
+ const value = args[index + 1];
73
+ if (!value) {
74
+ throw new Error("Flag '--cwd' requires a value.");
75
+ }
76
+ ensureSpec().cwd = value;
77
+ args.splice(index, 2);
78
+ continue;
79
+ }
80
+ if (token === "--name") {
81
+ const value = args[index + 1];
82
+ if (!value) {
83
+ throw new Error("Flag '--name' requires a value.");
84
+ }
85
+ ensureSpec().name = value;
86
+ args.splice(index, 2);
87
+ continue;
88
+ }
89
+ if (token === "--description") {
90
+ const value = args[index + 1];
91
+ if (!value) {
92
+ throw new Error("Flag '--description' requires a value.");
93
+ }
94
+ ensureSpec().description = value;
95
+ args.splice(index, 2);
96
+ continue;
97
+ }
98
+ if (allowPersist && token === "--persist") {
99
+ const value = args[index + 1];
100
+ if (!value) {
101
+ throw new Error("Flag '--persist' requires a value.");
102
+ }
103
+ ensureSpec().persistPath = value;
104
+ args.splice(index, 2);
105
+ continue;
106
+ }
107
+ index += 1;
108
+ }
109
+ return spec;
110
+ }
111
+ function parseKeyValue(value, target, flagName) {
112
+ if (!value?.includes("=")) {
113
+ throw new Error(`Flag '${flagName}' requires KEY=value.`);
114
+ }
115
+ const [key, ...rest] = value.split("=");
116
+ if (!key) {
117
+ throw new Error(`Flag '${flagName}' requires KEY=value.`);
118
+ }
119
+ target[key] = rest.join("=");
120
+ }
121
+
122
+ export {
123
+ extractEphemeralServerFlags
124
+ };
@@ -0,0 +1,47 @@
1
+ import { createRequire as __createRequire } from "node:module"; const require = __createRequire(import.meta.url);
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
9
+ get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
10
+ }) : x)(function(x) {
11
+ if (typeof require !== "undefined") return require.apply(this, arguments);
12
+ throw Error('Dynamic require of "' + x + '" is not supported');
13
+ });
14
+ var __commonJS = (cb, mod) => function __require2() {
15
+ try {
16
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
17
+ } catch (e) {
18
+ throw mod = 0, e;
19
+ }
20
+ };
21
+ var __export = (target, all) => {
22
+ for (var name in all)
23
+ __defProp(target, name, { get: all[name], enumerable: true });
24
+ };
25
+ var __copyProps = (to, from, except, desc) => {
26
+ if (from && typeof from === "object" || typeof from === "function") {
27
+ for (let key of __getOwnPropNames(from))
28
+ if (!__hasOwnProp.call(to, key) && key !== except)
29
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
30
+ }
31
+ return to;
32
+ };
33
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
34
+ // If the importer is in node compatibility mode or this is not an ESM
35
+ // file that has been converted to a CommonJS file using a Babel-
36
+ // compatible transform (i.e. "__esModule" has not been set), then set
37
+ // "default" to the CommonJS "module.exports" for node compatibility.
38
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
39
+ mod
40
+ ));
41
+
42
+ export {
43
+ __require,
44
+ __commonJS,
45
+ __export,
46
+ __toESM
47
+ };
@@ -0,0 +1,109 @@
1
+ import { createRequire as __createRequire } from "node:module"; const require = __createRequire(import.meta.url);
2
+
3
+ // node_modules/.pnpm/mcporter@0.12.3/node_modules/mcporter/dist/lifecycle.js
4
+ var DEFAULT_KEEP_ALIVE = /* @__PURE__ */ new Set(["chrome-devtools", "mobile-mcp", "playwright", "cloudbase"]);
5
+ var includeOverride = parseList(process.env.MCPORTER_KEEPALIVE);
6
+ var excludeOverride = parseList(process.env.MCPORTER_DISABLE_KEEPALIVE ?? process.env.MCPORTER_NO_KEEPALIVE);
7
+ var KEEP_ALIVE_COMMANDS = [
8
+ { label: "chrome-devtools", fragments: ["chrome-devtools-mcp"] },
9
+ { label: "mobile-mcp", fragments: ["@mobilenext/mobile-mcp", "mobile-mcp"] },
10
+ { label: "playwright", fragments: ["@playwright/mcp", "playwright/mcp"] },
11
+ { label: "cloudbase", fragments: ["@cloudbase/cloudbase-mcp", "cloudbase-mcp"] }
12
+ ];
13
+ var CHROME_DEVTOOLS_URL_PLACEHOLDERS = [String.raw`\${CHROME_DEVTOOLS_URL}`, "$env:CHROME_DEVTOOLS_URL"];
14
+ function resolveLifecycle(name, rawLifecycle, command) {
15
+ const normalizedName = name.toLowerCase();
16
+ const canonicalName = canonicalKeepAliveName(command);
17
+ const candidateNames = /* @__PURE__ */ new Set([normalizedName]);
18
+ if (canonicalName) {
19
+ candidateNames.add(canonicalName);
20
+ }
21
+ const forcedDisable = excludeOverride.all || matchesOverride(excludeOverride.names, candidateNames);
22
+ const forcedEnable = includeOverride.all || matchesOverride(includeOverride.names, candidateNames);
23
+ if (forcedEnable) {
24
+ return { mode: "keep-alive" };
25
+ }
26
+ if (forcedDisable) {
27
+ return void 0;
28
+ }
29
+ const lifecycle = rawLifecycle ? coerceLifecycle(rawLifecycle) : void 0;
30
+ if (lifecycle) {
31
+ return lifecycle;
32
+ }
33
+ if (commandRequiresDynamicChromePort(command)) {
34
+ return { mode: "ephemeral" };
35
+ }
36
+ if (Array.from(candidateNames).some((candidate) => DEFAULT_KEEP_ALIVE.has(candidate))) {
37
+ return { mode: "keep-alive" };
38
+ }
39
+ return void 0;
40
+ }
41
+ function canonicalKeepAliveName(command) {
42
+ if (command.kind !== "stdio") {
43
+ return void 0;
44
+ }
45
+ const tokens = [command.command, ...command.args].map((token) => token.toLowerCase());
46
+ const match = KEEP_ALIVE_COMMANDS.find((signature) => signature.fragments.some((fragment) => tokens.some((token) => token.includes(fragment))));
47
+ return match?.label;
48
+ }
49
+ function commandRequiresDynamicChromePort(command) {
50
+ if (command.kind !== "stdio") {
51
+ return false;
52
+ }
53
+ const tokens = [command.command, ...command.args];
54
+ return tokens.some((token) => CHROME_DEVTOOLS_URL_PLACEHOLDERS.some((placeholder) => token.includes(placeholder)));
55
+ }
56
+ function parseList(value) {
57
+ if (!value) {
58
+ return { all: false, names: /* @__PURE__ */ new Set() };
59
+ }
60
+ const names = value.split(",").map((token) => token.trim().toLowerCase()).filter((token) => token.length > 0);
61
+ if (names.includes("*")) {
62
+ return { all: true, names: /* @__PURE__ */ new Set() };
63
+ }
64
+ return { all: false, names: new Set(names) };
65
+ }
66
+ function matchesOverride(names, candidates) {
67
+ for (const candidate of candidates) {
68
+ if (names.has(candidate)) {
69
+ return true;
70
+ }
71
+ }
72
+ return false;
73
+ }
74
+ function coerceLifecycle(raw) {
75
+ if (typeof raw === "string") {
76
+ if (raw === "keep-alive") {
77
+ return { mode: "keep-alive" };
78
+ }
79
+ if (raw === "ephemeral") {
80
+ return { mode: "ephemeral" };
81
+ }
82
+ return void 0;
83
+ }
84
+ if (raw.mode === "keep-alive") {
85
+ const timeout = typeof raw.idleTimeoutMs === "number" && Number.isFinite(raw.idleTimeoutMs) && raw.idleTimeoutMs > 0 ? Math.trunc(raw.idleTimeoutMs) : void 0;
86
+ return timeout ? { mode: "keep-alive", idleTimeoutMs: timeout } : { mode: "keep-alive" };
87
+ }
88
+ if (raw.mode === "ephemeral") {
89
+ return { mode: "ephemeral" };
90
+ }
91
+ return void 0;
92
+ }
93
+ function isKeepAliveServer(definition) {
94
+ return definition?.lifecycle?.mode === "keep-alive";
95
+ }
96
+ function keepAliveIdleTimeout(definition) {
97
+ if (definition.lifecycle?.mode !== "keep-alive") {
98
+ return void 0;
99
+ }
100
+ return definition.lifecycle.idleTimeoutMs;
101
+ }
102
+
103
+ export {
104
+ DEFAULT_KEEP_ALIVE,
105
+ resolveLifecycle,
106
+ canonicalKeepAliveName,
107
+ isKeepAliveServer,
108
+ keepAliveIdleTimeout
109
+ };
@@ -0,0 +1,95 @@
1
+ import { createRequire as __createRequire } from "node:module"; const require = __createRequire(import.meta.url);
2
+
3
+ // node_modules/.pnpm/mcporter@0.12.3/node_modules/mcporter/dist/cli/http-utils.js
4
+ var DOMAIN_WITH_PATH_PATTERN = /^[A-Za-z0-9](?:[A-Za-z0-9.-]*)(?::\d+)?\//;
5
+ function normalizeHttpUrlCandidate(value) {
6
+ if (!value) {
7
+ return void 0;
8
+ }
9
+ const trimmed = value.trim();
10
+ if (!trimmed) {
11
+ return void 0;
12
+ }
13
+ const hasScheme = /^https?:\/\//i.test(trimmed);
14
+ const candidate = hasScheme ? trimmed : DOMAIN_WITH_PATH_PATTERN.test(trimmed) ? `https://${trimmed}` : null;
15
+ if (!candidate) {
16
+ return void 0;
17
+ }
18
+ try {
19
+ const url = new URL(candidate);
20
+ return url.href;
21
+ } catch {
22
+ return void 0;
23
+ }
24
+ }
25
+ function looksLikeHttpUrl(value) {
26
+ return Boolean(normalizeHttpUrlCandidate(value));
27
+ }
28
+ function splitHttpToolSelector(input) {
29
+ const trimmed = input.trim();
30
+ const candidate = (() => {
31
+ const openParen = trimmed.indexOf("(");
32
+ if (openParen === -1) {
33
+ return trimmed;
34
+ }
35
+ return trimmed.slice(0, openParen);
36
+ })();
37
+ const normalized = normalizeHttpUrlCandidate(candidate);
38
+ if (!normalized) {
39
+ return null;
40
+ }
41
+ let url;
42
+ try {
43
+ url = new URL(normalized);
44
+ } catch {
45
+ return null;
46
+ }
47
+ const pathname = url.pathname || "/";
48
+ const lastSlash = pathname.lastIndexOf("/");
49
+ const segment = pathname.slice(lastSlash + 1);
50
+ const dotIndex = segment.lastIndexOf(".");
51
+ if (dotIndex <= 0) {
52
+ return null;
53
+ }
54
+ const tool = segment.slice(dotIndex + 1);
55
+ if (!tool || !/^[A-Za-z0-9_-]+$/.test(tool)) {
56
+ return null;
57
+ }
58
+ const baseSegment = segment.slice(0, dotIndex);
59
+ if (!baseSegment) {
60
+ return null;
61
+ }
62
+ const basePath = `${pathname.slice(0, Math.max(0, lastSlash + 1))}${baseSegment}`;
63
+ const normalizedPath = basePath.startsWith("/") ? basePath : `/${basePath}`;
64
+ const baseUrl = `${url.origin}${normalizedPath}`;
65
+ return { baseUrl, tool };
66
+ }
67
+ function normalizeHttpUrl(value) {
68
+ try {
69
+ const url = value instanceof URL ? new URL(value.href) : new URL(value);
70
+ url.protocol = url.protocol.toLowerCase();
71
+ url.hostname = url.hostname.replace(/^www\./i, "").toLowerCase();
72
+ if (!url.pathname) {
73
+ url.pathname = "/";
74
+ }
75
+ return url.href.replace(/\/$/, "/");
76
+ } catch {
77
+ return void 0;
78
+ }
79
+ }
80
+ function extractHttpServerTarget(value) {
81
+ const split = splitHttpToolSelector(value);
82
+ if (split) {
83
+ return split.baseUrl;
84
+ }
85
+ const normalized = normalizeHttpUrlCandidate(value);
86
+ return normalized ?? void 0;
87
+ }
88
+
89
+ export {
90
+ normalizeHttpUrlCandidate,
91
+ looksLikeHttpUrl,
92
+ splitHttpToolSelector,
93
+ normalizeHttpUrl,
94
+ extractHttpServerTarget
95
+ };