@introspection-ai/recipes 0.18.0 → 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 +7 -7
  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,12 +4,12 @@ import {
4
4
  extraDimText,
5
5
  redText,
6
6
  yellowText
7
- } from "./chunk-N46NEFAF.js";
7
+ } from "./chunk-XUF6KARU.js";
8
8
  import {
9
9
  analyzeConnectionError
10
- } from "./chunk-UKYNQGNE.js";
10
+ } from "./chunk-DEUU7WSN.js";
11
11
 
12
- // node_modules/.pnpm/mcporter@0.12.3/node_modules/mcporter/dist/cli/path-utils.js
12
+ // node_modules/.pnpm/mcporter@0.13.0/node_modules/mcporter/dist/cli/path-utils.js
13
13
  import os from "node:os";
14
14
  import path from "node:path";
15
15
  function formatPathForDisplay(filePath) {
@@ -19,7 +19,7 @@ function formatPathForDisplay(filePath) {
19
19
  return displayPath;
20
20
  }
21
21
 
22
- // node_modules/.pnpm/mcporter@0.12.3/node_modules/mcporter/dist/cli/list-format.js
22
+ // node_modules/.pnpm/mcporter@0.13.0/node_modules/mcporter/dist/cli/list-format.js
23
23
  function renderServerListRow(result, timeoutMs, options = {}) {
24
24
  const description = result.server.description ? dimText(` \u2014 ${result.server.description}`) : "";
25
25
  const durationLabel = dimText(`${(result.durationMs / 1e3).toFixed(1)}s`);
@@ -30,7 +30,7 @@ function renderServerListRow(result, timeoutMs, options = {}) {
30
30
  if (result.status === "ok") {
31
31
  const toolSuffix = result.tools.length === 0 ? "no tools reported" : `${result.tools.length === 1 ? "1 tool" : `${result.tools.length} tools`}`;
32
32
  return {
33
- line: `${prefix} (${toolSuffix}, ${durationLabel})${sourceSuffix}`,
33
+ line: `${prefix} (${toolSuffix}, ${durationLabel}${formatProtocolSuffix(result.connectionInfo, options.verbose)})${sourceSuffix}`,
34
34
  summary: toolSuffix,
35
35
  category: "ok"
36
36
  };
@@ -45,6 +45,11 @@ function renderServerListRow(result, timeoutMs, options = {}) {
45
45
  issue: advice.issue
46
46
  };
47
47
  }
48
+ function formatProtocolSuffix(info, verbose) {
49
+ if (!verbose || !info?.protocolVersion)
50
+ return "";
51
+ return `, ${info.protocolVersion}${info.era ? ` ${info.era}` : ""}`;
52
+ }
48
53
  function formatSourceSuffix(sourceOrSources, inline = false, options = {}) {
49
54
  const sources = Array.isArray(sourceOrSources) ? [...sourceOrSources] : sourceOrSources ? [sourceOrSources] : [];
50
55
  if (sources.length === 0) {
@@ -1,9 +1,9 @@
1
1
  import { createRequire as __createRequire } from "node:module"; const require = __createRequire(import.meta.url);
2
2
  import {
3
3
  analyzeConnectionError
4
- } from "./chunk-UKYNQGNE.js";
4
+ } from "./chunk-DEUU7WSN.js";
5
5
 
6
- // node_modules/.pnpm/mcporter@0.12.3/node_modules/mcporter/dist/result-utils.js
6
+ // node_modules/.pnpm/mcporter@0.13.0/node_modules/mcporter/dist/result-utils.js
7
7
  function extractEnvelope(raw) {
8
8
  return collectEnvelopeFields(raw, { content: null, structuredContent: null }, 0);
9
9
  }
@@ -1,6 +1,6 @@
1
1
  import { createRequire as __createRequire } from "node:module"; const require = __createRequire(import.meta.url);
2
2
 
3
- // node_modules/.pnpm/mcporter@0.12.3/node_modules/mcporter/dist/cli/generate/tools.js
3
+ // node_modules/.pnpm/mcporter@0.13.0/node_modules/mcporter/dist/cli/generate/tools.js
4
4
  function resolveSchemaType(value) {
5
5
  if (value === "integer") {
6
6
  return "number";
@@ -34,14 +34,21 @@ function buildToolMetadataList(tools, options = {}) {
34
34
  result.sort((left, right) => left.tool.name.localeCompare(right.tool.name));
35
35
  }
36
36
  const methods = /* @__PURE__ */ new Map();
37
+ const kept = [];
37
38
  for (const entry of result) {
38
39
  const previous = methods.get(entry.methodName);
39
- if (previous) {
40
- throw new Error(`Generated proxy method collision '${entry.methodName}' for tools '${previous}' and '${entry.tool.name}'.`);
40
+ if (previous !== void 0) {
41
+ if (previous === entry.tool.name)
42
+ continue;
43
+ if (options.onCollision !== "skip") {
44
+ throw new Error(`Generated proxy method collision '${entry.methodName}' for tools '${previous}' and '${entry.tool.name}'.`);
45
+ }
46
+ continue;
41
47
  }
42
48
  methods.set(entry.methodName, entry.tool.name);
49
+ kept.push(entry);
43
50
  }
44
- return result;
51
+ return kept;
45
52
  }
46
53
  function buildEmbeddedSchemaMap(tools) {
47
54
  const result = {};
@@ -1,9 +1,9 @@
1
1
  import { createRequire as __createRequire } from "node:module"; const require = __createRequire(import.meta.url);
2
2
  import {
3
3
  buildToolMetadataList
4
- } from "./chunk-XANPGTLI.js";
4
+ } from "./chunk-P3RN22HQ.js";
5
5
 
6
- // node_modules/.pnpm/mcporter@0.12.3/node_modules/mcporter/dist/cli/tool-cache.js
6
+ // node_modules/.pnpm/mcporter@0.13.0/node_modules/mcporter/dist/cli/tool-cache.js
7
7
  var runtimeCache = /* @__PURE__ */ new WeakMap();
8
8
  function cacheKey(serverName, options) {
9
9
  const includeSchema = options.includeSchema !== false;
@@ -31,7 +31,7 @@ async function loadToolMetadata(runtime, serverName, options = {}) {
31
31
  allowCachedAuth: options.allowCachedAuth ?? true,
32
32
  disableOAuth: options.disableOAuth
33
33
  };
34
- const promise = runtime.listTools(serverName, listOptions).then((tools) => buildToolMetadataList(tools, { sort: false })).catch((error) => {
34
+ const promise = runtime.listTools(serverName, listOptions).then((tools) => buildToolMetadataList(tools, { sort: false, onCollision: "skip" })).catch((error) => {
35
35
  cache?.delete(key);
36
36
  throw error;
37
37
  });
@@ -1,6 +1,9 @@
1
1
  import { createRequire as __createRequire } from "node:module"; const require = __createRequire(import.meta.url);
2
+ import {
3
+ raceWithTimeout
4
+ } from "./chunk-ETWN4IIA.js";
2
5
 
3
- // node_modules/.pnpm/mcporter@0.12.3/node_modules/mcporter/dist/cli/timeouts.js
6
+ // node_modules/.pnpm/mcporter@0.13.0/node_modules/mcporter/dist/cli/timeouts.js
4
7
  var DEFAULT_LIST_TIMEOUT_MS = 3e4;
5
8
  var DEFAULT_CALL_TIMEOUT_MS = 6e4;
6
9
  var POSITIVE_INTEGER_PATTERN = /^[1-9]\d*$/;
@@ -28,18 +31,7 @@ function withTimeout(promise, timeoutMs) {
28
31
  if (!Number.isFinite(timeoutMs) || timeoutMs <= 0) {
29
32
  return promise;
30
33
  }
31
- return new Promise((resolve, reject) => {
32
- const timer = setTimeout(() => {
33
- reject(new Error("Timeout"));
34
- }, timeoutMs);
35
- promise.then((value) => {
36
- clearTimeout(timer);
37
- resolve(value);
38
- }, (error) => {
39
- clearTimeout(timer);
40
- reject(error);
41
- });
42
- });
34
+ return raceWithTimeout(promise, timeoutMs);
43
35
  }
44
36
  function consumeTimeoutFlag(args, index, options) {
45
37
  const flagName = options?.flagName ?? "--timeout";
@@ -2,9 +2,9 @@ import { createRequire as __createRequire } from "node:module"; const require =
2
2
  import {
3
3
  createPrefixedConsoleLogger,
4
4
  resolveLogLevelFromEnv
5
- } from "./chunk-6W5QFASN.js";
5
+ } from "./chunk-GFYTST6N.js";
6
6
 
7
- // node_modules/.pnpm/mcporter@0.12.3/node_modules/mcporter/dist/cli/logger-context.js
7
+ // node_modules/.pnpm/mcporter@0.13.0/node_modules/mcporter/dist/cli/logger-context.js
8
8
  var activeLogLevel = resolveLogLevelFromEnv();
9
9
  var activeLogger = createPrefixedConsoleLogger("mcporter", activeLogLevel);
10
10
  function getActiveLogLevel() {
@@ -1,18 +1,21 @@
1
1
  import { createRequire as __createRequire } from "node:module"; const require = __createRequire(import.meta.url);
2
2
  import {
3
3
  buildToolDoc
4
- } from "./chunk-MZ2NARG7.js";
4
+ } from "./chunk-54EWGONA.js";
5
5
  import {
6
6
  buildEmbeddedSchemaMap
7
- } from "./chunk-XANPGTLI.js";
7
+ } from "./chunk-P3RN22HQ.js";
8
8
  import {
9
9
  parsePositiveInteger
10
- } from "./chunk-BNV3TPE4.js";
10
+ } from "./chunk-QJACOI2W.js";
11
+ import {
12
+ stableJsonStringify
13
+ } from "./chunk-UHOKCTZT.js";
11
14
  import {
12
15
  MCPORTER_VERSION
13
- } from "./chunk-4SQKWYFF.js";
16
+ } from "./chunk-SFREPU3D.js";
14
17
 
15
- // node_modules/.pnpm/mcporter@0.12.3/node_modules/mcporter/dist/cli/generate/flag-parser.js
18
+ // node_modules/.pnpm/mcporter@0.13.0/node_modules/mcporter/dist/cli/generate/flag-parser.js
16
19
  function extractGeneratorFlags(args, options = {}) {
17
20
  const result = {};
18
21
  let index = 0;
@@ -54,12 +57,12 @@ function extractGeneratorFlags(args, options = {}) {
54
57
  return result;
55
58
  }
56
59
 
57
- // node_modules/.pnpm/mcporter@0.12.3/node_modules/mcporter/dist/cli/generate/template.js
60
+ // node_modules/.pnpm/mcporter@0.13.0/node_modules/mcporter/dist/cli/generate/template.js
58
61
  import { realpathSync } from "node:fs";
59
62
  import fs2 from "node:fs/promises";
60
63
  import path from "node:path";
61
64
 
62
- // node_modules/.pnpm/mcporter@0.12.3/node_modules/mcporter/dist/cli/generate/fs-helpers.js
65
+ // node_modules/.pnpm/mcporter@0.13.0/node_modules/mcporter/dist/cli/generate/fs-helpers.js
63
66
  import fs from "node:fs/promises";
64
67
  async function markExecutable(filePath) {
65
68
  try {
@@ -90,7 +93,7 @@ function shouldIgnorePosixPermissionError(error) {
90
93
  return code === "EPERM" || code === "EINVAL" || code === "ENOSYS" || code === "EACCES";
91
94
  }
92
95
 
93
- // node_modules/.pnpm/mcporter@0.12.3/node_modules/mcporter/dist/cli/generate/template-help.js
96
+ // node_modules/.pnpm/mcporter@0.13.0/node_modules/mcporter/dist/cli/generate/template-help.js
94
97
  function renderEmbeddedHelpSource() {
95
98
  return `function configureGeneratedCommandHelp(command: Command): void {
96
99
  command.configureHelp({
@@ -204,39 +207,7 @@ function quickStartExamples(): Array<[string, string]> {
204
207
  `;
205
208
  }
206
209
 
207
- // node_modules/.pnpm/mcporter@0.12.3/node_modules/mcporter/dist/cli/generate/stable-json.js
208
- function stableJsonStringify(value, space) {
209
- const json = JSON.stringify(sortJsonValue(value), void 0, space);
210
- if (json === void 0) {
211
- throw new TypeError("Cannot serialize unsupported JSON root value.");
212
- }
213
- return json;
214
- }
215
- function sortJsonValue(value) {
216
- if (Array.isArray(value)) {
217
- return value.map((entry) => sortJsonValue(entry));
218
- }
219
- if (!isPlainObject(value)) {
220
- return value;
221
- }
222
- const result = {};
223
- for (const key of Object.keys(value).toSorted()) {
224
- const entry = value[key];
225
- if (entry !== void 0) {
226
- result[key] = sortJsonValue(entry);
227
- }
228
- }
229
- return result;
230
- }
231
- function isPlainObject(value) {
232
- if (!value || typeof value !== "object") {
233
- return false;
234
- }
235
- const prototype = Object.getPrototypeOf(value);
236
- return prototype === Object.prototype || prototype === null;
237
- }
238
-
239
- // node_modules/.pnpm/mcporter@0.12.3/node_modules/mcporter/dist/cli/generate/template.js
210
+ // node_modules/.pnpm/mcporter@0.13.0/node_modules/mcporter/dist/cli/generate/template.js
240
211
  async function writeTemplate(input) {
241
212
  const resolvedOutput = input.outputPath ? path.resolve(input.outputPath) : path.resolve(process.cwd(), `${input.serverName}.ts`);
242
213
  const runtimeScriptPath = input.runtimeScriptPath ? path.resolve(input.runtimeScriptPath) : resolvedOutput;
@@ -744,7 +715,6 @@ export {
744
715
  extractGeneratorFlags,
745
716
  markExecutable,
746
717
  safeCopyFile,
747
- stableJsonStringify,
748
718
  writeTemplate,
749
719
  readPackageMetadata
750
720
  };
@@ -1,6 +1,6 @@
1
1
  import { createRequire as __createRequire } from "node:module"; const require = __createRequire(import.meta.url);
2
2
 
3
- // node_modules/.pnpm/mcporter@0.12.3/node_modules/mcporter/dist/version.js
3
+ // node_modules/.pnpm/mcporter@0.13.0/node_modules/mcporter/dist/version.js
4
4
  import { createRequire } from "node:module";
5
5
  var MCPORTER_VERSION = (() => {
6
6
  try {
@@ -1,31 +1,13 @@
1
1
  import { createRequire as __createRequire } from "node:module"; const require = __createRequire(import.meta.url);
2
2
  import {
3
- analyzeConnectionError
4
- } from "./chunk-UKYNQGNE.js";
3
+ isUnauthorizedError
4
+ } from "./chunk-7DH57OKF.js";
5
5
  import {
6
+ IssuerMismatchError,
6
7
  auth
7
- } from "./chunk-P3PSC54P.js";
8
+ } from "./chunk-YPJ5EHXR.js";
8
9
 
9
- // node_modules/.pnpm/mcporter@0.12.3/node_modules/mcporter/dist/runtime-oauth-support.js
10
- function maybeEnableOAuth(definition, logger) {
11
- if (definition.auth === "oauth" || definition.auth === "refreshable_bearer") {
12
- return void 0;
13
- }
14
- if (definition.command.kind !== "http") {
15
- return void 0;
16
- }
17
- logger.info(`Detected OAuth requirement for '${definition.name}'. Launching browser flow...`);
18
- return {
19
- ...definition,
20
- auth: "oauth"
21
- };
22
- }
23
- function isUnauthorizedError(error) {
24
- const issue = analyzeConnectionError(error);
25
- return issue.kind === "auth";
26
- }
27
-
28
- // node_modules/.pnpm/mcporter@0.12.3/node_modules/mcporter/dist/runtime/oauth.js
10
+ // node_modules/.pnpm/mcporter@0.13.0/node_modules/mcporter/dist/runtime/oauth.js
29
11
  var DEFAULT_OAUTH_CODE_TIMEOUT_MS = 3e5;
30
12
  var OAUTH_FLOW_ERROR = /* @__PURE__ */ Symbol("oauth-flow-error");
31
13
  var POST_AUTH_CONNECT_ERROR = /* @__PURE__ */ Symbol("post-auth-connect-error");
@@ -108,7 +90,7 @@ async function connectWithAuth(client, transport, session, logger, options = {})
108
90
  };
109
91
  while (true) {
110
92
  try {
111
- await attemptTransportConnect(client, state);
93
+ await attemptTransportConnect(client, state, options.signal);
112
94
  if (session && !state.hasCompletedAuthFlow && options.serverUrl) {
113
95
  await completeProactiveAuthorization(state.activeTransport, session, logger, {
114
96
  serverName,
@@ -154,8 +136,12 @@ async function connectWithAuth(client, transport, session, logger, options = {})
154
136
  }
155
137
  }
156
138
  }
157
- async function attemptTransportConnect(client, state) {
158
- await client.connect(state.activeTransport);
139
+ async function attemptTransportConnect(client, state, signal) {
140
+ if (signal) {
141
+ await client.connect(state.activeTransport, { signal });
142
+ } else {
143
+ await client.connect(state.activeTransport);
144
+ }
159
145
  return state.activeTransport;
160
146
  }
161
147
  function shouldRetryAuthorization(_state, unauthorized, session) {
@@ -175,12 +161,12 @@ async function completeAuthorizationChallenge(transport, session, logger, connec
175
161
  if (session.hasAuthorizationRedirectStarted?.() === false) {
176
162
  throw new OAuthAuthorizationNotStartedError(options.serverName ?? "unknown", connectError);
177
163
  }
178
- const code = await waitForAuthorizationCodeWithTimeout(session, logger, options.serverName, options.oauthTimeoutMs ?? DEFAULT_OAUTH_CODE_TIMEOUT_MS);
164
+ const response = await waitForAuthorizationResponseWithTimeout(session, logger, options.serverName, options.oauthTimeoutMs ?? DEFAULT_OAUTH_CODE_TIMEOUT_MS);
179
165
  if (typeof transport.finishAuth !== "function") {
180
166
  logger.warn("Transport does not support finishAuth; cannot complete OAuth flow automatically.");
181
167
  throw connectError;
182
168
  }
183
- await transport.finishAuth(code);
169
+ await finishAuthorization(transport, response, options.serverName);
184
170
  if (!options.recreateTransport) {
185
171
  return transport;
186
172
  }
@@ -214,17 +200,17 @@ async function completeProactiveAuthorization(transport, session, logger, option
214
200
  if (typeof transport.finishAuth !== "function") {
215
201
  throw new Error("Transport does not support finishAuth; cannot complete OAuth flow automatically.");
216
202
  }
217
- const code = await waitForAuthorizationCodeWithTimeout(session, logger, options.serverName, options.oauthTimeoutMs ?? DEFAULT_OAUTH_CODE_TIMEOUT_MS);
218
- await transport.finishAuth(code);
203
+ const response = await waitForAuthorizationResponseWithTimeout(session, logger, options.serverName, options.oauthTimeoutMs ?? DEFAULT_OAUTH_CODE_TIMEOUT_MS);
204
+ await finishAuthorization(transport, response, options.serverName);
219
205
  await session.close().catch(() => {
220
206
  });
221
207
  } catch (error) {
222
208
  throw markOAuthFlowError(error);
223
209
  }
224
210
  }
225
- function waitForAuthorizationCodeWithTimeout(session, logger, serverName, timeoutMs = DEFAULT_OAUTH_CODE_TIMEOUT_MS) {
211
+ function waitForAuthorizationResponseWithTimeout(session, logger, serverName, timeoutMs = DEFAULT_OAUTH_CODE_TIMEOUT_MS) {
226
212
  if (!Number.isFinite(timeoutMs) || timeoutMs <= 0) {
227
- return session.waitForAuthorizationCode();
213
+ return readAuthorizationResponse(session);
228
214
  }
229
215
  const displayName = serverName ?? "unknown";
230
216
  return new Promise((resolve, reject) => {
@@ -233,15 +219,30 @@ function waitForAuthorizationCodeWithTimeout(session, logger, serverName, timeou
233
219
  logger.warn(error.message);
234
220
  reject(error);
235
221
  }, timeoutMs);
236
- session.waitForAuthorizationCode().then((code) => {
222
+ readAuthorizationResponse(session).then((response) => {
237
223
  clearTimeout(timer);
238
- resolve(code);
224
+ resolve(response);
239
225
  }, (error) => {
240
226
  clearTimeout(timer);
241
227
  reject(error);
242
228
  });
243
229
  });
244
230
  }
231
+ async function readAuthorizationResponse(session) {
232
+ if (session.waitForAuthorizationResponse)
233
+ return session.waitForAuthorizationResponse();
234
+ return { code: await session.waitForAuthorizationCode() };
235
+ }
236
+ async function finishAuthorization(transport, response, serverName) {
237
+ try {
238
+ await transport.finishAuth?.(response.code, response.iss);
239
+ } catch (error) {
240
+ if (error instanceof IssuerMismatchError && error.kind === "authorization_response") {
241
+ throw new Error(`OAuth issuer validation failed for '${serverName ?? "unknown"}': expected ${JSON.stringify(error.expected)}, got ${JSON.stringify(error.received)}; the authorization code was not redeemed.`, { cause: error });
242
+ }
243
+ throw error;
244
+ }
245
+ }
245
246
  function parseOAuthTimeout(raw) {
246
247
  if (!raw) {
247
248
  return DEFAULT_OAUTH_CODE_TIMEOUT_MS;
@@ -257,8 +258,6 @@ function resolveOAuthTimeoutFromEnv() {
257
258
  }
258
259
 
259
260
  export {
260
- maybeEnableOAuth,
261
- isUnauthorizedError,
262
261
  OAuthTimeoutError,
263
262
  isOAuthFlowError,
264
263
  isPostAuthConnectError,
@@ -1,6 +1,6 @@
1
1
  import { createRequire as __createRequire } from "node:module"; const require = __createRequire(import.meta.url);
2
2
 
3
- // node_modules/.pnpm/mcporter@0.12.3/node_modules/mcporter/dist/cli/http-utils.js
3
+ // node_modules/.pnpm/mcporter@0.13.0/node_modules/mcporter/dist/cli/http-utils.js
4
4
  var DOMAIN_WITH_PATH_PATTERN = /^[A-Za-z0-9](?:[A-Za-z0-9.-]*)(?::\d+)?\//;
5
5
  function normalizeHttpUrlCandidate(value) {
6
6
  if (!value) {
@@ -0,0 +1,37 @@
1
+ import { createRequire as __createRequire } from "node:module"; const require = __createRequire(import.meta.url);
2
+
3
+ // node_modules/.pnpm/mcporter@0.13.0/node_modules/mcporter/dist/stable-json.js
4
+ function stableJsonStringify(value, space) {
5
+ const json = JSON.stringify(sortJsonValue(value), void 0, space);
6
+ if (json === void 0) {
7
+ throw new TypeError("Cannot serialize unsupported JSON root value.");
8
+ }
9
+ return json;
10
+ }
11
+ function sortJsonValue(value) {
12
+ if (Array.isArray(value)) {
13
+ return value.map((entry) => sortJsonValue(entry));
14
+ }
15
+ if (!isPlainObject(value)) {
16
+ return value;
17
+ }
18
+ const result = {};
19
+ for (const key of Object.keys(value).toSorted()) {
20
+ const entry = value[key];
21
+ if (entry !== void 0) {
22
+ result[key] = sortJsonValue(entry);
23
+ }
24
+ }
25
+ return result;
26
+ }
27
+ function isPlainObject(value) {
28
+ if (!value || typeof value !== "object") {
29
+ return false;
30
+ }
31
+ const prototype = Object.getPrototypeOf(value);
32
+ return prototype === Object.prototype || prototype === null;
33
+ }
34
+
35
+ export {
36
+ stableJsonStringify
37
+ };
@@ -1,20 +1,20 @@
1
1
  import { createRequire as __createRequire } from "node:module"; const require = __createRequire(import.meta.url);
2
2
  import {
3
3
  __configInternals
4
- } from "./chunk-2U4BSDC4.js";
4
+ } from "./chunk-L4VKBFYI.js";
5
5
  import {
6
6
  withFileLock,
7
7
  writeTextFileAtomic
8
- } from "./chunk-2XL7MG7R.js";
8
+ } from "./chunk-7A63PAGP.js";
9
9
  import {
10
10
  expandHome
11
- } from "./chunk-ECIVB7P4.js";
11
+ } from "./chunk-HAO6PL7Z.js";
12
12
  import {
13
13
  canonicalKeepAliveName,
14
14
  resolveLifecycle
15
- } from "./chunk-LS7PMWSR.js";
15
+ } from "./chunk-6D6KPSXN.js";
16
16
 
17
- // node_modules/.pnpm/mcporter@0.12.3/node_modules/mcporter/dist/cli/adhoc-server.js
17
+ // node_modules/.pnpm/mcporter@0.13.0/node_modules/mcporter/dist/cli/adhoc-server.js
18
18
  import fs from "node:fs/promises";
19
19
  import path from "node:path";
20
20
  var TEMP_SOURCE = { kind: "local", path: "<adhoc>" };