@introspection-ai/recipes 0.18.1 → 0.19.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 (146) hide show
  1. package/dist/inspect.d.ts +1 -0
  2. package/dist/inspect.d.ts.map +1 -1
  3. package/dist/inspect.js +3 -0
  4. package/dist/inspect.js.map +1 -1
  5. package/dist/mcp-chunks/{auth-command-ZLGYIEUY.js → auth-command-3K7V3VCW.js} +31 -35
  6. package/dist/mcp-chunks/call-arguments-TX3F2TEE.js +15 -0
  7. package/dist/mcp-chunks/{call-command-LKTKSYTH.js → call-command-OFPHPFM5.js} +36 -34
  8. package/dist/mcp-chunks/chunk-2FSDGCHW.js +3299 -0
  9. package/dist/mcp-chunks/{chunk-BV56DXPW.js → chunk-2JHHONW4.js} +1 -1
  10. package/dist/mcp-chunks/chunk-2MEHGB7D.js +63 -0
  11. package/dist/mcp-chunks/chunk-3IZQW4H4.js +929 -0
  12. package/dist/mcp-chunks/{chunk-MZ2NARG7.js → chunk-54EWGONA.js} +5 -5
  13. package/dist/mcp-chunks/{chunk-LQQEYD76.js → chunk-55JIHDU3.js} +1 -1
  14. package/dist/mcp-chunks/chunk-64EP2BVO.js +39 -0
  15. package/dist/mcp-chunks/{chunk-LS7PMWSR.js → chunk-6D6KPSXN.js} +1 -1
  16. package/dist/mcp-chunks/{chunk-2XL7MG7R.js → chunk-7A63PAGP.js} +15 -9
  17. package/dist/mcp-chunks/chunk-7DH57OKF.js +28 -0
  18. package/dist/mcp-chunks/{chunk-BTLAWHTA.js → chunk-7RDLPFIO.js} +2 -2
  19. package/dist/mcp-chunks/chunk-C2PQFLWS.js +422 -0
  20. package/dist/mcp-chunks/chunk-CA5WFJZA.js +197 -0
  21. package/dist/mcp-chunks/{chunk-LNH5LAJD.js → chunk-CNDY7WB4.js} +2 -2
  22. package/dist/mcp-chunks/{chunk-UKYNQGNE.js → chunk-DEUU7WSN.js} +34 -8
  23. package/dist/mcp-chunks/{chunk-LKIBAYKU.js → chunk-DXPHJFSA.js} +25 -35
  24. package/dist/mcp-chunks/{chunk-J6LYIZXN.js → chunk-E6RVTWJY.js} +1 -1
  25. package/dist/mcp-chunks/{chunk-7FHEBT5G.js → chunk-E6T37ED6.js} +18 -13
  26. package/dist/mcp-chunks/chunk-ETWN4IIA.js +57 -0
  27. package/dist/mcp-chunks/{chunk-YVZKMV5H.js → chunk-F3LL4EBL.js} +1 -1
  28. package/dist/mcp-chunks/chunk-FWP4RACK.js +42 -0
  29. package/dist/mcp-chunks/{chunk-6W5QFASN.js → chunk-GFYTST6N.js} +1 -1
  30. package/dist/mcp-chunks/{chunk-TEUKFFQL.js → chunk-GIF7LOYU.js} +2 -2
  31. package/dist/mcp-chunks/{chunk-QXJUA3ND.js → chunk-GSZOK5TS.js} +828 -7
  32. package/dist/mcp-chunks/chunk-H7F5RZXS.js +26 -0
  33. package/dist/mcp-chunks/{chunk-ECIVB7P4.js → chunk-HAO6PL7Z.js} +2 -37
  34. package/dist/mcp-chunks/{chunk-WQJZMCJN.js → chunk-HTZ2URXW.js} +5 -3
  35. package/dist/mcp-chunks/{chunk-BWHIA4PC.js → chunk-JAKI24KR.js} +1 -1
  36. package/dist/mcp-chunks/{chunk-PWYFKGKG.js → chunk-KSGYBW3F.js} +180 -89
  37. package/dist/mcp-chunks/{chunk-SJCCBNZ4.js → chunk-KSMY7PXI.js} +1 -1
  38. package/dist/mcp-chunks/{chunk-2U4BSDC4.js → chunk-L4VKBFYI.js} +48 -29
  39. package/dist/mcp-chunks/{chunk-LEZSACDE.js → chunk-LICH4Q7A.js} +4 -4
  40. package/dist/mcp-chunks/{chunk-PIIYJR44.js → chunk-LNSUME65.js} +29 -33
  41. package/dist/mcp-chunks/{chunk-D3MRAZ6H.js → chunk-LWVFSQYX.js} +13974 -15562
  42. package/dist/mcp-chunks/{chunk-7KA2VJVZ.js → chunk-NCXEJ35U.js} +10 -5
  43. package/dist/mcp-chunks/{chunk-5QOSCSQB.js → chunk-NZOIX6XW.js} +2 -2
  44. package/dist/mcp-chunks/{chunk-XANPGTLI.js → chunk-P3RN22HQ.js} +11 -4
  45. package/dist/mcp-chunks/{chunk-IABRYROW.js → chunk-PKOJCYNA.js} +3 -3
  46. package/dist/mcp-chunks/{chunk-BNV3TPE4.js → chunk-QJACOI2W.js} +5 -13
  47. package/dist/mcp-chunks/{chunk-UNKB4SBV.js → chunk-RBVYCKCD.js} +2 -2
  48. package/dist/mcp-chunks/{chunk-DHBE7UBH.js → chunk-SB2UUURE.js} +12 -42
  49. package/dist/mcp-chunks/{chunk-4SQKWYFF.js → chunk-SFREPU3D.js} +1 -1
  50. package/dist/mcp-chunks/{chunk-BZIQOWE6.js → chunk-SRZZQ6TL.js} +35 -36
  51. package/dist/mcp-chunks/{chunk-M3TPODXI.js → chunk-UENXT3NE.js} +1 -1
  52. package/dist/mcp-chunks/chunk-UHOKCTZT.js +37 -0
  53. package/dist/mcp-chunks/{chunk-E22DYOW5.js → chunk-WWO5WGH5.js} +5 -5
  54. package/dist/mcp-chunks/{chunk-6XCZGU3G.js → chunk-WXBPMFSN.js} +149 -192
  55. package/dist/mcp-chunks/{chunk-XQK2JSW4.js → chunk-XRGLP3Z2.js} +14 -2
  56. package/dist/mcp-chunks/{chunk-L7NTQVYN.js → chunk-XTL4MHFH.js} +28 -10
  57. package/dist/mcp-chunks/{chunk-N46NEFAF.js → chunk-XUF6KARU.js} +1 -1
  58. package/dist/mcp-chunks/{chunk-WD6BOD24.js → chunk-YCYSQA5V.js} +23 -4
  59. package/dist/mcp-chunks/chunk-YPJ5EHXR.js +17394 -0
  60. package/dist/mcp-chunks/{chunk-NRAJX5E4.js → chunk-YSPT6F7K.js} +3 -3
  61. package/dist/mcp-chunks/{chunk-7UDVSOOF.js → chunk-YTKRAHO6.js} +54 -46
  62. package/dist/mcp-chunks/chunk-ZBFZ5UFE.js +67 -0
  63. package/dist/mcp-chunks/{cli-UV4QJZZM.js → cli-E4P6SZLQ.js} +89 -76
  64. package/dist/mcp-chunks/client-2EJC4PLL.js +18 -0
  65. package/dist/mcp-chunks/{config-command-NLAGKID5.js → config-command-MWF3RHPQ.js} +38 -59
  66. package/dist/mcp-chunks/daemon-command-6CJ26MKI.js +33 -0
  67. package/dist/mcp-chunks/{dist-LK3SHAMX.js → dist-ZIPUENTM.js} +527 -469
  68. package/dist/mcp-chunks/{emit-ts-command-VBXVXO6V.js → emit-ts-command-GOVJJ64A.js} +16 -13
  69. package/dist/mcp-chunks/{generate-cli-runner-6CAZZA3P.js → generate-cli-runner-L5OQIMEY.js} +242 -247
  70. package/dist/mcp-chunks/{inspect-cli-command-3ZORTOR7.js → inspect-cli-command-7OMMREPE.js} +10 -9
  71. package/dist/mcp-chunks/{launch-YKRXHXJI.js → launch-BWXPLPB7.js} +1 -1
  72. package/dist/mcp-chunks/{lifecycle-XVKRHPH3.js → lifecycle-B5UC65PT.js} +1 -1
  73. package/dist/mcp-chunks/{list-command-2MEGGNFQ.js → list-command-ZO4HVFQK.js} +74 -43
  74. package/dist/mcp-chunks/{output-utils-NKESLAJ6.js → output-utils-M3TJ2N4M.js} +3 -3
  75. package/dist/mcp-chunks/{prompt-B1Yc1NPt-VGOTWJMN.js → prompt-CH6TK0bC-C7OTKGRD.js} +1 -3
  76. package/dist/mcp-chunks/{record-command-YXHTTTT5.js → record-command-VD3HUQIC.js} +5 -4
  77. package/dist/mcp-chunks/replay-command-AX6IN7YD.js +42 -0
  78. package/dist/mcp-chunks/{resource-command-OO4NYF5C.js → resource-command-JEZ2DW2G.js} +10 -10
  79. package/dist/mcp-chunks/{result-utils-MOHHLNM7.js → result-utils-3YHYGS45.js} +4 -4
  80. package/dist/mcp-chunks/runtime-HSYVOME7.js +37 -0
  81. package/dist/mcp-chunks/{runtime-wrapper-RPWDIDBF.js → runtime-wrapper-UREU7GC3.js} +7 -3
  82. package/dist/mcp-chunks/serve-command-M47YZ6JN.js +16018 -0
  83. package/dist/mcp-chunks/{timeouts-W2XWCCXR.js → timeouts-THZRYP4B.js} +3 -1
  84. package/dist/mcp-chunks/{vault-command-PIYIUEZL.js → vault-command-53P7MLCB.js} +7 -6
  85. package/dist/mcp-chunks/webapi-PHEQZQKH.js +3316 -0
  86. package/dist/mcp-client.js +11 -1
  87. package/dist/mcp-client.js.map +1 -1
  88. package/dist/mcp-daemon-client.d.ts.map +1 -1
  89. package/dist/mcp-daemon-client.js +3 -0
  90. package/dist/mcp-daemon-client.js.map +1 -1
  91. package/dist/mcp-daemon-protocol.d.ts +6 -0
  92. package/dist/mcp-daemon-protocol.d.ts.map +1 -1
  93. package/dist/mcp-daemon-protocol.js.map +1 -1
  94. package/dist/mcp-daemon.js +43 -22
  95. package/dist/mcp-daemon.js.map +1 -1
  96. package/dist/mcp-run-worker.js +29 -22
  97. package/dist/mcp-trace-context.d.ts +6 -0
  98. package/dist/mcp-trace-context.d.ts.map +1 -0
  99. package/dist/mcp-trace-context.js +31 -0
  100. package/dist/mcp-trace-context.js.map +1 -0
  101. package/dist/model-binding.d.ts.map +1 -1
  102. package/dist/model-binding.js +8 -4
  103. package/dist/model-binding.js.map +1 -1
  104. package/dist/pi-extension.d.ts.map +1 -1
  105. package/dist/pi-extension.js +12 -0
  106. package/dist/pi-extension.js.map +1 -1
  107. package/dist/recipe/resolve.d.ts +2 -0
  108. package/dist/recipe/resolve.d.ts.map +1 -1
  109. package/dist/recipe/resolve.js +2 -1
  110. package/dist/recipe/resolve.js.map +1 -1
  111. package/dist/recipe-agent.d.ts +5 -2
  112. package/dist/recipe-agent.d.ts.map +1 -1
  113. package/dist/recipe-agent.js +20 -4
  114. package/dist/recipe-agent.js.map +1 -1
  115. package/dist/recipe-model.d.ts +7 -1
  116. package/dist/recipe-model.d.ts.map +1 -1
  117. package/dist/recipe-model.js +89 -20
  118. package/dist/recipe-model.js.map +1 -1
  119. package/dist/recipe-session.d.ts +14 -0
  120. package/dist/recipe-session.d.ts.map +1 -0
  121. package/dist/recipe-session.js +181 -0
  122. package/dist/recipe-session.js.map +1 -0
  123. package/dist/session.d.ts.map +1 -1
  124. package/dist/session.js +23 -1
  125. package/dist/session.js.map +1 -1
  126. package/docs/agent-composition.md +46 -22
  127. package/docs/pi-extension.md +9 -3
  128. package/docs/recipe-format.md +41 -5
  129. package/package.json +6 -6
  130. package/vendor/introspection-recipe-check/darwin-arm64/introspection-recipe-check +0 -0
  131. package/vendor/introspection-recipe-check/darwin-x64/introspection-recipe-check +0 -0
  132. package/vendor/introspection-recipe-check/linux-arm64/introspection-recipe-check +0 -0
  133. package/vendor/introspection-recipe-check/linux-x64/introspection-recipe-check +0 -0
  134. package/vendor/introspection-recipe-check/linux-x64-musl/introspection-recipe-check +0 -0
  135. package/vendor/introspection-recipe-check/win32-x64/introspection-recipe-check.exe +0 -0
  136. package/dist/mcp-chunks/call-arguments-LU3W6D3K.js +0 -13
  137. package/dist/mcp-chunks/chunk-HKRJ6O36.js +0 -1076
  138. package/dist/mcp-chunks/chunk-NNOEGEUZ.js +0 -17273
  139. package/dist/mcp-chunks/chunk-P3PSC54P.js +0 -869
  140. package/dist/mcp-chunks/chunk-TATVT5IT.js +0 -194
  141. package/dist/mcp-chunks/chunk-YHQUTU6L.js +0 -571
  142. package/dist/mcp-chunks/client-S7RQUG5U.js +0 -13
  143. package/dist/mcp-chunks/daemon-command-U242Z6VY.js +0 -26
  144. package/dist/mcp-chunks/replay-command-25HJ6AQU.js +0 -85
  145. package/dist/mcp-chunks/runtime-5WJ3G25Y.js +0 -33
  146. package/dist/mcp-chunks/serve-command-DHXJZMMN.js +0 -3302
@@ -4,62 +4,229 @@ import {
4
4
  markExecutable,
5
5
  readPackageMetadata,
6
6
  safeCopyFile,
7
- stableJsonStringify,
8
7
  writeTemplate
9
- } from "./chunk-DHBE7UBH.js";
8
+ } from "./chunk-SB2UUURE.js";
10
9
  import {
11
10
  buildGenerateCliCommand,
12
11
  readCliMetadata,
13
12
  resolveGenerateRequestFromArtifact,
14
- serializeDefinition
15
- } from "./chunk-LKIBAYKU.js";
13
+ serializeDefinition,
14
+ validateToolSelection
15
+ } from "./chunk-DXPHJFSA.js";
16
+ import "./chunk-H7F5RZXS.js";
16
17
  import {
17
18
  expectValue
18
- } from "./chunk-XQK2JSW4.js";
19
- import "./chunk-MZ2NARG7.js";
19
+ } from "./chunk-XRGLP3Z2.js";
20
+ import "./chunk-54EWGONA.js";
20
21
  import {
21
22
  buildToolMetadataList,
22
23
  toolsTestHelpers
23
- } from "./chunk-XANPGTLI.js";
24
- import "./chunk-N46NEFAF.js";
25
- import "./chunk-BNV3TPE4.js";
24
+ } from "./chunk-P3RN22HQ.js";
25
+ import "./chunk-XUF6KARU.js";
26
+ import "./chunk-QJACOI2W.js";
26
27
  import {
27
28
  splitCommandLine
28
- } from "./chunk-E22DYOW5.js";
29
+ } from "./chunk-WWO5WGH5.js";
29
30
  import {
30
31
  extractHttpServerTarget,
31
32
  looksLikeHttpUrl,
32
33
  normalizeHttpUrl,
33
34
  normalizeHttpUrlCandidate,
34
35
  splitHttpToolSelector
35
- } from "./chunk-M3TPODXI.js";
36
+ } from "./chunk-UENXT3NE.js";
37
+ import {
38
+ stableJsonStringify
39
+ } from "./chunk-UHOKCTZT.js";
36
40
  import {
37
41
  createRuntime
38
- } from "./chunk-NNOEGEUZ.js";
39
- import "./chunk-7FHEBT5G.js";
40
- import "./chunk-BZIQOWE6.js";
41
- import "./chunk-YHQUTU6L.js";
42
- import "./chunk-TATVT5IT.js";
43
- import "./chunk-HKRJ6O36.js";
42
+ } from "./chunk-2FSDGCHW.js";
43
+ import "./chunk-CA5WFJZA.js";
44
+ import "./chunk-E6T37ED6.js";
45
+ import "./chunk-SRZZQ6TL.js";
46
+ import "./chunk-3IZQW4H4.js";
47
+ import "./chunk-C2PQFLWS.js";
48
+ import "./chunk-7DH57OKF.js";
49
+ import "./chunk-2MEHGB7D.js";
44
50
  import {
45
51
  MCPORTER_VERSION
46
- } from "./chunk-4SQKWYFF.js";
47
- import "./chunk-6W5QFASN.js";
52
+ } from "./chunk-SFREPU3D.js";
53
+ import "./chunk-GFYTST6N.js";
54
+ import "./chunk-ETWN4IIA.js";
55
+ import "./chunk-DEUU7WSN.js";
56
+ import "./chunk-YPJ5EHXR.js";
48
57
  import {
49
58
  loadServerDefinitions
50
- } from "./chunk-2U4BSDC4.js";
51
- import "./chunk-UKYNQGNE.js";
52
- import "./chunk-P3PSC54P.js";
53
- import "./chunk-2XL7MG7R.js";
54
- import "./chunk-WQJZMCJN.js";
55
- import "./chunk-ECIVB7P4.js";
59
+ } from "./chunk-L4VKBFYI.js";
60
+ import "./chunk-7A63PAGP.js";
61
+ import "./chunk-HTZ2URXW.js";
62
+ import "./chunk-FWP4RACK.js";
63
+ import "./chunk-HAO6PL7Z.js";
56
64
  import {
57
65
  resolveLifecycle
58
- } from "./chunk-LS7PMWSR.js";
59
- import "./chunk-D3MRAZ6H.js";
66
+ } from "./chunk-6D6KPSXN.js";
67
+ import "./chunk-LWVFSQYX.js";
60
68
  import "./chunk-LRKZP7DJ.js";
61
69
 
62
- // node_modules/.pnpm/mcporter@0.12.3/node_modules/mcporter/dist/cli/generate/flags.js
70
+ // node_modules/.pnpm/mcporter@0.13.0/node_modules/mcporter/dist/cli/generate/name-utils.js
71
+ function inferNameFromCommand(command) {
72
+ if (typeof command === "string") {
73
+ const normalizedHttp = normalizeHttpUrlCandidate(command);
74
+ if (normalizedHttp) {
75
+ try {
76
+ const url = new URL(normalizedHttp);
77
+ const segments = url.hostname.split(".").filter(Boolean);
78
+ for (const segment of segments) {
79
+ const lowered = segment.toLowerCase();
80
+ if (lowered === "www" || lowered === "api" || lowered === "mcp") {
81
+ continue;
82
+ }
83
+ const slug = slugify(segment);
84
+ if (slug) {
85
+ return slug;
86
+ }
87
+ }
88
+ const fallback = slugify(segments[0] ?? url.hostname);
89
+ if (fallback) {
90
+ return fallback;
91
+ }
92
+ const derived = deriveNameFromUrl(url);
93
+ const derivedSlug = derived ? slugify(derived) : void 0;
94
+ if (derivedSlug) {
95
+ return derivedSlug;
96
+ }
97
+ } catch {
98
+ }
99
+ }
100
+ const trimmed = command.trim();
101
+ if (looksLikeInlineCommand(trimmed)) {
102
+ try {
103
+ const parsed = parseInlineCommand(trimmed);
104
+ const derived = inferNameFromCommand(parsed);
105
+ if (derived) {
106
+ return derived;
107
+ }
108
+ } catch {
109
+ }
110
+ }
111
+ const firstToken = trimmed.split(/\s+/)[0] ?? trimmed;
112
+ const candidateToken = firstToken.split(/[\\/]/).pop() ?? firstToken;
113
+ return slugify(candidateToken.replace(/\.[a-z0-9]+$/i, ""));
114
+ }
115
+ const parts = [command.command, ...command.args ?? []];
116
+ if (parts.length === 0) {
117
+ return void 0;
118
+ }
119
+ const script = parts.find((part) => /\.[cm]?(ts|js)x?$/i.test(part));
120
+ if (script) {
121
+ return slugify(stripExtension(basename(script)));
122
+ }
123
+ const packageArg = parts.find((_part, index) => index > 0 && /[@/]/.test(_part));
124
+ if (packageArg) {
125
+ return slugify(packageArg.replace(/^@/, "").split("@")[0] ?? packageArg);
126
+ }
127
+ const bareArg = findLastPositionalArg(parts);
128
+ if (bareArg) {
129
+ return slugify(bareArg);
130
+ }
131
+ return slugify(basename(parts[0] ?? "command"));
132
+ }
133
+ function normalizeCommandInput(value) {
134
+ const httpCandidate = normalizeHttpUrlCandidate(value);
135
+ if (httpCandidate) {
136
+ return httpCandidate;
137
+ }
138
+ if (looksLikeInlineCommand(value)) {
139
+ return parseInlineCommand(value);
140
+ }
141
+ return { command: value };
142
+ }
143
+ function looksLikeInlineCommand(value) {
144
+ if (!value) {
145
+ return false;
146
+ }
147
+ if (!/\s/.test(value)) {
148
+ return false;
149
+ }
150
+ try {
151
+ const parts = splitCommandLine(value.trim());
152
+ return parts.length > 0;
153
+ } catch {
154
+ return false;
155
+ }
156
+ }
157
+ function parseInlineCommand(value) {
158
+ const parts = splitCommandLine(value.trim());
159
+ if (parts.length === 0) {
160
+ throw new Error("--command requires a non-empty value.");
161
+ }
162
+ const [command, ...rest] = parts;
163
+ return { command, args: rest };
164
+ }
165
+ function slugify(value) {
166
+ const normalized = value.trim().toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "");
167
+ return normalized || void 0;
168
+ }
169
+ function basename(value) {
170
+ const segments = value.split(/[\\/]/);
171
+ return segments[segments.length - 1] ?? value;
172
+ }
173
+ function stripExtension(value) {
174
+ const index = value.lastIndexOf(".");
175
+ if (index === -1) {
176
+ return value;
177
+ }
178
+ return value.slice(0, index);
179
+ }
180
+ function findLastPositionalArg(parts) {
181
+ for (let index = parts.length - 1; index >= 1; index -= 1) {
182
+ const part = parts[index];
183
+ if (!part) {
184
+ continue;
185
+ }
186
+ if (part.startsWith("-")) {
187
+ continue;
188
+ }
189
+ if (/^[A-Za-z0-9_]+=/.test(part)) {
190
+ continue;
191
+ }
192
+ if (part.includes("://")) {
193
+ continue;
194
+ }
195
+ return part;
196
+ }
197
+ return void 0;
198
+ }
199
+ function deriveNameFromUrl(url) {
200
+ const genericHosts = /* @__PURE__ */ new Set(["www", "api", "mcp", "service", "services", "app", "localhost"]);
201
+ const knownTlds = /* @__PURE__ */ new Set(["com", "net", "org", "io", "ai", "app", "dev", "co", "cloud"]);
202
+ const parts = url.hostname.split(".").filter(Boolean);
203
+ const filtered = parts.filter((part) => {
204
+ const lower = part.toLowerCase();
205
+ if (genericHosts.has(lower)) {
206
+ return false;
207
+ }
208
+ if (knownTlds.has(lower)) {
209
+ return false;
210
+ }
211
+ if (/^\d+$/.test(part)) {
212
+ return false;
213
+ }
214
+ return true;
215
+ });
216
+ if (filtered.length > 0) {
217
+ const last = filtered[filtered.length - 1];
218
+ if (last) {
219
+ return last;
220
+ }
221
+ }
222
+ const firstSegment = url.pathname.split("/").find(Boolean);
223
+ if (firstSegment) {
224
+ return firstSegment.replace(/[^a-zA-Z0-9-_]/g, "-");
225
+ }
226
+ return void 0;
227
+ }
228
+
229
+ // node_modules/.pnpm/mcporter@0.13.0/node_modules/mcporter/dist/cli/generate/flags.js
63
230
  function parseGenerateFlags(args) {
64
231
  const common = extractGeneratorFlags(args);
65
232
  let server;
@@ -118,7 +285,7 @@ function parseGenerateFlags(args) {
118
285
  }
119
286
  if (token === "--command") {
120
287
  const value = expectValue(token, args[index + 1]);
121
- command = normalizeCommandInput(value);
288
+ command = normalizeCommandInput2(value);
122
289
  args.splice(index, 2);
123
290
  continue;
124
291
  }
@@ -185,7 +352,7 @@ function parseGenerateFlags(args) {
185
352
  args.splice(position, 1);
186
353
  }
187
354
  if (looksLikeInlineCommand(positional)) {
188
- command = normalizeCommandInput(positional);
355
+ command = normalizeCommandInput2(positional);
189
356
  } else if (looksLikeHttpUrl(positional) || positional.includes("://")) {
190
357
  command = positional;
191
358
  } else {
@@ -230,198 +397,24 @@ function mergeCsvList(existing, value) {
230
397
  }
231
398
  return result;
232
399
  }
233
- function normalizeCommandInput(value) {
234
- const httpCandidate = normalizeHttpUrlCandidate(value);
235
- if (httpCandidate) {
236
- const selector = splitHttpToolSelector(httpCandidate);
400
+ function normalizeCommandInput2(value) {
401
+ const command = normalizeCommandInput(value);
402
+ if (typeof command === "string") {
403
+ const selector = splitHttpToolSelector(command);
237
404
  if (selector) {
238
405
  return selector.baseUrl;
239
406
  }
240
- return httpCandidate;
407
+ return command;
241
408
  }
242
- if (looksLikeInlineCommand(value)) {
243
- return parseInlineCommand(value);
244
- }
245
- return { command: value };
246
- }
247
- function looksLikeInlineCommand(value) {
248
- if (!value) {
249
- return false;
250
- }
251
- if (!/\s/.test(value)) {
252
- return false;
253
- }
254
- try {
255
- const parts = splitCommandLine(value.trim());
256
- return parts.length > 0;
257
- } catch {
258
- return false;
259
- }
260
- }
261
- function parseInlineCommand(value) {
262
- const parts = splitCommandLine(value.trim());
263
- if (parts.length === 0) {
264
- throw new Error("--command requires a non-empty value.");
265
- }
266
- const [command, ...rest] = parts;
267
- return { command, args: rest };
268
- }
269
-
270
- // node_modules/.pnpm/mcporter@0.12.3/node_modules/mcporter/dist/cli/generate/name-utils.js
271
- function inferNameFromCommand(command) {
272
- if (typeof command === "string") {
273
- const normalizedHttp = normalizeHttpUrlCandidate(command);
274
- if (normalizedHttp) {
275
- try {
276
- const url = new URL(normalizedHttp);
277
- const segments = url.hostname.split(".").filter(Boolean);
278
- for (const segment of segments) {
279
- const lowered = segment.toLowerCase();
280
- if (lowered === "www" || lowered === "api" || lowered === "mcp") {
281
- continue;
282
- }
283
- const slug = slugify(segment);
284
- if (slug) {
285
- return slug;
286
- }
287
- }
288
- const fallback = slugify(segments[0] ?? url.hostname);
289
- if (fallback) {
290
- return fallback;
291
- }
292
- const derived = deriveNameFromUrl(url);
293
- const derivedSlug = derived ? slugify(derived) : void 0;
294
- if (derivedSlug) {
295
- return derivedSlug;
296
- }
297
- } catch {
298
- }
299
- }
300
- const trimmed = command.trim();
301
- if (looksLikeInlineCommand2(trimmed)) {
302
- try {
303
- const parsed = parseInlineCommand2(trimmed);
304
- const derived = inferNameFromCommand(parsed);
305
- if (derived) {
306
- return derived;
307
- }
308
- } catch {
309
- }
310
- }
311
- const firstToken = trimmed.split(/\s+/)[0] ?? trimmed;
312
- const candidateToken = firstToken.split(/[\\/]/).pop() ?? firstToken;
313
- return slugify(candidateToken.replace(/\.[a-z0-9]+$/i, ""));
314
- }
315
- const parts = [command.command, ...command.args ?? []];
316
- if (parts.length === 0) {
317
- return void 0;
318
- }
319
- const script = parts.find((part) => /\.[cm]?(ts|js)x?$/i.test(part));
320
- if (script) {
321
- return slugify(stripExtension(basename(script)));
322
- }
323
- const packageArg = parts.find((_part, index) => index > 0 && /[@/]/.test(_part));
324
- if (packageArg) {
325
- return slugify(packageArg.replace(/^@/, "").split("@")[0] ?? packageArg);
326
- }
327
- const bareArg = findLastPositionalArg(parts);
328
- if (bareArg) {
329
- return slugify(bareArg);
330
- }
331
- return slugify(basename(parts[0] ?? "command"));
332
- }
333
- function looksLikeInlineCommand2(value) {
334
- if (!value) {
335
- return false;
336
- }
337
- if (!/\s/.test(value)) {
338
- return false;
339
- }
340
- try {
341
- const parts = splitCommandLine(value.trim());
342
- return parts.length > 0;
343
- } catch {
344
- return false;
345
- }
346
- }
347
- function parseInlineCommand2(value) {
348
- const parts = splitCommandLine(value.trim());
349
- if (parts.length === 0) {
350
- throw new Error("--command requires a non-empty value.");
351
- }
352
- const [command, ...rest] = parts;
353
- return { command, args: rest };
354
- }
355
- function slugify(value) {
356
- const normalized = value.trim().toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "");
357
- return normalized || void 0;
358
- }
359
- function basename(value) {
360
- const segments = value.split(/[\\/]/);
361
- return segments[segments.length - 1] ?? value;
362
- }
363
- function stripExtension(value) {
364
- const index = value.lastIndexOf(".");
365
- if (index === -1) {
366
- return value;
367
- }
368
- return value.slice(0, index);
369
- }
370
- function findLastPositionalArg(parts) {
371
- for (let index = parts.length - 1; index >= 1; index -= 1) {
372
- const part = parts[index];
373
- if (!part) {
374
- continue;
375
- }
376
- if (part.startsWith("-")) {
377
- continue;
378
- }
379
- if (/^[A-Za-z0-9_]+=/.test(part)) {
380
- continue;
381
- }
382
- if (part.includes("://")) {
383
- continue;
384
- }
385
- return part;
386
- }
387
- return void 0;
388
- }
389
- function deriveNameFromUrl(url) {
390
- const genericHosts = /* @__PURE__ */ new Set(["www", "api", "mcp", "service", "services", "app", "localhost"]);
391
- const knownTlds = /* @__PURE__ */ new Set(["com", "net", "org", "io", "ai", "app", "dev", "co", "cloud"]);
392
- const parts = url.hostname.split(".").filter(Boolean);
393
- const filtered = parts.filter((part) => {
394
- const lower = part.toLowerCase();
395
- if (genericHosts.has(lower)) {
396
- return false;
397
- }
398
- if (knownTlds.has(lower)) {
399
- return false;
400
- }
401
- if (/^\d+$/.test(part)) {
402
- return false;
403
- }
404
- return true;
405
- });
406
- if (filtered.length > 0) {
407
- const last = filtered[filtered.length - 1];
408
- if (last) {
409
- return last;
410
- }
411
- }
412
- const firstSegment = url.pathname.split("/").find(Boolean);
413
- if (firstSegment) {
414
- return firstSegment.replace(/[^a-zA-Z0-9-_]/g, "-");
415
- }
416
- return void 0;
409
+ return command;
417
410
  }
418
411
 
419
- // node_modules/.pnpm/mcporter@0.12.3/node_modules/mcporter/dist/generate-cli.js
412
+ // node_modules/.pnpm/mcporter@0.13.0/node_modules/mcporter/dist/generate-cli.js
420
413
  import fs3 from "node:fs/promises";
421
414
  import { createHash } from "node:crypto";
422
415
  import path3 from "node:path";
423
416
 
424
- // node_modules/.pnpm/mcporter@0.12.3/node_modules/mcporter/dist/cli/generate/artifacts.js
417
+ // node_modules/.pnpm/mcporter@0.13.0/node_modules/mcporter/dist/cli/generate/artifacts.js
425
418
  import { execFile as execFile2 } from "node:child_process";
426
419
  import fsSync from "node:fs";
427
420
  import fs from "node:fs/promises";
@@ -429,7 +422,7 @@ import { builtinModules, createRequire } from "node:module";
429
422
  import path from "node:path";
430
423
  import { fileURLToPath } from "node:url";
431
424
 
432
- // node_modules/.pnpm/mcporter@0.12.3/node_modules/mcporter/dist/cli/generate/runtime.js
425
+ // node_modules/.pnpm/mcporter@0.13.0/node_modules/mcporter/dist/cli/generate/runtime.js
433
426
  import { execFile } from "node:child_process";
434
427
  async function resolveRuntimeKind(runtimeOption, compileOption) {
435
428
  if (runtimeOption) {
@@ -463,7 +456,7 @@ async function isBunAvailable() {
463
456
  }
464
457
  }
465
458
 
466
- // node_modules/.pnpm/mcporter@0.12.3/node_modules/mcporter/dist/cli/generate/artifacts.js
459
+ // node_modules/.pnpm/mcporter@0.13.0/node_modules/mcporter/dist/cli/generate/artifacts.js
467
460
  var localRequire = createRequire(import.meta.url);
468
461
  var packageRoot = fileURLToPath(new URL("../../..", import.meta.url));
469
462
  var BUNDLED_DEPENDENCIES = ["commander", "mcporter", "jsonc-parser"];
@@ -478,7 +471,7 @@ async function bundleOutput({ sourcePath, targetPath, runtimeKind, minify, bundl
478
471
  async function bundleWithRolldown({ sourcePath, targetPath, runtimeKind, minify }) {
479
472
  let rolldownImpl;
480
473
  try {
481
- ({ rolldown: rolldownImpl } = await import("./dist-LK3SHAMX.js"));
474
+ ({ rolldown: rolldownImpl } = await import("./dist-ZIPUENTM.js"));
482
475
  } catch (error) {
483
476
  const message = "Rolldown bundling is unavailable in this build of mcporter; rerun with --bundler bun or install mcporter via npm (Node.js) to use the Rolldown bundler.";
484
477
  if (error instanceof Error) {
@@ -595,7 +588,7 @@ function resolveBundleTarget({ bundle, compile, outputPath }) {
595
588
  }
596
589
  if (typeof compile === "string") {
597
590
  const ext = path.extname(compile);
598
- const base = ext ? path.join(path.dirname(compile), path.basename(compile, ext)) : compile;
591
+ const base = path.join(path.dirname(compile), path.basename(compile, ext));
599
592
  return `${base}.js`;
600
593
  }
601
594
  if (compile) {
@@ -715,15 +708,22 @@ function formatMcporterInstallSpec(installSpec) {
715
708
  return `mcporter from ${installSpec}`;
716
709
  }
717
710
  function resolveDependencyDirectory(specifier) {
711
+ if (specifier === "mcporter") {
712
+ return packageRoot;
713
+ }
718
714
  try {
719
- if (specifier === "mcporter") {
720
- return packageRoot;
715
+ const entryPath = localRequire.resolve(specifier);
716
+ let candidate = path.dirname(entryPath);
717
+ while (candidate !== path.dirname(candidate)) {
718
+ if (fsSync.existsSync(path.join(candidate, "package.json"))) {
719
+ return candidate;
720
+ }
721
+ candidate = path.dirname(candidate);
721
722
  }
722
- const pkgPath = localRequire.resolve(path.join(specifier, "package.json"));
723
- return path.dirname(pkgPath);
724
723
  } catch {
725
724
  return void 0;
726
725
  }
726
+ return void 0;
727
727
  }
728
728
  async function linkOrCopyDependency(sourceDir, targetDir) {
729
729
  try {
@@ -757,7 +757,7 @@ function resolveUniquePath(directory, baseName) {
757
757
  return attempt;
758
758
  }
759
759
 
760
- // node_modules/.pnpm/mcporter@0.12.3/node_modules/mcporter/dist/cli/generate/definition.js
760
+ // node_modules/.pnpm/mcporter@0.13.0/node_modules/mcporter/dist/cli/generate/definition.js
761
761
  import fs2 from "node:fs/promises";
762
762
  import path2 from "node:path";
763
763
  function ensureInvocationDefaults(invocation, definition) {
@@ -878,15 +878,17 @@ function normalizeDefinition(def) {
878
878
  const description = typeof def.description === "string" ? def.description : void 0;
879
879
  const env = toStringRecord(def.env);
880
880
  const auth = typeof def.auth === "string" ? def.auth : void 0;
881
- const tokenCacheDir = typeof def.tokenCacheDir === "string" ? def.tokenCacheDir : void 0;
882
- const clientName = typeof def.clientName === "string" ? def.clientName : void 0;
883
881
  const record = def;
882
+ const tokenCacheDir = stringFromAliases(record, "tokenCacheDir", "token_cache_dir");
883
+ const clientName = stringFromAliases(record, "clientName", "client_name");
884
+ const protocolVersion = getProtocolVersion(record.protocolVersion ?? record.protocol_version);
884
885
  const oauthClientId = stringFromAliases(record, "oauthClientId", "oauth_client_id");
885
886
  const oauthClientSecret = stringFromAliases(record, "oauthClientSecret", "oauth_client_secret");
886
887
  const oauthClientSecretEnv = stringFromAliases(record, "oauthClientSecretEnv", "oauth_client_secret_env");
887
888
  const oauthTokenEndpointAuthMethod = stringFromAliases(record, "oauthTokenEndpointAuthMethod", "oauth_token_endpoint_auth_method");
888
- const oauthRedirectUrl = typeof def.oauthRedirectUrl === "string" ? def.oauthRedirectUrl : void 0;
889
- const oauthScope = typeof def.oauthScope === "string" ? def.oauthScope : void 0;
889
+ const oauthRedirectUrl = stringFromAliases(record, "oauthRedirectUrl", "oauth_redirect_url");
890
+ const oauthClientMetadataUrl = stringFromAliases(record, "oauthClientMetadataUrl", "oauth_client_metadata_url");
891
+ const oauthScope = stringFromAliases(record, "oauthScope", "oauth_scope");
890
892
  const refresh = getRefresh(record.refresh);
891
893
  const httpFetch = normalizeHttpFetch(stringFromAliases(record, "httpFetch", "http_fetch"));
892
894
  const headers = toStringRecord(def.headers);
@@ -903,11 +905,13 @@ function normalizeDefinition(def) {
903
905
  auth,
904
906
  tokenCacheDir,
905
907
  clientName,
908
+ protocolVersion,
906
909
  oauthClientId,
907
910
  oauthClientSecret,
908
911
  oauthClientSecretEnv,
909
912
  oauthTokenEndpointAuthMethod,
910
913
  oauthRedirectUrl,
914
+ oauthClientMetadataUrl,
911
915
  oauthScope,
912
916
  oauthCommand,
913
917
  refresh,
@@ -1071,6 +1075,9 @@ function getRefresh(value) {
1071
1075
  function normalizeHttpFetch(value) {
1072
1076
  return value === "default" || value === "node-http1" ? value : void 0;
1073
1077
  }
1078
+ function getProtocolVersion(value) {
1079
+ return value === "auto" || value === "legacy" || value === "2026-07-28" ? value : void 0;
1080
+ }
1074
1081
  function stringFromAliases(record, ...keys) {
1075
1082
  for (const key of keys) {
1076
1083
  const value = record[key];
@@ -1093,7 +1100,7 @@ function toStringRecord(value) {
1093
1100
  return Object.keys(result).length > 0 ? result : void 0;
1094
1101
  }
1095
1102
 
1096
- // node_modules/.pnpm/mcporter@0.12.3/node_modules/mcporter/dist/generate-cli.js
1103
+ // node_modules/.pnpm/mcporter@0.13.0/node_modules/mcporter/dist/generate-cli.js
1097
1104
  var REPRODUCIBLE_GENERATED_AT = "1970-01-01T00:00:00.000Z";
1098
1105
  async function generateCli(options) {
1099
1106
  const runtimeKind = await resolveRuntimeKind(options.runtime, options.compile);
@@ -1233,15 +1240,9 @@ function sanitizePathSegment(value) {
1233
1240
  return value.toLowerCase().replace(/[^a-z0-9._-]+/g, "-").replace(/^-+|-+$/g, "");
1234
1241
  }
1235
1242
  function applyToolFilters(tools, includeTools, excludeTools) {
1236
- if (includeTools && excludeTools) {
1237
- throw new Error("Internal error: both includeTools and excludeTools provided to generateCli.");
1238
- }
1239
- if (includeTools && includeTools.length === 0) {
1240
- throw new Error("--include-tools requires at least one tool name.");
1241
- }
1242
- if (excludeTools && excludeTools.length === 0) {
1243
- throw new Error("--exclude-tools requires at least one tool name.");
1244
- }
1243
+ validateToolSelection(includeTools, excludeTools, {
1244
+ mutuallyExclusiveMessage: "Internal error: both includeTools and excludeTools provided to generateCli."
1245
+ });
1245
1246
  if (!includeTools && !excludeTools) {
1246
1247
  return tools;
1247
1248
  }
@@ -1277,7 +1278,7 @@ function applyToolFilters(tools, includeTools, excludeTools) {
1277
1278
  }
1278
1279
  var __test = { ...toolsTestHelpers, applyToolFilters };
1279
1280
 
1280
- // node_modules/.pnpm/mcporter@0.12.3/node_modules/mcporter/dist/cli/generate/output.js
1281
+ // node_modules/.pnpm/mcporter@0.13.0/node_modules/mcporter/dist/cli/generate/output.js
1281
1282
  async function performGenerateFromArtifact(metadata, request) {
1282
1283
  const { outputPath, bundlePath, compilePath } = await generateCli(request);
1283
1284
  if (metadata.artifact.kind === "binary" && compilePath) {
@@ -1301,7 +1302,7 @@ async function performGenerateFromRequest(request) {
1301
1302
  }
1302
1303
  }
1303
1304
 
1304
- // node_modules/.pnpm/mcporter@0.12.3/node_modules/mcporter/dist/cli/generate/server-utils.js
1305
+ // node_modules/.pnpm/mcporter@0.13.0/node_modules/mcporter/dist/cli/generate/server-utils.js
1305
1306
  function buildInlineServerDefinition(name, command, description) {
1306
1307
  if (typeof command === "string") {
1307
1308
  const url = normalizeHttpUrlCandidate(command) ?? command;
@@ -1334,18 +1335,12 @@ function buildInlineServerDefinition(name, command, description) {
1334
1335
  };
1335
1336
  }
1336
1337
 
1337
- // node_modules/.pnpm/mcporter@0.12.3/node_modules/mcporter/dist/cli/generate-cli-runner.js
1338
+ // node_modules/.pnpm/mcporter@0.13.0/node_modules/mcporter/dist/cli/generate-cli-runner.js
1338
1339
  async function handleGenerateCli(args, globalFlags) {
1339
1340
  const parsed = parseGenerateFlags(args);
1340
- if (parsed.includeTools && parsed.excludeTools) {
1341
- throw new Error("--include-tools and --exclude-tools cannot be used together.");
1342
- }
1343
- if (parsed.includeTools && parsed.includeTools.length === 0) {
1344
- throw new Error("--include-tools requires at least one tool name.");
1345
- }
1346
- if (parsed.excludeTools && parsed.excludeTools.length === 0) {
1347
- throw new Error("--exclude-tools requires at least one tool name.");
1348
- }
1341
+ validateToolSelection(parsed.includeTools, parsed.excludeTools, {
1342
+ mutuallyExclusiveMessage: "--include-tools and --exclude-tools cannot be used together."
1343
+ });
1349
1344
  if (parsed.from && (parsed.command || parsed.description || parsed.name)) {
1350
1345
  throw new Error("--from cannot be combined with --command/--description/--name.");
1351
1346
  }