@introspection-ai/recipes 0.19.3 → 0.21.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 (130) hide show
  1. package/README.md +5 -4
  2. package/dist/agents.d.ts +17 -1
  3. package/dist/agents.d.ts.map +1 -1
  4. package/dist/agents.js +15 -1
  5. package/dist/agents.js.map +1 -1
  6. package/dist/child-agent.d.ts +5 -1
  7. package/dist/child-agent.d.ts.map +1 -1
  8. package/dist/child-agent.js +34 -1
  9. package/dist/child-agent.js.map +1 -1
  10. package/dist/mcp-chunks/{auth-command-3K7V3VCW.js → auth-command-4OEOMU2V.js} +26 -38
  11. package/dist/mcp-chunks/call-arguments-RPXZJOXL.js +15 -0
  12. package/dist/mcp-chunks/{call-command-OFPHPFM5.js → call-command-AUEKSBMD.js} +74 -40
  13. package/dist/mcp-chunks/{chunk-NCXEJ35U.js → chunk-3VLPWGJL.js} +4 -4
  14. package/dist/mcp-chunks/{chunk-2FSDGCHW.js → chunk-47N2EELW.js} +377 -527
  15. package/dist/mcp-chunks/{chunk-WWO5WGH5.js → chunk-4NDR45CX.js} +5 -5
  16. package/dist/mcp-chunks/{chunk-2MEHGB7D.js → chunk-5WGJPYOR.js} +1 -1
  17. package/dist/mcp-chunks/chunk-6CYJ6RN3.js +12 -0
  18. package/dist/mcp-chunks/{chunk-XUF6KARU.js → chunk-6DL2C6V5.js} +1 -1
  19. package/dist/mcp-chunks/{chunk-54EWGONA.js → chunk-6QH47GNE.js} +10 -6
  20. package/dist/mcp-chunks/{chunk-PKOJCYNA.js → chunk-756YH7S4.js} +2 -2
  21. package/dist/mcp-chunks/{chunk-C2PQFLWS.js → chunk-7CS27CWE.js} +15 -6
  22. package/dist/mcp-chunks/{chunk-GIF7LOYU.js → chunk-7KEDX7SE.js} +2 -2
  23. package/dist/mcp-chunks/{chunk-LNSUME65.js → chunk-AB7MHBEG.js} +29 -13
  24. package/dist/mcp-chunks/{chunk-NZOIX6XW.js → chunk-ACTRQW5L.js} +2 -2
  25. package/dist/mcp-chunks/{chunk-7A63PAGP.js → chunk-ADINDBOF.js} +21 -5
  26. package/dist/mcp-chunks/{chunk-XTL4MHFH.js → chunk-AF74TOWM.js} +11 -7
  27. package/dist/mcp-chunks/{chunk-KSGYBW3F.js → chunk-AFKE4BTR.js} +72 -22
  28. package/dist/mcp-chunks/{chunk-YTKRAHO6.js → chunk-DEYKPG4K.js} +4 -4
  29. package/dist/mcp-chunks/{chunk-SB2UUURE.js → chunk-E4YYMOT2.js} +10 -10
  30. package/dist/mcp-chunks/{chunk-HAO6PL7Z.js → chunk-HBDCHBJP.js} +7 -7
  31. package/dist/mcp-chunks/{chunk-QJACOI2W.js → chunk-HDUKEFBI.js} +4 -2
  32. package/dist/mcp-chunks/{chunk-E6RVTWJY.js → chunk-HHMWZ2FZ.js} +1 -1
  33. package/dist/mcp-chunks/{chunk-HTZ2URXW.js → chunk-IPH6U7SE.js} +3 -3
  34. package/dist/mcp-chunks/{chunk-SFREPU3D.js → chunk-J3J3NQ4X.js} +1 -1
  35. package/dist/mcp-chunks/{chunk-JAKI24KR.js → chunk-J6VOMOKI.js} +1 -1
  36. package/dist/mcp-chunks/{chunk-H7F5RZXS.js → chunk-JILBFEBD.js} +2 -1
  37. package/dist/mcp-chunks/{chunk-YPJ5EHXR.js → chunk-K56RW4HB.js} +4 -4
  38. package/dist/mcp-chunks/{chunk-YCYSQA5V.js → chunk-KMH3PHLA.js} +5 -5
  39. package/dist/mcp-chunks/{chunk-2JHHONW4.js → chunk-KPXFBRTG.js} +1 -1
  40. package/dist/mcp-chunks/{chunk-LICH4Q7A.js → chunk-L4CUJJI5.js} +4 -4
  41. package/dist/mcp-chunks/{chunk-XRGLP3Z2.js → chunk-LC2CCTQN.js} +1 -1
  42. package/dist/mcp-chunks/{chunk-P3RN22HQ.js → chunk-LJCZWKGJ.js} +3 -2
  43. package/dist/mcp-chunks/{chunk-F3LL4EBL.js → chunk-MFFE5QSH.js} +1 -1
  44. package/dist/mcp-chunks/{chunk-64EP2BVO.js → chunk-MOML5C2E.js} +1 -1
  45. package/dist/mcp-chunks/{chunk-CNDY7WB4.js → chunk-MRXSXBZT.js} +2 -2
  46. package/dist/mcp-chunks/{chunk-WXBPMFSN.js → chunk-NMFI6AUD.js} +91 -34
  47. package/dist/mcp-chunks/{chunk-55JIHDU3.js → chunk-NWLOPQT7.js} +1 -1
  48. package/dist/mcp-chunks/{chunk-DXPHJFSA.js → chunk-OGFFBNIC.js} +4 -4
  49. package/dist/mcp-chunks/{chunk-7RDLPFIO.js → chunk-PPIXUCYQ.js} +2 -2
  50. package/dist/mcp-chunks/{chunk-RBVYCKCD.js → chunk-PPOHGQKM.js} +2 -2
  51. package/dist/mcp-chunks/{chunk-E6T37ED6.js → chunk-PRZCYXVO.js} +2 -2
  52. package/dist/mcp-chunks/{chunk-ETWN4IIA.js → chunk-Q7ESBNJG.js} +6 -6
  53. package/dist/mcp-chunks/{chunk-CA5WFJZA.js → chunk-RE4EVQNC.js} +1 -1
  54. package/dist/mcp-chunks/{chunk-6D6KPSXN.js → chunk-RO2Y34XX.js} +1 -1
  55. package/dist/mcp-chunks/{chunk-KSMY7PXI.js → chunk-SAK5KCLR.js} +1 -1
  56. package/dist/mcp-chunks/{chunk-UENXT3NE.js → chunk-SCGMRUKI.js} +1 -1
  57. package/dist/mcp-chunks/{chunk-3IZQW4H4.js → chunk-SQTXZR56.js} +212 -18
  58. package/dist/mcp-chunks/{chunk-FWP4RACK.js → chunk-TGJOZDKG.js} +2 -2
  59. package/dist/mcp-chunks/{chunk-DEUU7WSN.js → chunk-US57PK4B.js} +2 -2
  60. package/dist/mcp-chunks/{chunk-UHOKCTZT.js → chunk-V4RYLZM5.js} +1 -1
  61. package/dist/mcp-chunks/{chunk-GFYTST6N.js → chunk-X3FOKZ5C.js} +1 -1
  62. package/dist/mcp-chunks/{chunk-GSZOK5TS.js → chunk-XK3LRH3Q.js} +3 -3
  63. package/dist/mcp-chunks/chunk-XVJAASVZ.js +1931 -0
  64. package/dist/mcp-chunks/{chunk-ZBFZ5UFE.js → chunk-YX2NKW6O.js} +3 -1
  65. package/dist/mcp-chunks/{chunk-L4VKBFYI.js → chunk-Z7O6NF7X.js} +101 -16
  66. package/dist/mcp-chunks/{chunk-7DH57OKF.js → chunk-ZKFG37TB.js} +2 -2
  67. package/dist/mcp-chunks/chunk-ZRZ7C6L3.js +823 -0
  68. package/dist/mcp-chunks/{chunk-YSPT6F7K.js → chunk-ZZSD2JT7.js} +1 -1
  69. package/dist/mcp-chunks/{cli-E4P6SZLQ.js → cli-B7WQQUME.js} +70 -69
  70. package/dist/mcp-chunks/client-4ZHIBB67.js +21 -0
  71. package/dist/mcp-chunks/{config-command-MWF3RHPQ.js → config-command-FF3JPMOP.js} +27 -27
  72. package/dist/mcp-chunks/daemon-command-FKW6YELL.js +35 -0
  73. package/dist/mcp-chunks/{dist-ZIPUENTM.js → dist-V4UB7RTR.js} +547 -402
  74. package/dist/mcp-chunks/{emit-ts-command-GOVJJ64A.js → emit-ts-command-4X56IZ32.js} +16 -16
  75. package/dist/mcp-chunks/{generate-cli-runner-L5OQIMEY.js → generate-cli-runner-MIPF73SJ.js} +49 -42
  76. package/dist/mcp-chunks/{inspect-cli-command-7OMMREPE.js → inspect-cli-command-GX54ZXKR.js} +9 -9
  77. package/dist/mcp-chunks/{launch-BWXPLPB7.js → launch-E2LWGPZS.js} +1 -1
  78. package/dist/mcp-chunks/{lifecycle-B5UC65PT.js → lifecycle-TONHXXXJ.js} +1 -1
  79. package/dist/mcp-chunks/{list-command-ZO4HVFQK.js → list-command-YUGRZO4G.js} +31 -31
  80. package/dist/mcp-chunks/{output-utils-M3TJ2N4M.js → output-utils-AZY6N2VQ.js} +3 -3
  81. package/dist/mcp-chunks/{prompt-CH6TK0bC-C7OTKGRD.js → prompt-CH6TK0bC-NSBYYJZH.js} +1 -1
  82. package/dist/mcp-chunks/{record-command-VD3HUQIC.js → record-command-25DLELA2.js} +5 -5
  83. package/dist/mcp-chunks/{replay-command-AX6IN7YD.js → replay-command-6SLDG6PC.js} +6 -6
  84. package/dist/mcp-chunks/{resource-command-JEZ2DW2G.js → resource-command-YVOB4JCU.js} +9 -9
  85. package/dist/mcp-chunks/{result-utils-3YHYGS45.js → result-utils-ZXB5DM36.js} +3 -3
  86. package/dist/mcp-chunks/runtime-NOWGTHZ5.js +39 -0
  87. package/dist/mcp-chunks/{runtime-wrapper-UREU7GC3.js → runtime-wrapper-ZZPAFQE4.js} +6 -6
  88. package/dist/mcp-chunks/{serve-command-M47YZ6JN.js → serve-command-QYGM2AMB.js} +35 -27
  89. package/dist/mcp-chunks/{timeouts-THZRYP4B.js → timeouts-P3TBB3AX.js} +5 -3
  90. package/dist/mcp-chunks/{vault-command-53P7MLCB.js → vault-command-VDMPATIX.js} +58 -12
  91. package/dist/mcp-chunks/{webapi-PHEQZQKH.js → webapi-BLTNWSB2.js} +68 -60
  92. package/dist/mcp-daemon.js +30 -28
  93. package/dist/mcp-run-worker.js +30 -28
  94. package/dist/mcp.d.ts.map +1 -1
  95. package/dist/mcp.js +24 -0
  96. package/dist/mcp.js.map +1 -1
  97. package/dist/pi-extension.d.ts +3 -0
  98. package/dist/pi-extension.d.ts.map +1 -1
  99. package/dist/pi-extension.js +30 -22
  100. package/dist/pi-extension.js.map +1 -1
  101. package/dist/run-controller.d.ts +3 -1
  102. package/dist/run-controller.d.ts.map +1 -1
  103. package/dist/run-controller.js +17 -3
  104. package/dist/run-controller.js.map +1 -1
  105. package/dist/session.d.ts +3 -1
  106. package/dist/session.d.ts.map +1 -1
  107. package/dist/session.js +4 -1
  108. package/dist/session.js.map +1 -1
  109. package/docs/host-api.md +12 -0
  110. package/docs/pi-extension.md +18 -5
  111. package/package.json +20 -16
  112. package/dist/mcp-chunks/call-arguments-TX3F2TEE.js +0 -15
  113. package/dist/mcp-chunks/chunk-SRZZQ6TL.js +0 -266
  114. package/dist/mcp-chunks/client-2EJC4PLL.js +0 -18
  115. package/dist/mcp-chunks/daemon-command-6CJ26MKI.js +0 -33
  116. package/dist/mcp-chunks/runtime-HSYVOME7.js +0 -37
  117. package/dist/recipe-check.d.ts +0 -18
  118. package/dist/recipe-check.d.ts.map +0 -1
  119. package/dist/recipe-check.js +0 -263
  120. package/dist/recipe-check.js.map +0 -1
  121. package/vendor/introspection-recipe-check/darwin-arm64/introspection-recipe-check +0 -0
  122. package/vendor/introspection-recipe-check/darwin-x64/introspection-recipe-check +0 -0
  123. package/vendor/introspection-recipe-check/linux-arm64/introspection-recipe-check +0 -0
  124. package/vendor/introspection-recipe-check/linux-x64/introspection-recipe-check +0 -0
  125. package/vendor/introspection-recipe-check/linux-x64-musl/introspection-recipe-check +0 -0
  126. package/vendor/introspection-recipe-check/win32-x64/introspection-recipe-check.exe +0 -0
  127. package/vendor/mcp-client/darwin-arm64/mcp-client +0 -0
  128. package/vendor/mcp-client/darwin-x64/mcp-client +0 -0
  129. package/vendor/mcp-client/linux-arm64/mcp-client +0 -0
  130. package/vendor/mcp-client/linux-x64/mcp-client +0 -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
  pickSharedDefinitionFields
4
- } from "./chunk-H7F5RZXS.js";
4
+ } from "./chunk-JILBFEBD.js";
5
5
 
6
- // node_modules/.pnpm/mcporter@0.13.0/node_modules/mcporter/dist/cli-metadata.js
6
+ // node_modules/.pnpm/mcporter@0.13.7/node_modules/mcporter/dist/cli-metadata.js
7
7
  import { spawn } from "node:child_process";
8
8
  import fs from "node:fs/promises";
9
9
  function metadataPathForArtifact(artifactPath) {
@@ -92,7 +92,7 @@ function serializeDefinition(definition) {
92
92
  };
93
93
  }
94
94
 
95
- // node_modules/.pnpm/mcporter@0.13.0/node_modules/mcporter/dist/cli/generate/tool-selection.js
95
+ // node_modules/.pnpm/mcporter@0.13.7/node_modules/mcporter/dist/cli/generate/tool-selection.js
96
96
  function validateToolSelection(includeTools, excludeTools, context) {
97
97
  if (includeTools && excludeTools) {
98
98
  throw new Error(context.mutuallyExclusiveMessage);
@@ -105,7 +105,7 @@ function validateToolSelection(includeTools, excludeTools, context) {
105
105
  }
106
106
  }
107
107
 
108
- // node_modules/.pnpm/mcporter@0.13.0/node_modules/mcporter/dist/cli/generate/template-data.js
108
+ // node_modules/.pnpm/mcporter@0.13.7/node_modules/mcporter/dist/cli/generate/template-data.js
109
109
  function buildGenerateCliCommand(invocation, definition, globalFlags = {}) {
110
110
  const tokens = ["mcporter"];
111
111
  const configPath = invocation.configPath ?? globalFlags["--config"];
@@ -2,9 +2,9 @@ import { createRequire as __createRequire } from "node:module"; const require =
2
2
  import {
3
3
  logInfo,
4
4
  logWarn
5
- } from "./chunk-RBVYCKCD.js";
5
+ } from "./chunk-PPOHGQKM.js";
6
6
 
7
- // node_modules/.pnpm/mcporter@0.13.0/node_modules/mcporter/dist/cli/runtime-debug.js
7
+ // node_modules/.pnpm/mcporter@0.13.7/node_modules/mcporter/dist/cli/runtime-debug.js
8
8
  var DEBUG_HANG = process.env.MCPORTER_DEBUG_HANG === "1";
9
9
  function describeHandle(handle) {
10
10
  if (!handle || typeof handle !== "object" && typeof handle !== "function") {
@@ -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-GFYTST6N.js";
5
+ } from "./chunk-X3FOKZ5C.js";
6
6
 
7
- // node_modules/.pnpm/mcporter@0.13.0/node_modules/mcporter/dist/cli/logger-context.js
7
+ // node_modules/.pnpm/mcporter@0.13.7/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,9 +1,9 @@
1
1
  import { createRequire as __createRequire } from "node:module"; const require = __createRequire(import.meta.url);
2
2
  import {
3
3
  legacyMcporterDir
4
- } from "./chunk-FWP4RACK.js";
4
+ } from "./chunk-TGJOZDKG.js";
5
5
 
6
- // node_modules/.pnpm/mcporter@0.13.0/node_modules/mcporter/dist/runtime/record-transport.js
6
+ // node_modules/.pnpm/mcporter@0.13.7/node_modules/mcporter/dist/runtime/record-transport.js
7
7
  import fs from "node:fs/promises";
8
8
  import path from "node:path";
9
9
  var initializedRecordingPaths = /* @__PURE__ */ new Map();
@@ -1,11 +1,11 @@
1
1
  import { createRequire as __createRequire } from "node:module"; const require = __createRequire(import.meta.url);
2
2
  import {
3
3
  resolveEnvPlaceholders
4
- } from "./chunk-HAO6PL7Z.js";
4
+ } from "./chunk-HBDCHBJP.js";
5
5
 
6
- // node_modules/.pnpm/mcporter@0.13.0/node_modules/mcporter/dist/runtime/utils.js
6
+ // node_modules/.pnpm/mcporter@0.13.7/node_modules/mcporter/dist/runtime/utils.js
7
7
  var ENV_PLACEHOLDER_PATTERN = /\$\{[A-Za-z_][A-Za-z0-9_]*(?::-[^}]*)?\}/;
8
- function resolveCommandArgument(value) {
8
+ function resolveCommandArgument(value, env = process.env) {
9
9
  if (!value) {
10
10
  return value;
11
11
  }
@@ -16,13 +16,13 @@ function resolveCommandArgument(value) {
16
16
  if (!needsInterpolation) {
17
17
  return value;
18
18
  }
19
- return resolveEnvPlaceholders(value);
19
+ return resolveEnvPlaceholders(value, env);
20
20
  }
21
- function resolveCommandArguments(args) {
21
+ function resolveCommandArguments(args, env = process.env) {
22
22
  if (args.length === 0) {
23
23
  return [];
24
24
  }
25
- return args.map((arg) => resolveCommandArgument(arg));
25
+ return args.map((arg) => resolveCommandArgument(arg, env));
26
26
  }
27
27
  function normalizeTimeout(raw) {
28
28
  if (raw == null) {
@@ -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.13.0/node_modules/mcporter/dist/runtime/elicitation.js
3
+ // node_modules/.pnpm/mcporter@0.13.7/node_modules/mcporter/dist/runtime/elicitation.js
4
4
  import readline from "node:readline";
5
5
  var NON_INTERACTIVE_ELICITATION_HINT = "Server requested interactive input; run mcporter in a terminal.";
6
6
  function createInteractiveElicitationResponder(options = {}) {
@@ -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.13.0/node_modules/mcporter/dist/lifecycle.js
3
+ // node_modules/.pnpm/mcporter@0.13.7/node_modules/mcporter/dist/lifecycle.js
4
4
  var DEFAULT_KEEP_ALIVE = /* @__PURE__ */ new Set(["chrome-devtools", "mobile-mcp", "playwright", "cloudbase"]);
5
5
  var includeOverride = parseList(process.env.MCPORTER_KEEPALIVE);
6
6
  var excludeOverride = parseList(process.env.MCPORTER_DISABLE_KEEPALIVE ?? process.env.MCPORTER_NO_KEEPALIVE);
@@ -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.13.0/node_modules/mcporter/dist/cli/json-output.js
3
+ // node_modules/.pnpm/mcporter@0.13.7/node_modules/mcporter/dist/cli/json-output.js
4
4
  function buildConnectionIssueEnvelope(params) {
5
5
  return {
6
6
  server: params.server,
@@ -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.13.0/node_modules/mcporter/dist/cli/http-utils.js
3
+ // node_modules/.pnpm/mcporter@0.13.7/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) {
@@ -12,31 +12,35 @@ import {
12
12
  sameOAuthTokenGeneration,
13
13
  sameOAuthTokenValue,
14
14
  saveVaultEntry,
15
+ vaultCredentialKeys,
15
16
  withHiddenOAuthClientGeneration,
16
17
  withHiddenOAuthTokenGeneration,
17
18
  withOAuthClientGeneration,
18
19
  withOAuthTokenGeneration
19
- } from "./chunk-C2PQFLWS.js";
20
+ } from "./chunk-7CS27CWE.js";
20
21
  import {
21
22
  checkResourceAllowed,
22
23
  discoverOAuthServerInfo,
23
24
  refreshAuthorization,
24
25
  resourceUrlFromServerUrl
25
- } from "./chunk-YPJ5EHXR.js";
26
+ } from "./chunk-K56RW4HB.js";
26
27
  import {
28
+ canonicalizeFilePath,
29
+ isFileLockTimeoutError,
27
30
  readJsonFile,
28
31
  withFileLock,
29
32
  writeJsonFile,
30
33
  writeTextFileAtomic
31
- } from "./chunk-7A63PAGP.js";
34
+ } from "./chunk-ADINDBOF.js";
32
35
  import {
33
- legacyMcporterDir
34
- } from "./chunk-FWP4RACK.js";
36
+ legacyMcporterDir,
37
+ mcporterDir
38
+ } from "./chunk-TGJOZDKG.js";
35
39
 
36
- // node_modules/.pnpm/mcporter@0.13.0/node_modules/mcporter/dist/oauth-persistence.js
40
+ // node_modules/.pnpm/mcporter@0.13.7/node_modules/mcporter/dist/oauth-persistence.js
37
41
  import fs2 from "node:fs/promises";
38
42
 
39
- // node_modules/.pnpm/mcporter@0.13.0/node_modules/mcporter/dist/oauth-persistence-stores.js
43
+ // node_modules/.pnpm/mcporter@0.13.7/node_modules/mcporter/dist/oauth-persistence-stores.js
40
44
  import fs from "node:fs/promises";
41
45
  import os from "node:os";
42
46
  import path from "node:path";
@@ -441,6 +445,10 @@ var CompositePersistence = class {
441
445
  this.recoveryTokenSource = result.source;
442
446
  return result.value;
443
447
  }
448
+ async readTokensPerStore() {
449
+ const perStore = await Promise.all(this.stores.map((store) => store.readTokens()));
450
+ return perStore.filter((tokens) => tokens !== void 0);
451
+ }
444
452
  async saveTokens(tokens) {
445
453
  const stored = prepareStoredTokens(tokens);
446
454
  await Promise.all(this.stores.map((store) => store.saveTokens(stored)));
@@ -598,10 +606,10 @@ async function clearLegacyOAuthArtifacts(definition, logger, scope) {
598
606
  }));
599
607
  }
600
608
 
601
- // node_modules/.pnpm/mcporter@0.13.0/node_modules/mcporter/dist/oauth-token-refresh.js
609
+ // node_modules/.pnpm/mcporter@0.13.7/node_modules/mcporter/dist/oauth-token-refresh.js
602
610
  import { Buffer } from "node:buffer";
603
611
 
604
- // node_modules/.pnpm/mcporter@0.13.0/node_modules/mcporter/dist/oauth-client-info.js
612
+ // node_modules/.pnpm/mcporter@0.13.7/node_modules/mcporter/dist/oauth-client-info.js
605
613
  function buildStaticClientInformation(definition, options = {}) {
606
614
  if (!definition.oauthClientId) {
607
615
  return void 0;
@@ -627,10 +635,121 @@ function resolveOAuthClientSecret(definition, options = {}) {
627
635
  return definition.oauthClientSecret;
628
636
  }
629
637
 
630
- // node_modules/.pnpm/mcporter@0.13.0/node_modules/mcporter/dist/oauth-token-refresh.js
638
+ // node_modules/.pnpm/mcporter@0.13.7/node_modules/mcporter/dist/oauth-refresh-lock.js
639
+ import { AsyncLocalStorage } from "node:async_hooks";
640
+ import crypto from "node:crypto";
641
+ import path2 from "node:path";
642
+ var REFRESH_LOCK_DIR = "refresh-locks";
643
+ var LOCK_LABEL_MAX = 40;
644
+ var IDENTITY_HASH_LENGTH = 16;
645
+ var TIMEOUT_OVERRIDE_ENV = "MCPORTER_TEST_REFRESH_LOCK_TIMEOUT_MS";
646
+ var heldLockPaths = new AsyncLocalStorage();
647
+ function refreshLockDir() {
648
+ return path2.join(mcporterDir("data"), REFRESH_LOCK_DIR);
649
+ }
650
+ async function refreshLockPaths(definition) {
651
+ const paths = [];
652
+ if (definition.tokenCacheDir) {
653
+ const tokenPath = await canonicalizeFilePath(path2.join(definition.tokenCacheDir, "tokens.json"));
654
+ paths.push(lockPathFor(path2.basename(path2.dirname(tokenPath)), `dir:${tokenPath}`));
655
+ }
656
+ for (const vaultKey of await vaultCredentialKeys(definition)) {
657
+ paths.push(lockPathFor(vaultKey.split("|")[0] ?? "", `vault:${vaultKey}`));
658
+ }
659
+ return [...new Set(paths)].toSorted();
660
+ }
661
+ async function withRefreshLock(definition, task, options = {}) {
662
+ const lockPaths = await refreshLockPaths(definition);
663
+ return await acquireAll(lockPaths, task, resolveTimeoutMs(options.timeoutMs));
664
+ }
665
+ async function acquireAll(lockPaths, task, timeoutMs) {
666
+ const held = heldLockPaths.getStore();
667
+ const pending = held ? lockPaths.filter((lockPath) => !held.has(lockPath)) : lockPaths;
668
+ if (pending.length === 0) {
669
+ return await task();
670
+ }
671
+ const nextHeld = /* @__PURE__ */ new Set([...held ?? [], ...pending]);
672
+ return await heldLockPaths.run(nextHeld, async () => {
673
+ let run = task;
674
+ for (const lockPath of pending.toReversed()) {
675
+ const inner = run;
676
+ run = async () => await withFileLock(lockPath, inner, timeoutMs === void 0 ? {} : { timeoutMs });
677
+ }
678
+ return await run();
679
+ });
680
+ }
681
+ function resolveTimeoutMs(explicit) {
682
+ if (explicit !== void 0) {
683
+ return explicit;
684
+ }
685
+ const raw = process.env[TIMEOUT_OVERRIDE_ENV];
686
+ if (raw === void 0 || raw.trim().length === 0) {
687
+ return void 0;
688
+ }
689
+ const parsed = Number(raw);
690
+ return Number.isFinite(parsed) && parsed >= 0 ? parsed : void 0;
691
+ }
692
+ function lockPathFor(label, identity) {
693
+ const digest = crypto.createHash("sha256").update(identity).digest("hex").slice(0, IDENTITY_HASH_LENGTH);
694
+ const safeLabel = filenameSafeLabel(label);
695
+ return path2.join(refreshLockDir(), safeLabel.length > 0 ? `${safeLabel}-${digest}` : digest);
696
+ }
697
+ function filenameSafeLabel(value) {
698
+ return value.replace(/[^A-Za-z0-9._-]+/g, "_").replace(/^[._-]+/, "").slice(0, LOCK_LABEL_MAX);
699
+ }
700
+
701
+ // node_modules/.pnpm/mcporter@0.13.7/node_modules/mcporter/dist/oauth-token-refresh.js
631
702
  var TOKEN_EXPIRY_SKEW_SECONDS = 60;
703
+ var TOKEN_REQUEST_TIMEOUT_MS = 1e4;
632
704
  var OAuthIssuerMismatchError = class extends Error {
633
705
  };
706
+ function decideUnderRefreshLock(original, latest, skewSeconds) {
707
+ if (!latest || typeof latest.access_token !== "string" || latest.access_token.trim().length === 0) {
708
+ return { kind: "gone" };
709
+ }
710
+ const adopted = cachedTokensChanged(original, latest);
711
+ if (!shouldRefreshCachedToken(latest, skewSeconds)) {
712
+ return { kind: "use", accessToken: latest.access_token, adopted };
713
+ }
714
+ if (typeof latest.refresh_token !== "string" || latest.refresh_token.trim().length === 0) {
715
+ return adopted ? { kind: "use", accessToken: latest.access_token, adopted } : { kind: "unrefreshable", accessToken: latest.access_token };
716
+ }
717
+ return { kind: "redeem", tokens: latest, refreshToken: latest.refresh_token };
718
+ }
719
+ async function reconcilePersistedTokens(definition, persistence, logger) {
720
+ const perStore = await persistence.readTokensPerStore?.();
721
+ if (!perStore || perStore.length <= 1) {
722
+ return await persistence.readTokens();
723
+ }
724
+ const candidates = perStore.filter((candidate) => typeof candidate.access_token === "string" && candidate.access_token.trim().length > 0);
725
+ const distinctRefreshTokens = new Set(candidates.map((candidate) => typeof candidate.refresh_token === "string" ? candidate.refresh_token : ""));
726
+ if (candidates.length <= 1 || distinctRefreshTokens.size <= 1) {
727
+ return await persistence.readTokens();
728
+ }
729
+ let selected = candidates[0];
730
+ for (const candidate of candidates.slice(1)) {
731
+ if (selected === void 0 || outranksForRedemption(candidate, selected)) {
732
+ selected = candidate;
733
+ }
734
+ }
735
+ logger?.debug?.(`Persisted OAuth stores for '${definition.name}' hold different refresh tokens; redeeming the newest.`);
736
+ return selected;
737
+ }
738
+ function outranksForRedemption(candidate, incumbent) {
739
+ const candidateDue = shouldRefreshCachedToken(candidate);
740
+ if (candidateDue !== shouldRefreshCachedToken(incumbent)) {
741
+ return !candidateDue;
742
+ }
743
+ const candidateExpiry = tokenExpirySeconds(candidate) ?? Number.NEGATIVE_INFINITY;
744
+ const incumbentExpiry = tokenExpirySeconds(incumbent) ?? Number.NEGATIVE_INFINITY;
745
+ return candidateExpiry > incumbentExpiry;
746
+ }
747
+ async function accessTokenAfterLockTimeout(definition, persistence, tokenKind, logger) {
748
+ const latest = await persistence.readTokens();
749
+ const accessToken = typeof latest?.access_token === "string" && latest.access_token.trim().length > 0 ? latest.access_token : void 0;
750
+ logger?.debug?.(`Timed out waiting for the ${tokenKind} refresh lock for '${definition.name}'; ${accessToken ? "returning the persisted access token, which may already be expired." : "no persisted access token remains."}`);
751
+ return accessToken;
752
+ }
634
753
  function tokenExpirySeconds(tokens) {
635
754
  const stored = tokens;
636
755
  for (const candidate of [stored.expires_at, stored.expiresAt]) {
@@ -646,6 +765,9 @@ function cachedTokensChanged(original, current) {
646
765
  }
647
766
  return !sameOAuthTokenGeneration(current, original);
648
767
  }
768
+ function oauthAccessTokenNeedsRefresh(tokens) {
769
+ return shouldRefreshCachedToken(tokens);
770
+ }
649
771
  function shouldRefreshCachedToken(tokens, skewSeconds = TOKEN_EXPIRY_SKEW_SECONDS) {
650
772
  const expiresAt = tokenExpirySeconds(tokens);
651
773
  if (expiresAt !== void 0) {
@@ -698,9 +820,11 @@ function oauthErrorCode(error) {
698
820
  if (!error || typeof error !== "object") {
699
821
  return void 0;
700
822
  }
701
- const { errorCode, name } = error;
702
- if (typeof errorCode === "string" && errorCode.length > 0) {
703
- return errorCode.toLowerCase();
823
+ const { errorCode, code, name } = error;
824
+ for (const candidate of [errorCode, code]) {
825
+ if (typeof candidate === "string" && candidate.length > 0) {
826
+ return candidate.toLowerCase();
827
+ }
704
828
  }
705
829
  if (typeof name === "string") {
706
830
  const normalized = name.toLowerCase();
@@ -730,6 +854,35 @@ async function readCachedAccessTokenWithPersistence(definition, persistence, log
730
854
  if (typeof tokens.refresh_token !== "string" || tokens.refresh_token.trim().length === 0) {
731
855
  return tokens.access_token;
732
856
  }
857
+ if (definition.command.kind !== "http") {
858
+ return tokens.access_token;
859
+ }
860
+ try {
861
+ return await withRefreshLock(definition, async () => await refreshCachedOAuthTokenUnderLock(definition, persistence, tokens, logger));
862
+ } catch (error) {
863
+ if (isFileLockTimeoutError(error)) {
864
+ return await accessTokenAfterLockTimeout(definition, persistence, "OAuth", logger);
865
+ }
866
+ throw error;
867
+ }
868
+ }
869
+ async function refreshCachedOAuthTokenUnderLock(definition, persistence, original, logger) {
870
+ const latest = await reconcilePersistedTokens(definition, persistence, logger);
871
+ const decision = decideUnderRefreshLock(original, latest, TOKEN_EXPIRY_SKEW_SECONDS);
872
+ if (decision.kind === "gone") {
873
+ logger?.debug?.(`Cached OAuth token for '${definition.name}' was cleared before its refresh could run.`);
874
+ return void 0;
875
+ }
876
+ if (decision.kind === "unrefreshable") {
877
+ return decision.accessToken;
878
+ }
879
+ if (decision.kind === "use") {
880
+ if (decision.adopted) {
881
+ logger?.debug?.(`Adopted the OAuth access token another refresh persisted first for '${definition.name}'.`);
882
+ }
883
+ return decision.accessToken;
884
+ }
885
+ const tokens = decision.tokens;
733
886
  let persistedClientInformation;
734
887
  try {
735
888
  const staticClientInformation = buildStaticClientInformation(definition);
@@ -742,13 +895,14 @@ async function readCachedAccessTokenWithPersistence(definition, persistence, log
742
895
  if (definition.command.kind !== "http") {
743
896
  return tokens.access_token;
744
897
  }
745
- const serverInfo = await discoverOAuthServerInfo(definition.command.url);
898
+ const serverInfo = await discoverOAuthServerInfo(definition.command.url, { fetchFn: boundedRefreshFetch });
746
899
  await assertRefreshIssuerBinding(definition, persistence, tokens, clientInformation, serverInfo.authorizationServerUrl);
747
900
  const resource = resourceForRefresh(definition.command.url, serverInfo.resourceMetadata);
748
901
  const refreshed = await refreshAuthorization(serverInfo.authorizationServerUrl, {
749
902
  metadata: serverInfo.authorizationServerMetadata,
750
903
  clientInformation,
751
- refreshToken: tokens.refresh_token,
904
+ refreshToken: decision.refreshToken,
905
+ fetchFn: boundedRefreshFetch,
752
906
  ...resource ? { resource } : {}
753
907
  });
754
908
  await persistence.saveTokens({ ...refreshed, issuer: serverInfo.authorizationServerUrl });
@@ -766,6 +920,12 @@ async function readCachedAccessTokenWithPersistence(definition, persistence, log
766
920
  return tokens.access_token;
767
921
  }
768
922
  }
923
+ function boundedRefreshFetch(input, init) {
924
+ return withRefreshRequestTimeout(fetch)(input, init);
925
+ }
926
+ function withRefreshRequestTimeout(fetchFn) {
927
+ return async (input, init) => await fetchFn(input, { ...init, signal: init?.signal ?? AbortSignal.timeout(TOKEN_REQUEST_TIMEOUT_MS) });
928
+ }
769
929
  async function recoverFromUnrecoverableRefresh(definition, persistence, tokens, unrecoverableCode, tokenKind, logger, rejectedClientInformation) {
770
930
  const clientToClear = unrecoverableCode === "invalid_grant" ? void 0 : rejectedClientInformation;
771
931
  await persistence.clearRejectedCredentials(tokens, clientToClear);
@@ -791,7 +951,36 @@ async function readExplicitRefreshableBearerToken(definition, persistence, token
791
951
  throw new Error(`Cached bearer token for '${definition.name}' is expired, but no refresh_token is available.`);
792
952
  }
793
953
  try {
794
- const refreshed = await refreshBearerToken(definition, tokens.refresh_token);
954
+ return await withRefreshLock(definition, async () => await refreshBearerTokenUnderLock(definition, persistence, tokens, skewSeconds, logger));
955
+ } catch (error) {
956
+ if (!isFileLockTimeoutError(error)) {
957
+ throw error;
958
+ }
959
+ const persisted = await accessTokenAfterLockTimeout(definition, persistence, "bearer", logger);
960
+ if (persisted) {
961
+ return persisted;
962
+ }
963
+ throw new Error(`Failed to refresh cached bearer token for '${definition.name}': timed out waiting for the refresh lock.`, { cause: error });
964
+ }
965
+ }
966
+ async function refreshBearerTokenUnderLock(definition, persistence, original, skewSeconds, logger) {
967
+ const latest = await reconcilePersistedTokens(definition, persistence, logger);
968
+ const decision = decideUnderRefreshLock(original, latest, skewSeconds);
969
+ if (decision.kind === "gone") {
970
+ throw new Error(`Cached bearer token for '${definition.name}' was cleared before its refresh could run.`);
971
+ }
972
+ if (decision.kind === "unrefreshable") {
973
+ throw new Error(`Cached bearer token for '${definition.name}' is expired, but no refresh_token is available.`);
974
+ }
975
+ if (decision.kind === "use") {
976
+ if (decision.adopted) {
977
+ logger?.debug?.(`Adopted the bearer access token another refresh persisted first for '${definition.name}'.`);
978
+ }
979
+ return decision.accessToken;
980
+ }
981
+ const tokens = decision.tokens;
982
+ try {
983
+ const refreshed = await refreshBearerToken(definition, decision.refreshToken);
795
984
  await persistence.saveTokens(refreshed);
796
985
  logger?.debug?.(`Refreshed bearer access token for '${definition.name}' (non-interactive).`);
797
986
  return refreshed.access_token;
@@ -840,7 +1029,7 @@ async function refreshBearerToken(definition, refreshToken) {
840
1029
  }
841
1030
  headers.authorization = `Basic ${Buffer.from(`${formEncodeCredential(clientId)}:${formEncodeCredential(clientSecret)}`).toString("base64")}`;
842
1031
  }
843
- const response = await fetch(refresh.tokenEndpoint, {
1032
+ const response = await boundedRefreshFetch(refresh.tokenEndpoint, {
844
1033
  method: "POST",
845
1034
  headers,
846
1035
  body
@@ -904,7 +1093,7 @@ function readClientSecret(definition, refreshClientSecretEnv) {
904
1093
  return resolveOAuthClientSecret(definition, { rejectBlank: true });
905
1094
  }
906
1095
 
907
- // node_modules/.pnpm/mcporter@0.13.0/node_modules/mcporter/dist/oauth-persistence.js
1096
+ // node_modules/.pnpm/mcporter@0.13.7/node_modules/mcporter/dist/oauth-persistence.js
908
1097
  async function buildOAuthPersistence(definition, logger) {
909
1098
  return await createOAuthPersistenceStores(definition, logger);
910
1099
  }
@@ -923,6 +1112,11 @@ async function readCachedAccessToken(definition, logger) {
923
1112
 
924
1113
  export {
925
1114
  buildStaticClientInformation,
1115
+ withRefreshLock,
1116
+ reconcilePersistedTokens,
1117
+ oauthAccessTokenNeedsRefresh,
1118
+ readCachedAccessTokenWithPersistence,
1119
+ withRefreshRequestTimeout,
926
1120
  buildOAuthPersistence,
927
1121
  clearOAuthCaches,
928
1122
  readCachedAccessToken
@@ -1,9 +1,9 @@
1
1
  import { createRequire as __createRequire } from "node:module"; const require = __createRequire(import.meta.url);
2
2
  import {
3
3
  expandHome
4
- } from "./chunk-HAO6PL7Z.js";
4
+ } from "./chunk-HBDCHBJP.js";
5
5
 
6
- // node_modules/.pnpm/mcporter@0.13.0/node_modules/mcporter/dist/paths.js
6
+ // node_modules/.pnpm/mcporter@0.13.7/node_modules/mcporter/dist/paths.js
7
7
  import os from "node:os";
8
8
  import path from "node:path";
9
9
  var XDG_HOME_ENV = {
@@ -3,9 +3,9 @@ import {
3
3
  SdkHttpError,
4
4
  SseError,
5
5
  UnauthorizedError
6
- } from "./chunk-YPJ5EHXR.js";
6
+ } from "./chunk-K56RW4HB.js";
7
7
 
8
- // node_modules/.pnpm/mcporter@0.13.0/node_modules/mcporter/dist/error-classifier.js
8
+ // node_modules/.pnpm/mcporter@0.13.7/node_modules/mcporter/dist/error-classifier.js
9
9
  var AUTH_STATUSES = /* @__PURE__ */ new Set([401, 403]);
10
10
  var KEYWORD_AUTH_PATTERNS = [/unauthorized/, /invalid_token/, /forbidden/];
11
11
  var NUMERIC_AUTH_PATTERNS = [/(?<![0-9a-z_])401(?![0-9a-z_])/i];
@@ -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.13.0/node_modules/mcporter/dist/stable-json.js
3
+ // node_modules/.pnpm/mcporter@0.13.7/node_modules/mcporter/dist/stable-json.js
4
4
  function stableJsonStringify(value, space) {
5
5
  const json = JSON.stringify(sortJsonValue(value), void 0, space);
6
6
  if (json === void 0) {
@@ -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.13.0/node_modules/mcporter/dist/logging.js
3
+ // node_modules/.pnpm/mcporter@0.13.7/node_modules/mcporter/dist/logging.js
4
4
  var LOG_LEVEL_ORDER = {
5
5
  debug: 10,
6
6
  info: 20,
@@ -2,10 +2,10 @@ import { createRequire as __createRequire } from "node:module"; const require =
2
2
  import {
3
3
  createCallResult,
4
4
  describeConnectionIssue
5
- } from "./chunk-NZOIX6XW.js";
5
+ } from "./chunk-ACTRQW5L.js";
6
6
  import {
7
7
  createRuntime
8
- } from "./chunk-2FSDGCHW.js";
8
+ } from "./chunk-47N2EELW.js";
9
9
 
10
10
  // node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/context/context.js
11
11
  function createContextKey(description) {
@@ -1505,7 +1505,7 @@ function loadMcporterCli() {
1505
1505
  if (mcporterCliPromise) return mcporterCliPromise;
1506
1506
  const previousDisableAutorun = process.env.MCPORTER_DISABLE_AUTORUN;
1507
1507
  process.env.MCPORTER_DISABLE_AUTORUN = "1";
1508
- mcporterCliPromise = import("./cli-E4P6SZLQ.js").finally(() => {
1508
+ mcporterCliPromise = import("./cli-B7WQQUME.js").finally(() => {
1509
1509
  if (previousDisableAutorun === void 0) {
1510
1510
  delete process.env.MCPORTER_DISABLE_AUTORUN;
1511
1511
  } else {