@introspection-ai/recipes 0.53.0 → 0.54.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 (104) hide show
  1. package/dist/connector-tools.d.ts +1 -1
  2. package/dist/connector-tools.d.ts.map +1 -1
  3. package/dist/connector-tools.js +1 -0
  4. package/dist/connector-tools.js.map +1 -1
  5. package/dist/introspection-open.d.ts +2 -2
  6. package/dist/introspection-open.d.ts.map +1 -1
  7. package/dist/introspection-open.js +27 -9
  8. package/dist/introspection-open.js.map +1 -1
  9. package/dist/issues/index.d.ts +1 -1
  10. package/dist/issues/index.d.ts.map +1 -1
  11. package/dist/issues/index.js +1 -1
  12. package/dist/issues/index.js.map +1 -1
  13. package/dist/issues/module.d.ts +3 -0
  14. package/dist/issues/module.d.ts.map +1 -1
  15. package/dist/issues/module.js +4 -0
  16. package/dist/issues/module.js.map +1 -1
  17. package/dist/mcp/cli/command-context.d.ts +13 -0
  18. package/dist/mcp/cli/command-context.d.ts.map +1 -1
  19. package/dist/mcp/cli/command-context.js +56 -16
  20. package/dist/mcp/cli/command-context.js.map +1 -1
  21. package/dist/mcp/cli/core.d.ts +1 -1
  22. package/dist/mcp/cli/core.d.ts.map +1 -1
  23. package/dist/mcp/cli/core.js +25 -16
  24. package/dist/mcp/cli/core.js.map +1 -1
  25. package/dist/mcp/client-entry.js +1 -1
  26. package/dist/mcp/client-entry.js.map +1 -1
  27. package/dist/mcp/daemon/client.d.ts +10 -1
  28. package/dist/mcp/daemon/client.d.ts.map +1 -1
  29. package/dist/mcp/daemon/client.js +41 -17
  30. package/dist/mcp/daemon/client.js.map +1 -1
  31. package/dist/mcp/daemon/hosted.d.ts +22 -0
  32. package/dist/mcp/daemon/hosted.d.ts.map +1 -0
  33. package/dist/mcp/daemon/hosted.js +98 -0
  34. package/dist/mcp/daemon/hosted.js.map +1 -0
  35. package/dist/mcp/daemon/index.js +18 -423
  36. package/dist/mcp/daemon/index.js.map +1 -1
  37. package/dist/mcp/daemon/protocol.d.ts +4 -0
  38. package/dist/mcp/daemon/protocol.d.ts.map +1 -1
  39. package/dist/mcp/daemon/protocol.js +10 -0
  40. package/dist/mcp/daemon/protocol.js.map +1 -1
  41. package/dist/mcp/daemon/server.d.ts +41 -0
  42. package/dist/mcp/daemon/server.d.ts.map +1 -0
  43. package/dist/mcp/daemon/server.js +547 -0
  44. package/dist/mcp/daemon/server.js.map +1 -0
  45. package/dist/mcp/index.d.ts.map +1 -1
  46. package/dist/mcp/index.js +5 -3
  47. package/dist/mcp/index.js.map +1 -1
  48. package/dist/mcp/pi-runtime.d.ts +4 -2
  49. package/dist/mcp/pi-runtime.d.ts.map +1 -1
  50. package/dist/mcp/pi-runtime.js +12 -6
  51. package/dist/mcp/pi-runtime.js.map +1 -1
  52. package/dist/mcp/tools.d.ts.map +1 -1
  53. package/dist/mcp/tools.js +16 -5
  54. package/dist/mcp/tools.js.map +1 -1
  55. package/dist/mcp-chunks/chunk-53T5TVPR.js +546 -0
  56. package/dist/mcp-chunks/{chunk-QUDOU7MQ.js → chunk-757ZF552.js} +1 -1
  57. package/dist/mcp-chunks/{chunk-T5BPTC3T.js → chunk-D6OGGMWS.js} +89 -45
  58. package/dist/mcp-chunks/{chunk-IMG2JMBS.js → chunk-MYAMG6VL.js} +1 -1
  59. package/dist/mcp-chunks/{chunk-LQKMNWDE.js → chunk-OIK5AH2S.js} +5 -5
  60. package/dist/mcp-chunks/{chunk-3UVHZECT.js → chunk-OWGTNJNR.js} +9 -7
  61. package/dist/mcp-chunks/chunk-TUPFPO4L.js +400 -0
  62. package/dist/mcp-chunks/{cli-BM23ZXPJ.js → cli-UQ5QXFXU.js} +31 -31
  63. package/dist/mcp-chunks/{client-RKTAKDAY.js → client-SBELHRAE.js} +3 -3
  64. package/dist/mcp-chunks/{daemon-command-VU6WTFCJ.js → daemon-command-MQS6AP2W.js} +5 -5
  65. package/dist/mcp-chunks/dist-SDPPH7XQ.js +65 -0
  66. package/dist/mcp-chunks/{generate-cli-runner-JAAPSWGX.js → generate-cli-runner-LQBBQ7F5.js} +3 -3
  67. package/dist/mcp-chunks/{generated-daemon-runtime-LX4L2X7Z.js → generated-daemon-runtime-TUCZ3JEP.js} +4 -4
  68. package/dist/mcp-chunks/{pi-mcp-runtime-GHDEPXUL.js → pi-mcp-runtime-OLO25D7A.js} +1 -29
  69. package/dist/mcp-chunks/{runtime-T63YI7TC.js → runtime-5SOGEUTQ.js} +2 -2
  70. package/dist/mcp-chunks/{serve-command-75P4VBJ6.js → serve-command-YKSIXG7K.js} +3 -3
  71. package/dist/mcp-chunks/server-SLD55EBC.js +41 -0
  72. package/dist/mcp-daemon.js +29 -432
  73. package/dist/mcp-run-worker.js +9 -8
  74. package/dist/open.d.ts +9 -2
  75. package/dist/open.d.ts.map +1 -1
  76. package/dist/open.js +31 -3
  77. package/dist/open.js.map +1 -1
  78. package/dist/pi-extension.d.ts.map +1 -1
  79. package/dist/pi-extension.js +1 -1
  80. package/dist/pi-extension.js.map +1 -1
  81. package/dist/recipe/companions.d.ts +6 -0
  82. package/dist/recipe/companions.d.ts.map +1 -1
  83. package/dist/recipe/companions.js +22 -4
  84. package/dist/recipe/companions.js.map +1 -1
  85. package/dist/recipe/manifest.generated.d.ts +1 -1
  86. package/dist/recipe/manifest.generated.js +1 -1
  87. package/dist/recipe/suggestions.d.ts +15 -7
  88. package/dist/recipe/suggestions.d.ts.map +1 -1
  89. package/dist/recipe/suggestions.js +33 -11
  90. package/dist/recipe/suggestions.js.map +1 -1
  91. package/dist/suggestion-picker.d.ts +2 -2
  92. package/dist/suggestion-picker.d.ts.map +1 -1
  93. package/dist/suggestion-picker.js +3 -3
  94. package/dist/suggestion-picker.js.map +1 -1
  95. package/docs/interactions.md +20 -15
  96. package/docs/issues/README.md +6 -1
  97. package/docs/mcp-configuration.md +11 -3
  98. package/docs/recipe-format.md +30 -13
  99. package/package.json +5 -5
  100. package/skills/issues/SKILL.md +108 -0
  101. package/dist/mcp-chunks/{auth-command-UYFOGGQR.js → auth-command-PZLSOYAT.js} +6 -6
  102. package/dist/mcp-chunks/{call-command-6U5BNDR7.js → call-command-VILJIFYG.js} +6 -6
  103. package/dist/mcp-chunks/{chunk-36D4FILJ.js → chunk-ORJND4AI.js} +3 -3
  104. package/dist/mcp-chunks/{resource-command-DUY4SVE5.js → resource-command-SRFQQROJ.js} +4 -4
@@ -2,7 +2,7 @@ import { createRequire as __createRequire } from "node:module"; const require =
2
2
  import {
3
3
  createMcpRuntime,
4
4
  usesPiMcpClient
5
- } from "./chunk-3UVHZECT.js";
5
+ } from "./chunk-OWGTNJNR.js";
6
6
  import {
7
7
  createCallResult,
8
8
  describeConnectionIssue
@@ -10105,32 +10105,66 @@ var storage = new AsyncLocalStorage();
10105
10105
  function currentMcpCommandContext() {
10106
10106
  return storage.getStore();
10107
10107
  }
10108
+ var envStorage = new AsyncLocalStorage();
10109
+ function mcpCommandEnv() {
10110
+ return envStorage.getStore() ?? process.env;
10111
+ }
10112
+ function runWithMcpCommandEnv(env, task) {
10113
+ return envStorage.run(env, task);
10114
+ }
10108
10115
  function runWithMcpCommandContext(context2, task) {
10109
10116
  return storage.run(context2, task);
10110
10117
  }
10118
+ var ioRoutingHolders = 0;
10119
+ var restoreIoRouting;
10111
10120
  function installMcpCommandIoRouting() {
10112
- const stdoutWrite = process.stdout.write.bind(process.stdout);
10113
- const stderrWrite = process.stderr.write.bind(process.stderr);
10114
- process.stdout.write = ((chunk, ...args) => {
10115
- const target = currentMcpCommandContext()?.stdout;
10116
- return target ? target.write(chunk) : stdoutWrite(chunk, ...args);
10117
- });
10118
- process.stderr.write = ((chunk, ...args) => {
10119
- const target = currentMcpCommandContext()?.stderr;
10120
- return target ? target.write(chunk) : stderrWrite(chunk, ...args);
10121
- });
10121
+ if (ioRoutingHolders === 0) {
10122
+ const stdoutWrite = process.stdout.write;
10123
+ const stderrWrite = process.stderr.write;
10124
+ const boundStdout = stdoutWrite.bind(process.stdout);
10125
+ const boundStderr = stderrWrite.bind(process.stderr);
10126
+ const routedStdout = ((chunk, ...args) => {
10127
+ const target = currentMcpCommandContext()?.stdout;
10128
+ return target ? target.write(chunk) : boundStdout(chunk, ...args);
10129
+ });
10130
+ const routedStderr = ((chunk, ...args) => {
10131
+ const target = currentMcpCommandContext()?.stderr;
10132
+ return target ? target.write(chunk) : boundStderr(chunk, ...args);
10133
+ });
10134
+ process.stdout.write = routedStdout;
10135
+ process.stderr.write = routedStderr;
10136
+ restoreIoRouting = () => {
10137
+ if (process.stdout.write === routedStdout)
10138
+ process.stdout.write = stdoutWrite;
10139
+ if (process.stderr.write === routedStderr)
10140
+ process.stderr.write = stderrWrite;
10141
+ };
10142
+ }
10143
+ ioRoutingHolders += 1;
10144
+ let released = false;
10122
10145
  return () => {
10123
- process.stdout.write = stdoutWrite;
10124
- process.stderr.write = stderrWrite;
10146
+ if (released) return;
10147
+ released = true;
10148
+ ioRoutingHolders -= 1;
10149
+ if (ioRoutingHolders === 0) {
10150
+ restoreIoRouting?.();
10151
+ restoreIoRouting = void 0;
10152
+ }
10125
10153
  };
10126
10154
  }
10127
10155
 
10128
10156
  // src/mcp/daemon/protocol.ts
10157
+ import { basename, join } from "node:path";
10129
10158
  var MCP_DAEMON_SOCKET_ENV = "PI_RECIPES_MCP_DAEMON_SOCKET";
10130
10159
  var MCP_DAEMON_TOKEN_ENV = "PI_RECIPES_MCP_DAEMON_TOKEN";
10131
10160
  var MCP_DAEMON_FINGERPRINT_ENV = "PI_RECIPES_MCP_DAEMON_FINGERPRINT";
10132
10161
  var MCP_DAEMON_PARENT_PID_ENV = "PI_RECIPES_MCP_DAEMON_PARENT_PID";
10162
+ var MCP_SESSION_ROOT_ENV = "PI_RECIPES_MCP_SESSION_ROOT";
10133
10163
  var MCP_DAEMON_MAX_FRAME_BYTES = 10 * 1024 * 1024;
10164
+ var SOCKET_DIRECTORY = /^recipes-mcp-[0-9a-f]{20}$/;
10165
+ function isMcpDaemonSocketDirectory(directory) {
10166
+ return SOCKET_DIRECTORY.test(basename(directory));
10167
+ }
10134
10168
  function serializeMcpDaemonEnvelope(envelope, maxBytes = MCP_DAEMON_MAX_FRAME_BYTES) {
10135
10169
  let estimatedBytes = 0;
10136
10170
  const seen = /* @__PURE__ */ new WeakSet();
@@ -10188,7 +10222,7 @@ import {
10188
10222
  stat,
10189
10223
  writeFile
10190
10224
  } from "node:fs/promises";
10191
- import { dirname as dirname2, join as join2 } from "node:path";
10225
+ import { dirname as dirname3, join as join4, resolve as resolve2 } from "node:path";
10192
10226
  import { setTimeout as delay2 } from "node:timers/promises";
10193
10227
  import { stdin as input, stderr, stdout } from "node:process";
10194
10228
  import { inspect, parseArgs as parseArgs2 } from "node:util";
@@ -11065,7 +11099,7 @@ function mcpRunHelpText() {
11065
11099
  }
11066
11100
 
11067
11101
  // src/mcp/index.ts
11068
- import { delimiter, dirname, join, resolve } from "node:path";
11102
+ import { delimiter, dirname as dirname2, join as join3, resolve } from "node:path";
11069
11103
 
11070
11104
  // node_modules/.pnpm/balanced-match@4.0.4/node_modules/balanced-match/dist/esm/index.js
11071
11105
  var balanced = (a, b, str) => {
@@ -12942,6 +12976,7 @@ var import_yaml = __toESM(require_dist(), 1);
12942
12976
 
12943
12977
  // src/recipe/companions.ts
12944
12978
  var import_semver2 = __toESM(require_semver2(), 1);
12979
+ import { dirname, join as join2 } from "node:path";
12945
12980
  import { fileURLToPath } from "node:url";
12946
12981
 
12947
12982
  // src/recipe/extensions.ts
@@ -12949,9 +12984,7 @@ import { createRequire, findPackageJSON } from "node:module";
12949
12984
  var require2 = createRequire(import.meta.url);
12950
12985
 
12951
12986
  // src/recipe/companions.ts
12952
- var recipesManifestPath = fileURLToPath(
12953
- new URL("../../package.json", import.meta.url)
12954
- );
12987
+ var recipesModuleDir = dirname(fileURLToPath(import.meta.url));
12955
12988
 
12956
12989
  // src/recipe/package.ts
12957
12990
  var RESOURCE_KEYS = [
@@ -12993,10 +13026,10 @@ var MCP_SESSION_ENV = `${RECIPE_ENV_PREFIX}MCP_SESSION`;
12993
13026
  var MCP_LOCAL_CONFIG_ENV = `${RECIPE_ENV_PREFIX}MCP_LOCAL_CONFIG`;
12994
13027
  var MCP_BIN_DIR_ENV = `${RECIPE_ENV_PREFIX}MCP_BIN_DIR`;
12995
13028
  function defaultMcpSessionPath(cwd) {
12996
- return join(cwd, ".pi", "mcp-session.json");
13029
+ return join3(cwd, ".pi", "mcp-session.json");
12997
13030
  }
12998
13031
  function defaultMcporterConfigPath(cwd) {
12999
- return join(cwd, ".pi", "mcporter.json");
13032
+ return join3(cwd, ".pi", "mcporter.json");
13000
13033
  }
13001
13034
  function mcpSessionAllowsTool(server, toolName) {
13002
13035
  return mcpSelectionAllowsTool(server.package_tools, toolName) && server.agent_tools.some(
@@ -13268,7 +13301,7 @@ function loadMcporterCli() {
13268
13301
  if (mcporterCliPromise) return mcporterCliPromise;
13269
13302
  const previousDisableAutorun = process.env.MCPORTER_DISABLE_AUTORUN;
13270
13303
  process.env.MCPORTER_DISABLE_AUTORUN = "1";
13271
- mcporterCliPromise = import("./cli-BM23ZXPJ.js").finally(() => {
13304
+ mcporterCliPromise = import("./cli-UQ5QXFXU.js").finally(() => {
13272
13305
  if (previousDisableAutorun === void 0) {
13273
13306
  delete process.env.MCPORTER_DISABLE_AUTORUN;
13274
13307
  } else {
@@ -13279,7 +13312,13 @@ function loadMcporterCli() {
13279
13312
  }
13280
13313
  async function acquireRuntime() {
13281
13314
  const shared = currentMcpCommandContext()?.runtime;
13282
- return shared ? { runtime: shared, owned: false } : { runtime: await createMcpRuntime(), owned: true };
13315
+ return shared ? { runtime: shared, owned: false } : {
13316
+ runtime: await createMcpRuntime(
13317
+ mcpCommandEnv().MCPORTER_CONFIG,
13318
+ mcpCommandEnv()
13319
+ ),
13320
+ owned: true
13321
+ };
13283
13322
  }
13284
13323
  async function closeOwnedRuntime(runtime, owned) {
13285
13324
  if (owned) await runtime.close();
@@ -13328,13 +13367,13 @@ function isHelpArg(value) {
13328
13367
  function readStdin() {
13329
13368
  const source = currentMcpCommandContext()?.stdin ?? input;
13330
13369
  source.setEncoding("utf8");
13331
- return new Promise((resolve2, reject) => {
13370
+ return new Promise((resolve3, reject) => {
13332
13371
  let data = "";
13333
13372
  source.on("data", (chunk) => {
13334
13373
  data += chunk;
13335
13374
  });
13336
13375
  source.on("error", reject);
13337
- source.on("end", () => resolve2(data));
13376
+ source.on("end", () => resolve3(data));
13338
13377
  });
13339
13378
  }
13340
13379
  function checkedCallResult(callResult) {
@@ -13403,7 +13442,7 @@ var ToolCallQueue = class {
13403
13442
  return Promise.resolve(this.releaseHandle());
13404
13443
  }
13405
13444
  return new Promise(
13406
- (resolve2, reject) => this.waiting.push({ resolve: resolve2, reject })
13445
+ (resolve3, reject) => this.waiting.push({ resolve: resolve3, reject })
13407
13446
  );
13408
13447
  }
13409
13448
  cancel(error) {
@@ -13543,17 +13582,17 @@ async function readSession() {
13543
13582
  }
13544
13583
  function sessionPolicyPath() {
13545
13584
  const workspacePath = defaultMcpSessionPath(sessionRoot());
13546
- return existsSync(workspacePath) ? workspacePath : process.env[MCP_SESSION_ENV2] || workspacePath;
13585
+ return existsSync(workspacePath) ? workspacePath : mcpCommandEnv()[MCP_SESSION_ENV2] || workspacePath;
13547
13586
  }
13548
13587
  function sessionMcporterConfigPath() {
13549
13588
  const workspacePath = defaultMcporterConfigPath(sessionRoot());
13550
- return existsSync(workspacePath) ? workspacePath : process.env.MCPORTER_CONFIG || workspacePath;
13589
+ return existsSync(workspacePath) ? workspacePath : mcpCommandEnv().MCPORTER_CONFIG || workspacePath;
13551
13590
  }
13552
13591
  function sessionRoot() {
13553
- return process.env.PI_RECIPES_MCP_SESSION_ROOT || process.cwd();
13592
+ return mcpCommandEnv().PI_RECIPES_MCP_SESSION_ROOT || process.cwd();
13554
13593
  }
13555
13594
  function pinSessionMcporterConfig() {
13556
- process.env.MCPORTER_CONFIG = sessionMcporterConfigPath();
13595
+ mcpCommandEnv().MCPORTER_CONFIG = sessionMcporterConfigPath();
13557
13596
  }
13558
13597
  async function sessionCliPolicy() {
13559
13598
  return createMcpCliSessionPolicy(await readSession());
@@ -13569,7 +13608,7 @@ function catalogFingerprint(server) {
13569
13608
  ).digest("hex").slice(0, 20);
13570
13609
  }
13571
13610
  function catalogCachePath(server) {
13572
- return join2(
13611
+ return join4(
13573
13612
  sessionRoot(),
13574
13613
  ".pi",
13575
13614
  "mcp-catalogs",
@@ -13588,7 +13627,7 @@ async function readCachedCatalog(server) {
13588
13627
  }
13589
13628
  }
13590
13629
  async function writeCachedCatalog(server, tools) {
13591
- const directory = join2(sessionRoot(), ".pi", "mcp-catalogs");
13630
+ const directory = join4(sessionRoot(), ".pi", "mcp-catalogs");
13592
13631
  await mkdir(directory, { recursive: true });
13593
13632
  const path2 = catalogCachePath(server);
13594
13633
  const temporary = `${path2}.${process.pid}.${randomUUID()}.tmp`;
@@ -13655,7 +13694,7 @@ async function discoverServerCatalog(runtime, server, timeoutMs) {
13655
13694
  const cached = await readCachedCatalog(server);
13656
13695
  if (cached) return cached;
13657
13696
  const lock = `${catalogCachePath(server)}.lock`;
13658
- await mkdir(dirname2(lock), { recursive: true });
13697
+ await mkdir(dirname3(lock), { recursive: true });
13659
13698
  let ownsLock = false;
13660
13699
  const deadline = Date.now() + timeoutMs;
13661
13700
  while (!ownsLock && Date.now() < deadline) {
@@ -13887,7 +13926,7 @@ function toolCount(count) {
13887
13926
  return `${count} tool${count === 1 ? "" : "s"}`;
13888
13927
  }
13889
13928
  function parseListTimeoutMs(args) {
13890
- const configured = process.env.MCPORTER_LIST_TIMEOUT;
13929
+ const configured = mcpCommandEnv().MCPORTER_LIST_TIMEOUT;
13891
13930
  let raw = configured && /^[1-9]\d*$/.test(configured) ? configured : String(DEFAULT_LIST_TIMEOUT_MS);
13892
13931
  const { values } = parseArgs2({
13893
13932
  args: [...args.slice(1)],
@@ -13908,7 +13947,7 @@ function parseListTimeoutMs(args) {
13908
13947
  return Number.isSafeInteger(timeout) ? timeout : "mcp list: --timeout must be a positive integer (milliseconds).";
13909
13948
  }
13910
13949
  function withListTimeout(promise, timeoutMs) {
13911
- return new Promise((resolve2, reject) => {
13950
+ return new Promise((resolve3, reject) => {
13912
13951
  const timer = setTimeout(
13913
13952
  () => reject(new Error(`timed out after ${timeoutMs}ms`)),
13914
13953
  timeoutMs
@@ -13916,7 +13955,7 @@ function withListTimeout(promise, timeoutMs) {
13916
13955
  promise.then(
13917
13956
  (value) => {
13918
13957
  clearTimeout(timer);
13919
- resolve2(value);
13958
+ resolve3(value);
13920
13959
  },
13921
13960
  (error) => {
13922
13961
  clearTimeout(timer);
@@ -14415,22 +14454,22 @@ function positiveInteger(value, label, fallback) {
14415
14454
  }
14416
14455
  async function runMcpJavaScript(code, opts = {}) {
14417
14456
  const timeoutMs = positiveInteger(
14418
- opts.timeoutMs ?? process.env.PI_RECIPES_MCP_RUN_TIMEOUT_MS,
14457
+ opts.timeoutMs ?? mcpCommandEnv().PI_RECIPES_MCP_RUN_TIMEOUT_MS,
14419
14458
  "PI_RECIPES_MCP_RUN_TIMEOUT_MS",
14420
14459
  DEFAULT_RUN_TIMEOUT_MS
14421
14460
  );
14422
14461
  const callTimeoutMs = positiveInteger(
14423
- opts.callTimeoutMs ?? process.env.PI_RECIPES_MCP_RUN_CALL_TIMEOUT_MS,
14462
+ opts.callTimeoutMs ?? mcpCommandEnv().PI_RECIPES_MCP_RUN_CALL_TIMEOUT_MS,
14424
14463
  "PI_RECIPES_MCP_RUN_CALL_TIMEOUT_MS",
14425
14464
  Math.min(DEFAULT_TOOL_CALL_TIMEOUT_MS, timeoutMs)
14426
14465
  );
14427
14466
  const maxCalls = positiveInteger(
14428
- opts.maxCalls ?? process.env.PI_RECIPES_MCP_RUN_MAX_CALLS,
14467
+ opts.maxCalls ?? mcpCommandEnv().PI_RECIPES_MCP_RUN_MAX_CALLS,
14429
14468
  "PI_RECIPES_MCP_RUN_MAX_CALLS",
14430
14469
  DEFAULT_MAX_RUN_TOOL_CALLS
14431
14470
  );
14432
14471
  const maxConcurrentCalls = positiveInteger(
14433
- opts.maxConcurrentCalls ?? process.env.PI_RECIPES_MCP_RUN_MAX_CONCURRENCY,
14472
+ opts.maxConcurrentCalls ?? mcpCommandEnv().PI_RECIPES_MCP_RUN_MAX_CONCURRENCY,
14434
14473
  "PI_RECIPES_MCP_RUN_MAX_CONCURRENCY",
14435
14474
  DEFAULT_MAX_CONCURRENT_TOOL_CALLS
14436
14475
  );
@@ -14484,8 +14523,8 @@ async function runMcpJavaScript(code, opts = {}) {
14484
14523
  try {
14485
14524
  await Promise.race([
14486
14525
  Promise.allSettled(unsafeAtExit.map((call) => call.promise)),
14487
- new Promise((resolve2) => {
14488
- settleTimer = setTimeout(resolve2, remainingSettleMs);
14526
+ new Promise((resolve3) => {
14527
+ settleTimer = setTimeout(resolve3, remainingSettleMs);
14489
14528
  })
14490
14529
  ]);
14491
14530
  } finally {
@@ -14569,7 +14608,10 @@ async function runCode(args) {
14569
14608
  stderr.write("mcp run accepts at most one file path.\n");
14570
14609
  return 2;
14571
14610
  }
14572
- const code = file ? await readFile(file, "utf8") : await readStdin();
14611
+ const code = file ? await readFile(
14612
+ resolve2(mcpCommandEnv()[MCP_SESSION_ROOT_ENV] || process.cwd(), file),
14613
+ "utf8"
14614
+ ) : await readStdin();
14573
14615
  if (!code.trim()) {
14574
14616
  stderr.write(
14575
14617
  "mcp run: empty script. Pass a file path or pipe JavaScript on stdin (see `mcp run --help`).\n"
@@ -14579,7 +14621,7 @@ async function runCode(args) {
14579
14621
  let timeoutMs;
14580
14622
  try {
14581
14623
  timeoutMs = positiveInteger(
14582
- process.env.PI_RECIPES_MCP_RUN_TIMEOUT_MS,
14624
+ mcpCommandEnv().PI_RECIPES_MCP_RUN_TIMEOUT_MS,
14583
14625
  "PI_RECIPES_MCP_RUN_TIMEOUT_MS",
14584
14626
  DEFAULT_RUN_TIMEOUT_MS
14585
14627
  );
@@ -14696,7 +14738,7 @@ async function callWithMcporter(args) {
14696
14738
  let owned = false;
14697
14739
  try {
14698
14740
  ({ runtime, owned } = await acquireRuntime());
14699
- if (usesPiMcpClient() || args.includes("--help") || args.includes("-h"))
14741
+ if (usesPiMcpClient(mcpCommandEnv()) || args.includes("--help") || args.includes("-h"))
14700
14742
  return await callWithSharedRuntime(runtime, args);
14701
14743
  const words2 = takeOptions(args.slice(1), CALL_OPTIONS).rest;
14702
14744
  try {
@@ -14811,7 +14853,7 @@ async function callWithSharedRuntime(runtime, args) {
14811
14853
  const result = createCallResult(raw);
14812
14854
  const rendered = selectCallOutput(result, raw, options2.output);
14813
14855
  const serialized = serializeCallOutput(rendered, options2.output);
14814
- const configuredLimit = process.env.PI_RECIPES_MCP_MAX_OUTPUT_BYTES;
14856
+ const configuredLimit = mcpCommandEnv().PI_RECIPES_MCP_MAX_OUTPUT_BYTES;
14815
14857
  if (configuredLimit !== void 0) {
14816
14858
  const limit = Number(configuredLimit);
14817
14859
  if (!Number.isSafeInteger(limit) || limit <= 0) {
@@ -15039,12 +15081,14 @@ async function executeMcpCommand(opts) {
15039
15081
 
15040
15082
  export {
15041
15083
  context,
15084
+ runWithMcpCommandEnv,
15042
15085
  installMcpCommandIoRouting,
15043
15086
  MCP_DAEMON_SOCKET_ENV,
15044
15087
  MCP_DAEMON_TOKEN_ENV,
15045
15088
  MCP_DAEMON_FINGERPRINT_ENV,
15046
15089
  MCP_DAEMON_PARENT_PID_ENV,
15047
15090
  MCP_DAEMON_MAX_FRAME_BYTES,
15091
+ isMcpDaemonSocketDirectory,
15048
15092
  serializeMcpDaemonEnvelope,
15049
15093
  mcpDaemonRequestContext,
15050
15094
  discoverMcpCatalogs,
@@ -16,7 +16,7 @@ import {
16
16
  resolveSystemPowerShellPath,
17
17
  secureDaemonDirectory,
18
18
  upgradeLegacyDaemonDirectory
19
- } from "./chunk-36D4FILJ.js";
19
+ } from "./chunk-ORJND4AI.js";
20
20
  import {
21
21
  NON_INTERACTIVE_ELICITATION_HINT,
22
22
  createNonInteractiveElicitationResponder
@@ -1,7 +1,4 @@
1
1
  import { createRequire as __createRequire } from "node:module"; const require = __createRequire(import.meta.url);
2
- import {
3
- launchDaemonDetached
4
- } from "./chunk-B6S43WID.js";
5
2
  import {
6
3
  BrokerError,
7
4
  DAEMON_PROTOCOL_VERSION,
@@ -20,12 +17,12 @@ import {
20
17
  resolveProgressInterval,
21
18
  stopVerifiedLegacyDaemons,
22
19
  waitForDaemonReady
23
- } from "./chunk-IMG2JMBS.js";
20
+ } from "./chunk-MYAMG6VL.js";
24
21
  import {
25
22
  canonicalUserConfiguration,
26
23
  getDaemonLogPath,
27
24
  secureDaemonDirectory
28
- } from "./chunk-36D4FILJ.js";
25
+ } from "./chunk-ORJND4AI.js";
29
26
  import {
30
27
  ChromeDevtoolsRelayDiscoveryError
31
28
  } from "./chunk-6O42UGLI.js";
@@ -36,6 +33,9 @@ import {
36
33
  import {
37
34
  expandHome
38
35
  } from "./chunk-BHXCAVFP.js";
36
+ import {
37
+ launchDaemonDetached
38
+ } from "./chunk-B6S43WID.js";
39
39
 
40
40
  // node_modules/.pnpm/mcporter@0.16.1/node_modules/mcporter/dist/cli/daemon-command.js
41
41
  import fsPromises from "node:fs/promises";
@@ -1,7 +1,4 @@
1
1
  import { createRequire as __createRequire } from "node:module"; const require = __createRequire(import.meta.url);
2
- import {
3
- createRuntime
4
- } from "./chunk-36D4FILJ.js";
5
2
 
6
3
  // src/mcp/pi-runtime.ts
7
4
  import { readFileSync } from "node:fs";
@@ -16,11 +13,16 @@ function piMcpServes(configPath) {
16
13
  (server) => server.auth === "oauth" || server.httpFetch === "node-http1"
17
14
  );
18
15
  }
19
- async function createMcpRuntime(configPath = process.env.MCPORTER_CONFIG) {
20
- if (usesPiMcpClient() && piMcpServes(configPath))
21
- return (await import("./pi-mcp-runtime-GHDEPXUL.js")).PiMcpRuntime.fromConfigFile(
22
- configPath
16
+ function mcpRuntimeKind(configPath = process.env.MCPORTER_CONFIG, env = process.env) {
17
+ return usesPiMcpClient(env) && piMcpServes(configPath) ? "pi-mcp" : "mcporter";
18
+ }
19
+ async function createMcpRuntime(configPath = process.env.MCPORTER_CONFIG, env = process.env) {
20
+ if (mcpRuntimeKind(configPath, env) === "pi-mcp")
21
+ return (await import("./pi-mcp-runtime-OLO25D7A.js")).PiMcpRuntime.fromConfigFile(
22
+ configPath,
23
+ env
23
24
  );
25
+ const { createRuntime } = await import("./dist-SDPPH7XQ.js");
24
26
  return await createRuntime(configPath ? { configPath } : {});
25
27
  }
26
28