@yawlabs/mcp 1.0.10 → 1.0.12

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.
@@ -209,6 +209,15 @@ function createStreamWriter(stream) {
209
209
  };
210
210
  }
211
211
 
212
+ // src/opt-out-env.ts
213
+ function isFeatureDisabled(name, env = process.env) {
214
+ const raw = env[name];
215
+ if (raw === void 0) return false;
216
+ const trimmed = raw.trim();
217
+ if (trimmed === "") return false;
218
+ return trimmed === "0" || trimmed.toLowerCase() === "false";
219
+ }
220
+
212
221
  // src/upgrade-cmd.ts
213
222
  import { spawn as spawn2 } from "child_process";
214
223
  import { readFileSync as readFileSync2, realpathSync as realpathSync2 } from "fs";
@@ -3585,7 +3594,7 @@ function npxSpec(args) {
3585
3594
  const spec = args[idx];
3586
3595
  return spec.startsWith("-") ? null : spec;
3587
3596
  }
3588
- var MIN_OAM_VERSION = "0.16.3";
3597
+ var MIN_OAM_VERSION = "0.16.4";
3589
3598
  var OAM_INSTALL_SH = "curl -fsSL https://oamjs.org/install.sh | sh";
3590
3599
  var OAM_INSTALL_PS1 = "irm https://oamjs.org/install.ps1 | iex";
3591
3600
  function oamInstallCommand(os) {
@@ -3608,7 +3617,7 @@ function oamInstallAdvice(os) {
3608
3617
  }
3609
3618
  function oamHeapOomHint(stderr) {
3610
3619
  if (!stderr.includes("OAM-RT-OOM")) return null;
3611
- return `The oam-hosted child hit its V8 heap cap (oam defaults to 4 GiB). Raise it with OAM_MAX_HEAP_MB=<mb> in this server's env, or set "runtime": "node" for this server in bundles.json.`;
3620
+ return `The oam-hosted child hit its V8 heap cap. Raise it with OAM_MAX_HEAP_MB=<mb> in this server's env, or set "runtime": "node" for this server in bundles.json.`;
3612
3621
  }
3613
3622
  var warnedOamUnavailable = false;
3614
3623
  function oamFailureLabel(failure) {
@@ -3814,8 +3823,20 @@ async function probeOamUncached(run, generation) {
3814
3823
  if (generation === oamProbeGeneration) oamProbeCache = probe;
3815
3824
  return probe;
3816
3825
  };
3826
+ const runRetryingTimeout = async () => {
3827
+ try {
3828
+ return await run(bin);
3829
+ } catch (err) {
3830
+ if (err?.code !== "ETIMEDOUT") throw err;
3831
+ log("debug", "oam --version timed out; retrying once before falling back to node", {
3832
+ timeoutMs: OAM_PROBE_TIMEOUT_MS,
3833
+ bin
3834
+ });
3835
+ return await run(bin);
3836
+ }
3837
+ };
3817
3838
  try {
3818
- const version = parseOamVersion(await run(bin));
3839
+ const version = parseOamVersion(await runRetryingTimeout());
3819
3840
  if (version !== null && compareVersions(version, MIN_OAM_VERSION) < 0) {
3820
3841
  log("warn", "oam is installed but below the minimum supported version; falling back to node", {
3821
3842
  // The full token, prerelease suffix included: a build reporting
@@ -3824,8 +3845,9 @@ async function probeOamUncached(run, generation) {
3824
3845
  // make this line look like a comparator bug.
3825
3846
  oamVersion: version,
3826
3847
  minVersion: MIN_OAM_VERSION,
3827
- // The floor tracks the latest release, so below-min always means out
3828
- // of date, and oam updates itself in place.
3848
+ // The floor is a released oam (the last one verify:oam-floor passed
3849
+ // on), so below-min always means out of date, and oam updates itself
3850
+ // in place.
3829
3851
  updateWith: "oam self-update",
3830
3852
  // ...but updating alone changes nothing here. oamProbeCache is written
3831
3853
  // once per process and only ever cleared by a test hook, so every
@@ -3858,7 +3880,7 @@ async function probeOamUncached(run, generation) {
3858
3880
  const code = err?.code;
3859
3881
  const absent = code === "ENOENT" && !explicit;
3860
3882
  if (code === "ETIMEDOUT") {
3861
- log("warn", "oam did not respond to --version in time; falling back to node for this process", {
3883
+ log("warn", "oam did not respond to --version twice; falling back to node for this process", {
3862
3884
  timeoutMs: OAM_PROBE_TIMEOUT_MS,
3863
3885
  bin
3864
3886
  });
@@ -4521,7 +4543,13 @@ async function oamFloorLines(probe) {
4521
4543
  `oam: v${oam.version ?? "unknown"} is installed but below the v${MIN_OAM_VERSION} floor yaw-mcp`,
4522
4544
  " requires, so MCP sidecars run on node instead of oam. Update it:",
4523
4545
  "",
4524
- " oam self-update"
4546
+ " oam self-update",
4547
+ "",
4548
+ // A broker already running keeps the probe's cached answer for its
4549
+ // lifetime (probeOam), so without a restart it stays on node after the
4550
+ // update; the broker's own warn says so, but MCP clients hide stderr.
4551
+ " then restart yaw-mcp: a running broker keeps its oam probe for its",
4552
+ " lifetime, so it stays on node until it does."
4525
4553
  ];
4526
4554
  } catch {
4527
4555
  return [];
@@ -4529,7 +4557,7 @@ async function oamFloorLines(probe) {
4529
4557
  }
4530
4558
  async function defaultRunningPrefix(argvPath) {
4531
4559
  if (process.env.VITEST) return null;
4532
- const { detectRunningInstallPrefix: detectRunningInstallPrefix2 } = await import("./auto-upgrade-U5CXWGIO.js");
4560
+ const { detectRunningInstallPrefix: detectRunningInstallPrefix2 } = await import("./auto-upgrade-XYB4P44U.js");
4533
4561
  return detectRunningInstallPrefix2(argvPath);
4534
4562
  }
4535
4563
  async function defaultSpawn(cmd, args, cwd) {
@@ -4590,7 +4618,7 @@ async function runUpgrade(opts = {}) {
4590
4618
  if (method === "global-npm") {
4591
4619
  const rawPrefix = await (opts.runningPrefix ?? defaultRunningPrefix)(argvPath);
4592
4620
  if (rawPrefix !== null) {
4593
- const { quoteArgForDisplay: quoteArgForDisplay2, quoteShellArgIfNeeded: quoteShellArgIfNeeded2 } = await import("./auto-upgrade-U5CXWGIO.js");
4621
+ const { quoteArgForDisplay: quoteArgForDisplay2, quoteShellArgIfNeeded: quoteShellArgIfNeeded2 } = await import("./auto-upgrade-XYB4P44U.js");
4594
4622
  const spawnForm = quoteShellArgIfNeeded2(rawPrefix, opts.platform);
4595
4623
  const displayForm = quoteArgForDisplay2(rawPrefix, opts.platform);
4596
4624
  if (spawnForm !== null && displayForm !== null) {
@@ -4707,7 +4735,7 @@ async function runUpgrade(opts = {}) {
4707
4735
  return { exitCode: 3, lines };
4708
4736
  }
4709
4737
  function readCurrentVersion() {
4710
- return true ? "1.0.10" : "dev";
4738
+ return true ? "1.0.12" : "dev";
4711
4739
  }
4712
4740
 
4713
4741
  // src/auto-upgrade.ts
@@ -4987,9 +5015,8 @@ function defaultSpawn2(cmd, args, onDone = () => {
4987
5015
  });
4988
5016
  }
4989
5017
  async function maybeAutoUpgrade(deps = {}) {
4990
- const optOut = process.env.YAW_MCP_AUTO_UPGRADE;
4991
- if (optOut === "0" || optOut?.toLowerCase() === "false") return;
4992
- const current = deps.currentVersion ?? (true ? "1.0.10" : "dev");
5018
+ if (isFeatureDisabled("YAW_MCP_AUTO_UPGRADE")) return;
5019
+ const current = deps.currentVersion ?? (true ? "1.0.12" : "dev");
4993
5020
  if (current === "dev") return;
4994
5021
  const argvPath = deps.argvPath ?? process.argv[1];
4995
5022
  const method = (deps.isSeaImpl ? await deps.isSeaImpl() : await detectSea()) ? "binary" : detectInstallMethod(argvPath, realpathSync3, ["unknown", "local-node-modules"]);
@@ -5118,6 +5145,7 @@ export {
5118
5145
  ALLOW_UNOWNED_ENV,
5119
5146
  findProjectConfigDir,
5120
5147
  guidePath,
5148
+ isFeatureDisabled,
5121
5149
  readStrictJson,
5122
5150
  CURRENT_OS,
5123
5151
  ENTRY_NAME,