@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,15 @@
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/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
+ };
@@ -0,0 +1,290 @@
1
+ import { createRequire as __createRequire } from "node:module"; const require = __createRequire(import.meta.url);
2
+ import {
3
+ analyzeConnectionError
4
+ } from "./chunk-UKYNQGNE.js";
5
+
6
+ // node_modules/.pnpm/mcporter@0.12.3/node_modules/mcporter/dist/result-utils.js
7
+ function extractEnvelope(raw) {
8
+ return collectEnvelopeFields(raw, { content: null, structuredContent: null }, 0);
9
+ }
10
+ function collectEnvelopeFields(raw, envelope, depth) {
11
+ if (!raw || typeof raw !== "object") {
12
+ return envelope;
13
+ }
14
+ const obj = raw;
15
+ let { content, structuredContent } = envelope;
16
+ if (!content && "content" in obj && Array.isArray(obj.content)) {
17
+ content = obj.content;
18
+ }
19
+ if (structuredContent === null && "structuredContent" in obj) {
20
+ structuredContent = obj.structuredContent;
21
+ }
22
+ const updated = { content, structuredContent };
23
+ if (depth >= 2) {
24
+ return updated;
25
+ }
26
+ let nested = updated;
27
+ if ("raw" in obj) {
28
+ nested = collectEnvelopeFields(obj.raw, nested, depth + 1);
29
+ }
30
+ if ("result" in obj) {
31
+ nested = collectEnvelopeFields(obj.result, nested, depth + 1);
32
+ }
33
+ return nested;
34
+ }
35
+ function asString(value) {
36
+ if (typeof value === "string") {
37
+ return value;
38
+ }
39
+ if (value && typeof value === "object" && "text" in value) {
40
+ const text = value.text;
41
+ return typeof text === "string" ? text : null;
42
+ }
43
+ return null;
44
+ }
45
+ function collectCallContent(raw) {
46
+ const envelope = extractEnvelope(raw);
47
+ const textEntries = [];
48
+ const markdownEntries = [];
49
+ const jsonCandidates = [];
50
+ const images = [];
51
+ const rawContents = raw && typeof raw === "object" && Array.isArray(raw.contents) ? raw.contents ?? [] : void 0;
52
+ if (rawContents) {
53
+ for (const resource of rawContents) {
54
+ collectResourcePayload(resource, textEntries, markdownEntries, jsonCandidates);
55
+ }
56
+ }
57
+ if (!envelope.content) {
58
+ return {
59
+ content: envelope.content,
60
+ structuredContent: envelope.structuredContent,
61
+ textEntries,
62
+ markdownEntries,
63
+ jsonCandidates,
64
+ images
65
+ };
66
+ }
67
+ for (const entry of envelope.content) {
68
+ if (typeof entry === "string") {
69
+ const parsed2 = tryParseJson(entry);
70
+ if (parsed2 !== null) {
71
+ jsonCandidates.push(parsed2);
72
+ }
73
+ continue;
74
+ }
75
+ if (!entry || typeof entry !== "object" || !("type" in entry)) {
76
+ continue;
77
+ }
78
+ const typedEntry = entry;
79
+ if (typedEntry.type === "json") {
80
+ const parsed2 = tryParseJson(entry);
81
+ if (parsed2 !== null) {
82
+ jsonCandidates.push(parsed2);
83
+ }
84
+ continue;
85
+ }
86
+ if (typedEntry.type === "image") {
87
+ const data = typedEntry.data;
88
+ const mimeType = typedEntry.mimeType ?? "image/png";
89
+ if (typeof data === "string" && typeof mimeType === "string") {
90
+ images.push({ data, mimeType });
91
+ }
92
+ continue;
93
+ }
94
+ if (typedEntry.type === "resource") {
95
+ const resource = typedEntry.resource;
96
+ collectResourcePayload(resource, textEntries, markdownEntries, jsonCandidates);
97
+ continue;
98
+ }
99
+ if (typedEntry.type !== "text" && typedEntry.type !== "markdown") {
100
+ continue;
101
+ }
102
+ const text = asString(entry);
103
+ if (!text) {
104
+ continue;
105
+ }
106
+ textEntries.push(text);
107
+ if (typedEntry.type === "markdown") {
108
+ markdownEntries.push(text);
109
+ }
110
+ const parsed = tryParseJson(text);
111
+ if (parsed !== null) {
112
+ jsonCandidates.push(parsed);
113
+ }
114
+ }
115
+ return {
116
+ content: envelope.content,
117
+ structuredContent: envelope.structuredContent,
118
+ textEntries,
119
+ markdownEntries,
120
+ jsonCandidates,
121
+ images
122
+ };
123
+ }
124
+ function collectResourcePayload(resource, textEntries, markdownEntries, jsonCandidates) {
125
+ if (!resource || typeof resource !== "object") {
126
+ return;
127
+ }
128
+ const record = resource;
129
+ const uri = typeof record.uri === "string" ? record.uri : "";
130
+ const mimeType = typeof record.mimeType === "string" ? record.mimeType : "";
131
+ if (typeof record.text === "string") {
132
+ textEntries.push(record.text);
133
+ if (mimeType.toLowerCase().includes("markdown")) {
134
+ markdownEntries.push(record.text);
135
+ }
136
+ const parsed = tryParseJson(record.text);
137
+ if (parsed !== null) {
138
+ jsonCandidates.push(parsed);
139
+ }
140
+ } else if (typeof record.blob === "string") {
141
+ textEntries.push(`[Binary resource: ${uri}]`);
142
+ }
143
+ }
144
+ function collectText(entries, joiner) {
145
+ if (entries.length === 0) {
146
+ return null;
147
+ }
148
+ return entries.join(joiner);
149
+ }
150
+ function collectImages(images) {
151
+ if (images.length === 0) {
152
+ return null;
153
+ }
154
+ return images;
155
+ }
156
+ function unwrapJsonEnvelope(record, fallback) {
157
+ if ("json" in record) {
158
+ return record.json ?? null;
159
+ }
160
+ if ("data" in record) {
161
+ return Object.keys(record).length === 1 ? record.data ?? null : fallback;
162
+ }
163
+ return null;
164
+ }
165
+ function parseStructuredContent(value) {
166
+ if (value === void 0 || value === null) {
167
+ return null;
168
+ }
169
+ if (typeof value === "string") {
170
+ return tryParseJson(value);
171
+ }
172
+ if (typeof value !== "object") {
173
+ return null;
174
+ }
175
+ const unwrapped = unwrapJsonEnvelope(value, value);
176
+ return unwrapped ?? value;
177
+ }
178
+ function tryParseJson(value) {
179
+ if (value === void 0 || value === null) {
180
+ return null;
181
+ }
182
+ if (typeof value === "object") {
183
+ const unwrapped = unwrapJsonEnvelope(value, value);
184
+ if (unwrapped !== null) {
185
+ return unwrapped;
186
+ }
187
+ }
188
+ if (typeof value === "string") {
189
+ try {
190
+ return JSON.parse(value);
191
+ } catch {
192
+ return null;
193
+ }
194
+ }
195
+ return null;
196
+ }
197
+ function createCallResult(raw) {
198
+ let cachedContent;
199
+ const getCollectedContent = () => {
200
+ if (cachedContent) {
201
+ return cachedContent;
202
+ }
203
+ cachedContent = collectCallContent(raw);
204
+ return cachedContent;
205
+ };
206
+ return {
207
+ raw,
208
+ text(joiner = "\n") {
209
+ if (raw == null) {
210
+ return null;
211
+ }
212
+ if (typeof raw === "string") {
213
+ return raw;
214
+ }
215
+ const collected = getCollectedContent();
216
+ const combinedText = collectText(collected.textEntries, joiner);
217
+ if (combinedText) {
218
+ return combinedText;
219
+ }
220
+ return asString(collected.structuredContent);
221
+ },
222
+ markdown(joiner = "\n") {
223
+ const collected = getCollectedContent();
224
+ const structured = collected.structuredContent;
225
+ if (structured && typeof structured === "object") {
226
+ const markdown = structured.markdown;
227
+ if (typeof markdown === "string") {
228
+ return markdown;
229
+ }
230
+ }
231
+ return collectText(collected.markdownEntries, joiner);
232
+ },
233
+ json() {
234
+ const collected = getCollectedContent();
235
+ const parsedStructured = parseStructuredContent(collected.structuredContent);
236
+ if (parsedStructured !== null) {
237
+ return parsedStructured;
238
+ }
239
+ if (collected.jsonCandidates.length === 1) {
240
+ return collected.jsonCandidates[0];
241
+ }
242
+ if (collected.jsonCandidates.length > 1) {
243
+ return collected.jsonCandidates;
244
+ }
245
+ if (typeof raw === "string") {
246
+ const parsedRaw = tryParseJson(raw);
247
+ if (parsedRaw !== null) {
248
+ return parsedRaw;
249
+ }
250
+ }
251
+ const textContent = this.text?.();
252
+ if (typeof textContent === "string") {
253
+ const parsedText = tryParseJson(textContent);
254
+ if (parsedText !== null) {
255
+ return parsedText;
256
+ }
257
+ }
258
+ const markdownContent = this.markdown?.();
259
+ if (typeof markdownContent === "string") {
260
+ const parsedMarkdown = tryParseJson(markdownContent);
261
+ if (parsedMarkdown !== null) {
262
+ return parsedMarkdown;
263
+ }
264
+ }
265
+ return null;
266
+ },
267
+ images() {
268
+ const collected = getCollectedContent();
269
+ return collectImages(collected.images);
270
+ },
271
+ content() {
272
+ return getCollectedContent().content;
273
+ },
274
+ structuredContent() {
275
+ return getCollectedContent().structuredContent;
276
+ }
277
+ };
278
+ }
279
+ function describeConnectionIssue(error) {
280
+ return analyzeConnectionError(error);
281
+ }
282
+ function wrapCallResult(raw) {
283
+ return { raw, callResult: createCallResult(raw) };
284
+ }
285
+
286
+ export {
287
+ createCallResult,
288
+ describeConnectionIssue,
289
+ wrapCallResult
290
+ };
@@ -0,0 +1,77 @@
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/logging.js
4
+ var LOG_LEVEL_ORDER = {
5
+ debug: 10,
6
+ info: 20,
7
+ warn: 30,
8
+ error: 40
9
+ };
10
+ var LOG_LEVEL_ALIASES = {
11
+ warning: "warn",
12
+ verbose: "debug"
13
+ };
14
+ function parseLogLevel(value, defaultLevel = "warn") {
15
+ if (!value) {
16
+ return defaultLevel;
17
+ }
18
+ const normalized = value.trim().toLowerCase();
19
+ if (!normalized) {
20
+ return defaultLevel;
21
+ }
22
+ const alias = LOG_LEVEL_ALIASES[normalized];
23
+ const candidate = alias ?? (normalized in LOG_LEVEL_ORDER ? normalized : void 0);
24
+ if (!candidate) {
25
+ const allowed = [...Object.keys(LOG_LEVEL_ORDER), ...Object.keys(LOG_LEVEL_ALIASES)].filter((key, index, array) => array.indexOf(key) === index).join(", ");
26
+ throw new Error(`Invalid log level '${value}'. Expected one of: ${allowed}.`);
27
+ }
28
+ return candidate;
29
+ }
30
+ function resolveLogLevelFromEnv(env = process.env, defaultLevel = "warn") {
31
+ try {
32
+ return parseLogLevel(env.MCPORTER_LOG_LEVEL, defaultLevel);
33
+ } catch (error) {
34
+ const raw = env.MCPORTER_LOG_LEVEL;
35
+ const message = error instanceof Error ? error.message : String(error);
36
+ console.warn(`[mcporter] Ignoring invalid MCPORTER_LOG_LEVEL value '${raw ?? ""}': ${message}`);
37
+ return defaultLevel;
38
+ }
39
+ }
40
+ function shouldLog(level, threshold) {
41
+ return LOG_LEVEL_ORDER[level] >= LOG_LEVEL_ORDER[threshold];
42
+ }
43
+ function createPrefixedConsoleLogger(prefix, level) {
44
+ const threshold = parseLogLevel(level);
45
+ const format = (message) => `[${prefix}] ${message}`;
46
+ return {
47
+ debug(message) {
48
+ if (shouldLog("debug", threshold)) {
49
+ console.debug(format(message));
50
+ }
51
+ },
52
+ info(message) {
53
+ if (shouldLog("info", threshold)) {
54
+ console.log(format(message));
55
+ }
56
+ },
57
+ warn(message) {
58
+ if (shouldLog("warn", threshold)) {
59
+ console.warn(format(message));
60
+ }
61
+ },
62
+ error(message, error) {
63
+ if (shouldLog("error", threshold)) {
64
+ console.error(format(message));
65
+ if (error) {
66
+ console.error(error);
67
+ }
68
+ }
69
+ }
70
+ };
71
+ }
72
+
73
+ export {
74
+ parseLogLevel,
75
+ resolveLogLevelFromEnv,
76
+ createPrefixedConsoleLogger
77
+ };