@yawlabs/mcp 0.74.0 → 0.74.1

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.
package/dist/index.js CHANGED
@@ -207,6 +207,13 @@ function cacheDir() {
207
207
  return path2.join(xdg && xdg.length > 0 ? xdg : path2.join(homedir(), ".cache"), "yaw-mcp");
208
208
  }
209
209
  var CONFIG_DIRNAME = ".yaw-mcp";
210
+ var SIDECARS_DIRNAME = "sidecars";
211
+ function sidecarsRoot(home = homedir()) {
212
+ return path2.join(userConfigDir(home), SIDECARS_DIRNAME);
213
+ }
214
+ function sidecarsNodeModules(home = homedir()) {
215
+ return path2.join(sidecarsRoot(home), "node_modules");
216
+ }
210
217
  function userConfigDir(home = homedir()) {
211
218
  return path2.join(home, CONFIG_DIRNAME);
212
219
  }
@@ -1243,6 +1250,15 @@ var SUBCOMMAND_SPEC = [
1243
1250
  flags: ["--force", "--yes", "--help"]
1244
1251
  },
1245
1252
  { name: "list", description: "List the servers yaw-mcp loads locally", flags: ["--json", "--help"] },
1253
+ // Positional is the literal subcommand, not a placeholder -- `install` is
1254
+ // the only verb, and requiring it keeps room for later ones (list, prune)
1255
+ // without a bare `yaw-mcp sidecars` having ever meant something else.
1256
+ {
1257
+ name: "sidecars",
1258
+ description: "Install configured MCP servers into a managed directory",
1259
+ positional: [["install"]],
1260
+ flags: ["--json", "--help"]
1261
+ },
1246
1262
  // Consent gate for a project-local .yaw-mcp/bundles.json. Flags mirror
1247
1263
  // parseTrustArgs in src/trust-cmd.ts -- keep them in sync.
1248
1264
  {
@@ -2014,10 +2030,10 @@ function profileAllows(profile, namespace) {
2014
2030
  }
2015
2031
 
2016
2032
  // src/doctor-cmd.ts
2017
- import { existsSync as existsSync6, readFileSync as readFileSync2 } from "fs";
2033
+ import { existsSync as existsSync7, readFileSync as readFileSync3 } from "fs";
2018
2034
  import { readFile as readFile9 } from "fs/promises";
2019
- import { homedir as homedir10 } from "os";
2020
- import { join as join9 } from "path";
2035
+ import { homedir as homedir12 } from "os";
2036
+ import { isAbsolute as isAbsolute4, join as join10 } from "path";
2021
2037
 
2022
2038
  // src/cli-shadows.ts
2023
2039
  var EMPTY = [];
@@ -2184,14 +2200,16 @@ function formatShadowLine(server) {
2184
2200
  // src/oam-spawn.ts
2185
2201
  import { spawn as spawn2 } from "child_process";
2186
2202
  import { existsSync as existsSync3, readdirSync, readFileSync } from "fs";
2187
- import { isAbsolute as isAbsolute2, join as join6, sep } from "path";
2203
+ import { homedir as homedir7 } from "os";
2204
+ import { dirname as dirname2, isAbsolute as isAbsolute2, join as join6, sep } from "path";
2188
2205
  import { fileURLToPath } from "url";
2189
2206
  function packageName(spec) {
2190
2207
  const start = spec.startsWith("@") ? 1 : 0;
2191
2208
  const at = spec.indexOf("@", start);
2192
2209
  return at === -1 ? spec : spec.slice(0, at);
2193
2210
  }
2194
- var MIN_OAM_VERSION = "0.6.0";
2211
+ var MIN_OAM_VERSION = "0.8.2";
2212
+ var warnedOamMissing = false;
2195
2213
  var oamProbeCache;
2196
2214
  function parseOamVersion(out) {
2197
2215
  const m = /(\d+\.\d+\.\d+)/.exec(out);
@@ -2312,7 +2330,10 @@ async function probeOamUncached(run, generation) {
2312
2330
  if (version !== null && compareVersions(version, MIN_OAM_VERSION) < 0) {
2313
2331
  log("warn", "oam is installed but below the minimum supported version; falling back to node", {
2314
2332
  oamVersion: version,
2315
- minVersion: MIN_OAM_VERSION
2333
+ minVersion: MIN_OAM_VERSION,
2334
+ // The floor tracks the latest release, so below-min always means out
2335
+ // of date, and oam updates itself in place.
2336
+ updateWith: "oam self-update"
2316
2337
  });
2317
2338
  return publish({ bin: null, version, belowMin: true });
2318
2339
  }
@@ -2333,9 +2354,6 @@ async function probeOamUncached(run, generation) {
2333
2354
  return publish({ bin: null, version: null, belowMin: false });
2334
2355
  }
2335
2356
  }
2336
- async function oamBin() {
2337
- return (await probeOam()).bin;
2338
- }
2339
2357
  function rewriteForOam(command, args, deps) {
2340
2358
  const bin = deps.oamBin;
2341
2359
  if (!bin) return { command, args };
@@ -2387,6 +2405,57 @@ function npxCacheNodeModules(fromUrl = import.meta.url) {
2387
2405
  return [];
2388
2406
  }
2389
2407
  }
2408
+ function npmrcCache(file) {
2409
+ let text;
2410
+ try {
2411
+ text = readFileSync(file, "utf8");
2412
+ } catch {
2413
+ return null;
2414
+ }
2415
+ for (const line of text.split(/\r?\n/)) {
2416
+ const m = /^\s*cache\s*=\s*(.+?)\s*$/.exec(line);
2417
+ if (m && !/^\s*[;#]/.test(line)) return m[1].replace(/^["']|["']$/g, "");
2418
+ }
2419
+ return null;
2420
+ }
2421
+ var npmCacheDirCache = /* @__PURE__ */ new Map();
2422
+ function npmCacheDir(fromUrl = import.meta.url) {
2423
+ const cached = npmCacheDirCache.get(fromUrl);
2424
+ if (cached !== void 0) return cached;
2425
+ const resolved = resolveNpmCacheDir(fromUrl);
2426
+ npmCacheDirCache.set(fromUrl, resolved);
2427
+ return resolved;
2428
+ }
2429
+ function resolveNpmCacheDir(fromUrl) {
2430
+ const fromEnv = process.env.npm_config_cache;
2431
+ if (fromEnv) return fromEnv;
2432
+ const candidates = [join6(homedir7(), ".npmrc")];
2433
+ for (const nodeModules of ownNodeModules(fromUrl)) {
2434
+ candidates.push(join6(dirname2(nodeModules), "etc", "npmrc"), join6(nodeModules, "npm", "npmrc"));
2435
+ }
2436
+ const nodeDir = dirname2(process.execPath);
2437
+ candidates.push(
2438
+ join6(nodeDir, "node_modules", "npm", "npmrc"),
2439
+ // Windows layout
2440
+ join6(nodeDir, "..", "lib", "node_modules", "npm", "npmrc")
2441
+ // POSIX layout
2442
+ );
2443
+ for (const file of candidates) {
2444
+ const cache = npmrcCache(file);
2445
+ if (cache) return cache;
2446
+ }
2447
+ const fallback = process.platform === "win32" ? process.env.LOCALAPPDATA && join6(process.env.LOCALAPPDATA, "npm-cache") : join6(homedir7(), ".npm");
2448
+ return fallback && existsSync3(fallback) ? fallback : null;
2449
+ }
2450
+ function npmCacheNpxNodeModules(cacheDir2) {
2451
+ if (!cacheDir2) return [];
2452
+ const npxRoot = join6(cacheDir2, "_npx");
2453
+ try {
2454
+ return readdirSync(npxRoot, { withFileTypes: true }).filter((e) => e.isDirectory()).map((e) => join6(npxRoot, e.name, "node_modules"));
2455
+ } catch {
2456
+ return [];
2457
+ }
2458
+ }
2390
2459
  function ownNodeModules(fromUrl = import.meta.url) {
2391
2460
  let here;
2392
2461
  try {
@@ -2417,22 +2486,83 @@ function packageEntry(pkgDir, pkg) {
2417
2486
  }
2418
2487
  if (!rel && typeof j.main === "string") rel = j.main;
2419
2488
  if (!rel) return null;
2420
- return isAbsolute2(rel) ? rel : join6(pkgDir, rel);
2489
+ return {
2490
+ entry: isAbsolute2(rel) ? rel : join6(pkgDir, rel),
2491
+ version: typeof j.version === "string" ? j.version : null
2492
+ };
2421
2493
  }
2422
- function resolveNpmEntry(pkg, fromUrl = import.meta.url) {
2494
+ function resolveNpmEntry(pkg, fromUrl = import.meta.url, npmCache = npmCacheDir(fromUrl), managedRoot = sidecarsNodeModules()) {
2423
2495
  const parts = pkg.split("/");
2424
- for (const nodeModules of [...ownNodeModules(fromUrl), ...npxCacheNodeModules(fromUrl)]) {
2425
- const entry = packageEntry(join6(nodeModules, ...parts), pkg);
2426
- if (entry) return entry;
2496
+ for (const nodeModules of [...managedRoot ? [managedRoot] : [], ...ownNodeModules(fromUrl)]) {
2497
+ const hit = packageEntry(join6(nodeModules, ...parts), pkg);
2498
+ if (hit) return hit.entry;
2499
+ }
2500
+ const roots = /* @__PURE__ */ new Set([...npxCacheNodeModules(fromUrl), ...npmCacheNpxNodeModules(npmCache)]);
2501
+ let best = null;
2502
+ for (const nodeModules of roots) {
2503
+ const hit = packageEntry(join6(nodeModules, ...parts), pkg);
2504
+ if (!hit) continue;
2505
+ if (best === null || hit.version !== null && (best.version === null || compareVersions(hit.version, best.version) > 0)) {
2506
+ best = hit;
2507
+ }
2508
+ }
2509
+ if (best !== null) notePinnedSidecar(pkg, best.version);
2510
+ return best?.entry ?? null;
2511
+ }
2512
+ var pinnedReported = /* @__PURE__ */ new Set();
2513
+ function notePinnedSidecar(pkg, version) {
2514
+ if (pinnedReported.has(pkg)) return;
2515
+ pinnedReported.add(pkg);
2516
+ log("info", "hosting sidecar on oam from an on-disk copy; it will not self-update the way npx does", {
2517
+ package: pkg,
2518
+ version: version ?? "unknown",
2519
+ refreshWith: `npx -y ${pkg}@latest --help`
2520
+ });
2521
+ }
2522
+ function resolveStableNpmEntry(pkg, fromUrl = import.meta.url) {
2523
+ const npxMarker = `${sep}_npx${sep}`;
2524
+ for (const nodeModules of ownNodeModules(fromUrl)) {
2525
+ if (nodeModules.includes(npxMarker)) continue;
2526
+ const hit = packageEntry(join6(nodeModules, ...pkg.split("/")), pkg);
2527
+ if (hit) return hit.entry;
2427
2528
  }
2428
2529
  return null;
2429
2530
  }
2430
- async function resolveOamSpawn(command, args) {
2531
+ async function resolveOamSpawn(command, args, optedIn = true) {
2532
+ const probe = await probeOam();
2533
+ if (optedIn && probe.bin === null && !probe.belowMin && !warnedOamMissing) {
2534
+ warnedOamMissing = true;
2535
+ log("warn", "a server opted in to oam but oam is not installed; running it on node instead", {
2536
+ install: "curl -fsSL https://oamjs.org/install.sh | sh",
2537
+ installWindows: "irm https://oamjs.org/install.ps1 | iex",
2538
+ overrideWith: "OAM_BIN"
2539
+ });
2540
+ }
2431
2541
  return rewriteForOam(command, args, {
2432
- oamBin: await oamBin(),
2542
+ oamBin: probe.bin,
2433
2543
  resolveEntry: (pkg) => resolveNpmEntry(pkg)
2434
2544
  });
2435
2545
  }
2546
+ function isOamCommand(command) {
2547
+ const base = command.split(/[\\/]/).pop() ?? command;
2548
+ return /^oam(\.exe)?$/i.test(base);
2549
+ }
2550
+ function isOamLaunch(command, args = []) {
2551
+ if (isOamCommand(command)) return true;
2552
+ const base = command.split(/[\\/]/).pop() ?? command;
2553
+ if (/^cmd(\.exe)?$/i.test(base)) {
2554
+ const first = args.find((a) => !/^\/[a-z]$/i.test(a));
2555
+ return first !== void 0 && isOamCommand(first);
2556
+ }
2557
+ if (/^(sh|bash|zsh|dash)$/i.test(base)) {
2558
+ const dashC = args.indexOf("-c");
2559
+ const payload = dashC >= 0 ? args[dashC + 1] : args[0];
2560
+ if (payload === void 0) return false;
2561
+ const firstToken = payload.trim().split(/\s+/)[0]?.replace(/^["']|["']$/g, "");
2562
+ return firstToken !== void 0 && firstToken.length > 0 && isOamCommand(firstToken);
2563
+ }
2564
+ return false;
2565
+ }
2436
2566
 
2437
2567
  // src/default-runtime.ts
2438
2568
  var bundlesDefaultCache;
@@ -2471,11 +2601,11 @@ function describeServerRuntime(server, configDefault, probe) {
2471
2601
  if (server.runtime === "node") {
2472
2602
  return { runtime: "node", code: "per-server-node", reason: 'per-server runtime:"node"' };
2473
2603
  }
2474
- const wantsOam = server.runtime === "oam" || server.runtime === void 0 && configDefault === "oam";
2604
+ const wantsOam = server.runtime === "oam" || server.runtime === void 0 && configDefault !== "node";
2475
2605
  if (!wantsOam) {
2476
- return { runtime: "node", code: "default-node", reason: "default (no oam opt-in)" };
2606
+ return { runtime: "node", code: "default-node", reason: 'config default runtime:"node"' };
2477
2607
  }
2478
- const via = server.runtime === "oam" ? 'per-server runtime:"oam"' : 'default runtime "oam"';
2608
+ const via = server.runtime === "oam" ? 'per-server runtime:"oam"' : configDefault === "oam" ? 'default runtime "oam"' : "oam is the default when installed";
2479
2609
  if (server.command !== "node" && server.command !== "npx") {
2480
2610
  return { runtime: "node", code: "not-node-command", reason: `${via}, but command is not node/npx` };
2481
2611
  }
@@ -2584,7 +2714,7 @@ function renderActiveServersSection(activeServers) {
2584
2714
  }
2585
2715
 
2586
2716
  // src/install-targets.ts
2587
- import { homedir as homedir7 } from "os";
2717
+ import { homedir as homedir8 } from "os";
2588
2718
  import { isAbsolute as isAbsolute3, join as join7, resolve as resolve4 } from "path";
2589
2719
  var CURRENT_OS = process.platform === "darwin" ? "macos" : process.platform === "win32" ? "windows" : "linux";
2590
2720
  var INSTALL_TARGETS = [
@@ -2666,7 +2796,7 @@ var INSTALL_TARGETS = [
2666
2796
  }
2667
2797
  ];
2668
2798
  function resolveInstallPath(opts) {
2669
- const home = opts.home ?? homedir7();
2799
+ const home = opts.home ?? homedir8();
2670
2800
  const appData = opts.appData ?? process.env.APPDATA ?? join7(home, "AppData", "Roaming");
2671
2801
  const { clientId, scope, os, projectDir, claudeConfigDir } = opts;
2672
2802
  const target = INSTALL_TARGETS.find((t) => t.clientId === clientId);
@@ -2768,6 +2898,9 @@ function buildLaunchEntry(opts) {
2768
2898
  return entry;
2769
2899
  }
2770
2900
  const pkg = opts.pkg ?? "@yawlabs/mcp@latest";
2901
+ if (opts.oamBin && opts.oamEntry && !opts.pkg) {
2902
+ return { command: opts.oamBin, args: ["run", "--no-check", opts.oamEntry] };
2903
+ }
2771
2904
  return opts.os === "windows" ? { command: "cmd", args: ["/c", "npx", "-y", pkg] } : { command: "npx", args: ["-y", pkg] };
2772
2905
  }
2773
2906
  var ENTRY_NAME = "mcp";
@@ -2912,11 +3045,231 @@ function errorMessage(err) {
2912
3045
  return err instanceof Error ? err.message : String(err);
2913
3046
  }
2914
3047
 
3048
+ // src/sidecars-cmd.ts
3049
+ import { spawn as spawn3 } from "child_process";
3050
+ import { existsSync as existsSync4, mkdirSync, readFileSync as readFileSync2 } from "fs";
3051
+ import { homedir as homedir9 } from "os";
3052
+ import { join as join8 } from "path";
3053
+ function isRegistrySpec(spec) {
3054
+ if (spec.includes(":") || /^[./~\\]/.test(spec)) return false;
3055
+ return /^(@[^/@\s]+\/)?[^./_@\s][^/@\s]*$/.test(packageName(spec));
3056
+ }
3057
+ function collectSidecarSpecs(servers) {
3058
+ const byPkg = /* @__PURE__ */ new Map();
3059
+ for (const s of servers) {
3060
+ if (s.type !== "local" || s.command !== "npx") continue;
3061
+ const positional = (s.args ?? []).filter((a) => a !== "-y" && a !== "--yes");
3062
+ const spec = positional[0];
3063
+ if (spec === void 0 || spec.startsWith("-")) continue;
3064
+ if (!isRegistrySpec(spec)) continue;
3065
+ const pkg = packageName(spec);
3066
+ if (!pkg) continue;
3067
+ const existing = byPkg.get(pkg);
3068
+ if (existing) {
3069
+ if (s.namespace && !existing.namespaces.includes(s.namespace)) existing.namespaces.push(s.namespace);
3070
+ if (spec !== existing.spec && !existing.conflicting.includes(spec)) existing.conflicting.push(spec);
3071
+ continue;
3072
+ }
3073
+ byPkg.set(pkg, { pkg, spec, namespaces: s.namespace ? [s.namespace] : [], conflicting: [] });
3074
+ }
3075
+ return [...byPkg.values()];
3076
+ }
3077
+ function collectNonRegistrySpecs(servers) {
3078
+ const out = [];
3079
+ for (const s of servers) {
3080
+ if (s.type !== "local" || s.command !== "npx") continue;
3081
+ const spec = (s.args ?? []).filter((a) => a !== "-y" && a !== "--yes")[0];
3082
+ if (spec === void 0 || spec.startsWith("-") || isRegistrySpec(spec)) continue;
3083
+ out.push({ namespace: s.namespace ?? "(unnamed)", spec });
3084
+ }
3085
+ return out;
3086
+ }
3087
+ function sidecarsManifest(specs) {
3088
+ const dependencies = {};
3089
+ for (const { pkg, spec } of specs.slice().sort((a, b) => a.pkg.localeCompare(b.pkg))) {
3090
+ const range = spec.slice(pkg.length).replace(/^@/, "");
3091
+ dependencies[pkg] = range === "" ? "latest" : range;
3092
+ }
3093
+ return `${JSON.stringify(
3094
+ {
3095
+ name: "yaw-mcp-sidecars",
3096
+ version: "0.0.0",
3097
+ private: true,
3098
+ description: "MCP servers installed by `yaw-mcp sidecars install`. Managed file -- edits are overwritten.",
3099
+ dependencies
3100
+ },
3101
+ null,
3102
+ 2
3103
+ )}
3104
+ `;
3105
+ }
3106
+ function installedVersion(pkg, home = homedir9()) {
3107
+ const pj = join8(sidecarsNodeModules(home), ...pkg.split("/"), "package.json");
3108
+ try {
3109
+ const v = JSON.parse(readFileSync2(pj, "utf8")).version;
3110
+ return typeof v === "string" ? v : null;
3111
+ } catch {
3112
+ return null;
3113
+ }
3114
+ }
3115
+ function jsonDocument(root, over = {}) {
3116
+ const doc = {
3117
+ root,
3118
+ installed: [],
3119
+ reason: null,
3120
+ error: null,
3121
+ conflicts: [],
3122
+ skipped: [],
3123
+ ...over
3124
+ };
3125
+ return `${JSON.stringify(doc, null, 2)}
3126
+ `;
3127
+ }
3128
+ function defaultRunNpm(args, cwd) {
3129
+ return new Promise((resolve8) => {
3130
+ const isWindows = process.platform === "win32";
3131
+ const child = spawn3(isWindows ? "npm.cmd" : "npm", args, {
3132
+ cwd,
3133
+ // npm's own progress ("added 220 packages in 12s") goes to its STDOUT,
3134
+ // and inheriting that put it ahead of the JSON document under --json --
3135
+ // enough to make `yaw-mcp sidecars install --json | jq` fail outright.
3136
+ // Routing the child's stdout to fd 2 keeps the progress visible while
3137
+ // leaving OUR stdout carrying only the result, which is what a caller
3138
+ // parses. Unconditional rather than --json-only: progress belongs on
3139
+ // stderr in both modes, and a mode-dependent stdio is a second shape to
3140
+ // get wrong.
3141
+ stdio: ["ignore", 2, "inherit"],
3142
+ shell: isWindows
3143
+ });
3144
+ child.on("error", () => resolve8(-1));
3145
+ child.on("close", (code, signal) => resolve8(code ?? (signal ? -1 : 0)));
3146
+ });
3147
+ }
3148
+ var SIDECARS_USAGE = `Usage: yaw-mcp sidecars install [--json]
3149
+
3150
+ Install the MCP servers from your bundles.json into ~/.yaw-mcp/sidecars,
3151
+ so they run from one known version instead of whatever npm's npx cache
3152
+ happens to hold.
3153
+
3154
+ Worth running when servers are hosted on oam: oam runs the copy already on
3155
+ disk and cannot re-resolve "@latest" the way npx did, so without a managed
3156
+ install a server stays pinned at whatever was last fetched. Re-run this to
3157
+ move them forward.
3158
+
3159
+ Only npx-launched servers naming a registry package are installed. docker,
3160
+ uvx, and native commands are left alone, as are node launches that already
3161
+ name a file and npx launches pointing at a git or path target.`;
3162
+ function parseSidecarsArgs(argv) {
3163
+ let json = false;
3164
+ let sawInstall = false;
3165
+ for (const a of argv) {
3166
+ if (a === "--json") {
3167
+ json = true;
3168
+ } else if (a === "--help" || a === "-h") {
3169
+ return { ok: false, error: SIDECARS_USAGE, help: true };
3170
+ } else if (a === "install") {
3171
+ sawInstall = true;
3172
+ } else if (a.startsWith("-")) {
3173
+ return { ok: false, error: `yaw-mcp sidecars: unknown argument "${a}"
3174
+
3175
+ ${SIDECARS_USAGE}` };
3176
+ } else {
3177
+ return { ok: false, error: `yaw-mcp sidecars: unknown subcommand "${a}"
3178
+
3179
+ ${SIDECARS_USAGE}` };
3180
+ }
3181
+ }
3182
+ if (!sawInstall) return { ok: false, error: `yaw-mcp sidecars: expected "install"
3183
+
3184
+ ${SIDECARS_USAGE}` };
3185
+ return { ok: true, options: { json } };
3186
+ }
3187
+ async function runSidecarsInstall(opts = {}) {
3188
+ const home = opts.home ?? homedir9();
3189
+ const write = opts.out ?? ((s) => process.stdout.write(s));
3190
+ const lines = [];
3191
+ const print = (s = "") => {
3192
+ lines.push(s);
3193
+ if (!opts.json) write(`${s}
3194
+ `);
3195
+ };
3196
+ const bundles = await loadLocalBundles({ cwd: opts.cwd, home });
3197
+ const servers = bundles.config?.servers ?? [];
3198
+ const specs = collectSidecarSpecs(servers);
3199
+ const skipped = collectNonRegistrySpecs(servers);
3200
+ const root = sidecarsRoot(home);
3201
+ const conflicts = specs.filter((s) => s.conflicting.length > 0).map((s) => ({ pkg: s.pkg, used: s.spec, ignored: s.conflicting }));
3202
+ const printSkipped = () => {
3203
+ if (skipped.length === 0) return;
3204
+ print();
3205
+ for (const k of skipped) {
3206
+ print(` note: ${k.namespace} launches ${k.spec}, not a registry package; it keeps using npx`);
3207
+ }
3208
+ };
3209
+ if (specs.length === 0) {
3210
+ if (bundles.config === null) {
3211
+ print("No servers configured yet -- nothing to install.");
3212
+ print("Add one with `yaw-mcp add <slug>`, then run this again.");
3213
+ printSkipped();
3214
+ if (opts.json) write(jsonDocument(root, { reason: "no-config", skipped }));
3215
+ return { exitCode: 0, installed: [], lines };
3216
+ }
3217
+ if (skipped.length > 0) {
3218
+ print("Nothing to install -- every npx server points at a git or path target.");
3219
+ printSkipped();
3220
+ if (opts.json) write(jsonDocument(root, { reason: "only-non-registry-specs", skipped }));
3221
+ return { exitCode: 0, installed: [], lines };
3222
+ }
3223
+ print("No npx-launched servers in bundles.json -- nothing to install.");
3224
+ print("docker, uvx, and native commands run as configured; only npx servers are installed here.");
3225
+ if (opts.json) write(jsonDocument(root, { reason: "no-npx-servers", skipped }));
3226
+ return { exitCode: 0, installed: [], lines };
3227
+ }
3228
+ mkdirSync(root, { recursive: true });
3229
+ await atomicWriteFile(join8(root, "package.json"), sidecarsManifest(specs));
3230
+ print(`Installing ${specs.length} server package(s) into ${root}`);
3231
+ for (const s of specs) print(` ${s.spec}${s.namespaces.length ? ` (${s.namespaces.join(", ")})` : ""}`);
3232
+ printSkipped();
3233
+ if (conflicts.length > 0) {
3234
+ print();
3235
+ for (const c of conflicts) {
3236
+ print(` note: ${c.pkg} is also configured as ${c.ignored.join(", ")}; installing ${c.used}`);
3237
+ }
3238
+ }
3239
+ print();
3240
+ const runNpm = opts.runNpm ?? defaultRunNpm;
3241
+ const code = await runNpm(["install", "--no-audit", "--no-fund"], root);
3242
+ if (code !== 0) {
3243
+ print(`npm install failed (exit ${code}). Servers keep resolving from the npx cache.`);
3244
+ if (opts.json) write(jsonDocument(root, { error: `npm exited ${code}`, conflicts, skipped }));
3245
+ return { exitCode: 1, installed: [], lines };
3246
+ }
3247
+ const installed = specs.map((s) => ({
3248
+ pkg: s.pkg,
3249
+ version: installedVersion(s.pkg, home),
3250
+ namespaces: s.namespaces
3251
+ }));
3252
+ const missing = installed.filter((i) => i.version === null);
3253
+ print("Installed:");
3254
+ for (const i of installed) print(` ${i.pkg} ${i.version ?? "NOT FOUND"}`);
3255
+ if (missing.length > 0) {
3256
+ print();
3257
+ print(`${missing.length} package(s) did not land; those servers keep resolving from the npx cache.`);
3258
+ }
3259
+ print();
3260
+ print("These versions are now fixed. Re-run this command to move them forward.");
3261
+ if (opts.json) write(jsonDocument(root, { installed, conflicts, skipped }));
3262
+ return { exitCode: missing.length === installed.length ? 1 : 0, installed, lines };
3263
+ }
3264
+ function hasManagedSidecars(home = homedir9()) {
3265
+ return existsSync4(sidecarsNodeModules(home));
3266
+ }
3267
+
2915
3268
  // src/try-cmd.ts
2916
- import { existsSync as existsSync5 } from "fs";
3269
+ import { existsSync as existsSync6 } from "fs";
2917
3270
  import { chmod as chmod4, mkdir as mkdir3, readdir, readFile as readFile8, unlink as unlink2 } from "fs/promises";
2918
- import { homedir as homedir9 } from "os";
2919
- import { join as join8, resolve as resolve6 } from "path";
3271
+ import { homedir as homedir11 } from "os";
3272
+ import { join as join9, resolve as resolve6 } from "path";
2920
3273
 
2921
3274
  // src/catalog.ts
2922
3275
  var DEFAULT_CATALOG_URL = "https://yaw.sh/data/mcp-catalog.json";
@@ -3019,9 +3372,9 @@ async function resolveCatalogSlug(slug, opts = {}) {
3019
3372
  }
3020
3373
 
3021
3374
  // src/install-cmd.ts
3022
- import { existsSync as existsSync4 } from "fs";
3375
+ import { existsSync as existsSync5 } from "fs";
3023
3376
  import { readFile as readFile7 } from "fs/promises";
3024
- import { homedir as homedir8 } from "os";
3377
+ import { homedir as homedir10 } from "os";
3025
3378
  import { resolve as resolve5 } from "path";
3026
3379
  import { createInterface } from "readline/promises";
3027
3380
  import { Writable } from "stream";
@@ -3097,12 +3450,20 @@ ${USAGE}`);
3097
3450
  }
3098
3451
  log2(`Target: ${target.label} (${scope})`);
3099
3452
  log2(`File: ${resolved.absolute}`);
3100
- const newEntry = buildLaunchEntry({ os });
3453
+ const oamProbeResult = await (opts.oamProbe ?? probeOam)();
3454
+ const resolveEntry = opts.resolveOamEntry ?? resolveStableNpmEntry;
3455
+ const oamEntry = oamProbeResult.bin ? resolveEntry("@yawlabs/mcp") : null;
3456
+ const newEntry = buildLaunchEntry({ os, oamBin: oamProbeResult.bin, oamEntry });
3457
+ if (oamProbeResult.bin && oamEntry) {
3458
+ log2(`Runtime: will run on oam ${oamProbeResult.version ?? ""}`.trimEnd());
3459
+ } else if (oamProbeResult.bin) {
3460
+ log2("Runtime: node (oam found, but yaw-mcp is not durably installed -- `npm i -g @yawlabs/mcp` to host it on oam)");
3461
+ }
3101
3462
  const containerPath = resolved.containerPath;
3102
3463
  let existing = {};
3103
3464
  let existingHasEntry = false;
3104
3465
  let legacyEntry = null;
3105
- if (existsSync4(resolved.absolute)) {
3466
+ if (existsSync5(resolved.absolute)) {
3106
3467
  let raw;
3107
3468
  try {
3108
3469
  raw = await readFile7(resolved.absolute, "utf8");
@@ -3158,10 +3519,16 @@ ${USAGE}`);
3158
3519
  }
3159
3520
  log2(`Overwriting existing "${ENTRY_NAME}" entry.`);
3160
3521
  }
3161
- const merged = mergeClientConfig(existing, containerPath, newEntry);
3522
+ const previousEntry = readEntryAt(existing, containerPath, ENTRY_NAME);
3523
+ const previousEnv = previousEntry?.env;
3524
+ const entryToWrite = newEntry.env === void 0 && previousEnv && Object.keys(previousEnv).length > 0 ? { ...newEntry, env: previousEnv } : newEntry;
3525
+ if (entryToWrite !== newEntry) {
3526
+ log2(`Kept existing env on the ${ENTRY_NAME} entry: ${Object.keys(previousEnv ?? {}).join(", ")}`);
3527
+ }
3528
+ const merged = mergeClientConfig(existing, containerPath, entryToWrite);
3162
3529
  const clientJson = `${JSON.stringify(merged, null, 2)}
3163
3530
  `;
3164
- const home = opts.home ?? homedir8();
3531
+ const home = opts.home ?? homedir10();
3165
3532
  const settingsPatch = opts.clientId === "claude-code" ? await prepareClaudeCodeSettingsPatch({
3166
3533
  scope,
3167
3534
  home,
@@ -3229,7 +3596,7 @@ async function prepareClaudeCodeSettingsPatch(opts) {
3229
3596
  });
3230
3597
  if (!path7) return null;
3231
3598
  let existing = {};
3232
- if (existsSync4(path7)) {
3599
+ if (existsSync5(path7)) {
3233
3600
  try {
3234
3601
  const raw = await readFile7(path7, "utf8");
3235
3602
  if (raw.trim().length > 0) {
@@ -3291,6 +3658,17 @@ function readNested(root, containerPath) {
3291
3658
  }
3292
3659
  return cur;
3293
3660
  }
3661
+ function readEntryAt(existing, containerPath, entryName = ENTRY_NAME) {
3662
+ let node = existing;
3663
+ for (const key of containerPath) {
3664
+ if (typeof node !== "object" || node === null || Array.isArray(node)) return null;
3665
+ node = node[key];
3666
+ }
3667
+ if (typeof node !== "object" || node === null || Array.isArray(node)) return null;
3668
+ const entry = node[entryName];
3669
+ if (typeof entry !== "object" || entry === null || Array.isArray(entry)) return null;
3670
+ return entry;
3671
+ }
3294
3672
  function mergeClientConfig(existing, containerPath, entry, entryName = ENTRY_NAME) {
3295
3673
  if (containerPath.length === 0) throw new Error("mergeClientConfig: containerPath cannot be empty");
3296
3674
  const out = { ...existing };
@@ -3404,7 +3782,7 @@ async function runInstallList(opts, log2) {
3404
3782
  messages.push(s);
3405
3783
  log2(s);
3406
3784
  };
3407
- const home = opts.home ?? homedir8();
3785
+ const home = opts.home ?? homedir10();
3408
3786
  const cwd = opts.cwd ?? process.cwd();
3409
3787
  const os = opts.os ?? CURRENT_OS;
3410
3788
  const probes = await probeClientsAsync({ home, os, cwd, claudeConfigDir: opts.claudeConfigDir });
@@ -3692,11 +4070,11 @@ function parseDurationMs(s) {
3692
4070
  const factor = unit === "s" ? 1e3 : unit === "m" ? 6e4 : unit === "h" ? 36e5 : 864e5;
3693
4071
  return n * factor;
3694
4072
  }
3695
- function trialsDir(home = homedir9()) {
3696
- return join8(home, CONFIG_DIRNAME, TRIALS_DIRNAME);
4073
+ function trialsDir(home = homedir11()) {
4074
+ return join9(home, CONFIG_DIRNAME, TRIALS_DIRNAME);
3697
4075
  }
3698
- function trialMarkerPath(slug, home = homedir9()) {
3699
- return join8(trialsDir(home), `${slug}.json`);
4076
+ function trialMarkerPath(slug, home = homedir11()) {
4077
+ return join9(trialsDir(home), `${slug}.json`);
3700
4078
  }
3701
4079
  async function defaultFetchExplore(_baseUrl, slug) {
3702
4080
  const resolved = await resolveCatalogSlug(slug, { catalogUrl: process.env.YAW_MCP_CATALOG_URL });
@@ -3745,7 +4123,7 @@ async function runTry(opts) {
3745
4123
  return { exitCode: 2, written: [] };
3746
4124
  }
3747
4125
  const env = opts.env ?? process.env;
3748
- const home = opts.home ?? homedir9();
4126
+ const home = opts.home ?? homedir11();
3749
4127
  const cwd = opts.cwd ?? process.cwd();
3750
4128
  const os = opts.os ?? CURRENT_OS;
3751
4129
  const now = opts.now ? opts.now() : Date.now();
@@ -3823,7 +4201,7 @@ async function runTry(opts) {
3823
4201
  entryName,
3824
4202
  createdAt: now
3825
4203
  };
3826
- const clientPreExisted = existsSync5(resolved.absolute);
4204
+ const clientPreExisted = existsSync6(resolved.absolute);
3827
4205
  let rawClient = null;
3828
4206
  if (clientPreExisted) {
3829
4207
  try {
@@ -3925,10 +4303,10 @@ async function runTryCleanup(opts) {
3925
4303
  return { exitCode: 2, written: [] };
3926
4304
  }
3927
4305
  const env = opts.env ?? process.env;
3928
- const home = opts.home ?? homedir9();
4306
+ const home = opts.home ?? homedir11();
3929
4307
  const baseUrl = opts.baseUrl ?? env.YAW_MCP_BASE_URL ?? DEFAULT_BASE_URL;
3930
4308
  const markerPath = trialMarkerPath(slug, home);
3931
- if (!existsSync5(markerPath)) {
4309
+ if (!existsSync6(markerPath)) {
3932
4310
  print(`yaw-mcp try-cleanup: no trial marker for "${slug}" (nothing to do).`);
3933
4311
  return { exitCode: 0, written: [] };
3934
4312
  }
@@ -3945,7 +4323,7 @@ async function runTryCleanup(opts) {
3945
4323
  return { exitCode: 1, written: [] };
3946
4324
  }
3947
4325
  const written = [];
3948
- if (existsSync5(marker.clientPath)) {
4326
+ if (existsSync6(marker.clientPath)) {
3949
4327
  try {
3950
4328
  const raw = await readFile8(marker.clientPath, "utf8");
3951
4329
  if (raw.trim().length > 0) {
@@ -3986,11 +4364,11 @@ function formatTtl(ms) {
3986
4364
  return `${Math.round(clamped / 864e5)}d`;
3987
4365
  }
3988
4366
  async function scanTrials(opts = {}) {
3989
- const home = opts.home ?? homedir9();
4367
+ const home = opts.home ?? homedir11();
3990
4368
  const now = opts.now ? opts.now() : Date.now();
3991
4369
  const dir = trialsDir(home);
3992
4370
  const result = { live: [], expired: [], malformed: [] };
3993
- if (!existsSync5(dir)) return result;
4371
+ if (!existsSync6(dir)) return result;
3994
4372
  let entries;
3995
4373
  try {
3996
4374
  entries = await readdir(dir);
@@ -3999,7 +4377,7 @@ async function scanTrials(opts = {}) {
3999
4377
  }
4000
4378
  for (const filename of entries) {
4001
4379
  if (!filename.endsWith(".json")) continue;
4002
- const path7 = join8(dir, filename);
4380
+ const path7 = join9(dir, filename);
4003
4381
  try {
4004
4382
  const raw = await readFile8(path7, "utf8");
4005
4383
  const parsed = JSON.parse(raw);
@@ -4019,7 +4397,7 @@ async function scanTrials(opts = {}) {
4019
4397
  return result;
4020
4398
  }
4021
4399
  async function gcExpiredTrials(opts) {
4022
- const home = opts.home ?? homedir9();
4400
+ const home = opts.home ?? homedir11();
4023
4401
  const env = opts.env ?? process.env;
4024
4402
  const baseUrl = opts.baseUrl ?? env.YAW_MCP_BASE_URL ?? DEFAULT_BASE_URL;
4025
4403
  const postEvent = opts.postEvent ?? defaultPostEvent;
@@ -4029,7 +4407,7 @@ async function gcExpiredTrials(opts) {
4029
4407
  let failed = 0;
4030
4408
  for (const { marker, path: path7 } of scan.expired) {
4031
4409
  try {
4032
- if (existsSync5(marker.clientPath)) {
4410
+ if (existsSync6(marker.clientPath)) {
4033
4411
  const raw = await readFile8(marker.clientPath, "utf8");
4034
4412
  if (raw.trim().length > 0) {
4035
4413
  const parsed = parseJsonc(raw);
@@ -4057,7 +4435,7 @@ async function gcExpiredTrials(opts) {
4057
4435
  }
4058
4436
 
4059
4437
  // src/upgrade-cmd.ts
4060
- import { spawn as spawn3 } from "child_process";
4438
+ import { spawn as spawn4 } from "child_process";
4061
4439
  import { realpathSync } from "fs";
4062
4440
  var BINARY_DOWNLOAD_URL = "https://github.com/YawLabs/mcp/releases/latest";
4063
4441
  var UPGRADE_USAGE = `Usage: yaw-mcp upgrade [--run] [--json]
@@ -4106,7 +4484,7 @@ function localInstallRoot(argvPath) {
4106
4484
  async function defaultNpmPrefix() {
4107
4485
  if (process.env.VITEST) return null;
4108
4486
  return new Promise((resolve8) => {
4109
- const child = spawn3("npm", ["prefix", "-g"], {
4487
+ const child = spawn4("npm", ["prefix", "-g"], {
4110
4488
  shell: process.platform === "win32",
4111
4489
  stdio: ["ignore", "pipe", "ignore"]
4112
4490
  });
@@ -4244,7 +4622,7 @@ async function defaultFetchLatest() {
4244
4622
  }
4245
4623
  async function defaultSpawn(cmd, args, cwd) {
4246
4624
  return new Promise((resolve8) => {
4247
- const child = spawn3(cmd, args, { stdio: "inherit", shell: process.platform === "win32", cwd });
4625
+ const child = spawn4(cmd, args, { stdio: "inherit", shell: process.platform === "win32", cwd });
4248
4626
  child.on("close", (code) => resolve8(typeof code === "number" ? code : 1));
4249
4627
  child.on("error", () => resolve8(1));
4250
4628
  });
@@ -4375,7 +4753,7 @@ async function runUpgrade(opts = {}) {
4375
4753
  return { exitCode: 3, lines };
4376
4754
  }
4377
4755
  function readCurrentVersion() {
4378
- return true ? "0.74.0" : "dev";
4756
+ return true ? "0.74.1" : "dev";
4379
4757
  }
4380
4758
 
4381
4759
  // src/learning.ts
@@ -4592,7 +4970,7 @@ async function projectTrustWarning(opts) {
4592
4970
  }
4593
4971
  return untrustedProjectWarning(probe, { detail: true });
4594
4972
  }
4595
- var VERSION = true ? "0.74.0" : "dev";
4973
+ var VERSION = true ? "0.74.1" : "dev";
4596
4974
  function isPersistenceDisabled(env) {
4597
4975
  const raw = env.YAW_MCP_DISABLE_PERSISTENCE;
4598
4976
  return raw !== void 0 && raw !== "" && (raw === "1" || raw.toLowerCase() === "true");
@@ -4607,7 +4985,7 @@ async function runDoctor(opts = {}) {
4607
4985
  `);
4608
4986
  };
4609
4987
  const cwd = opts.cwd ?? process.cwd();
4610
- const home = opts.home ?? homedir10();
4988
+ const home = opts.home ?? homedir12();
4611
4989
  const os = opts.os ?? CURRENT_OS;
4612
4990
  const env = opts.env ?? process.env;
4613
4991
  print(`yaw-mcp doctor \u2014 ${(/* @__PURE__ */ new Date()).toISOString()}`);
@@ -4632,7 +5010,7 @@ async function runDoctor(opts = {}) {
4632
5010
  const oamStatus = await collectOamRuntimeStatus({ env, cwd, home, probeFn: opts.oamProbe ?? probeOam });
4633
5011
  renderOamRuntimeSection({ status: oamStatus, print });
4634
5012
  const persistenceDisabled = isPersistenceDisabled(env);
4635
- const stateFilePath = join9(userConfigDir(home), STATE_FILENAME);
5013
+ const stateFilePath = join10(userConfigDir(home), STATE_FILENAME);
4636
5014
  const statePeek = persistenceDisabled ? null : await peekStateFile(stateFilePath);
4637
5015
  const persistedState = statePeek?.kind === "ok" ? await loadState(stateFilePath) : null;
4638
5016
  renderStateSection({
@@ -4723,7 +5101,7 @@ async function runDoctorJson(opts) {
4723
5101
  const lines = [];
4724
5102
  const write = opts.out ?? ((s) => process.stdout.write(s));
4725
5103
  const cwd = opts.cwd ?? process.cwd();
4726
- const home = opts.home ?? homedir10();
5104
+ const home = opts.home ?? homedir12();
4727
5105
  const os = opts.os ?? CURRENT_OS;
4728
5106
  const env = opts.env ?? process.env;
4729
5107
  const timestamp = (/* @__PURE__ */ new Date()).toISOString();
@@ -4748,7 +5126,7 @@ async function runDoctorJson(opts) {
4748
5126
  envOverrides[name] = raw === void 0 || raw === "" ? null : raw;
4749
5127
  }
4750
5128
  const persistDisabled = isPersistenceDisabled(env);
4751
- const stateFilePath = join9(userConfigDir(home), STATE_FILENAME);
5129
+ const stateFilePath = join10(userConfigDir(home), STATE_FILENAME);
4752
5130
  const statePeek = persistDisabled ? null : await peekStateFile(stateFilePath);
4753
5131
  const stateUsable = statePeek !== null && (statePeek.kind === "ok" || statePeek.kind === "missing");
4754
5132
  const persisted = stateUsable ? await loadState(stateFilePath) : null;
@@ -4898,7 +5276,7 @@ function renderEnvSection(opts) {
4898
5276
  { name: "YAW_MCP_AUTO_LOAD", defaultHint: "auto-load inactive" },
4899
5277
  { name: "YAW_MCP_AUTO_ACTIVATE", defaultHint: "default on" },
4900
5278
  { name: "YAW_MCP_PRUNE_RESPONSES", defaultHint: "pruning active" },
4901
- { name: "YAW_MCP_DEFAULT_RUNTIME", defaultHint: "per-server opt-in only" }
5279
+ { name: "YAW_MCP_DEFAULT_RUNTIME", defaultHint: "oam when installed" }
4902
5280
  ];
4903
5281
  const widest = vars.reduce((m, v) => Math.max(m, v.name.length), 0);
4904
5282
  print("ENVIRONMENT (behavior overrides)");
@@ -4917,7 +5295,13 @@ async function collectOamRuntimeStatus(opts) {
4917
5295
  namespace: s.namespace,
4918
5296
  info: describeServerRuntime(s, dflt.runtime, probe)
4919
5297
  }));
4920
- return { probe, dflt, servers };
5298
+ const specs = collectSidecarSpecs(bundles?.config?.servers ?? []);
5299
+ const anyManaged = hasManagedSidecars(opts.home);
5300
+ const managed = {
5301
+ root: sidecarsRoot(opts.home),
5302
+ packages: specs.map((s) => ({ pkg: s.pkg, version: anyManaged ? installedVersion(s.pkg, opts.home) : null }))
5303
+ };
5304
+ return { probe, dflt, servers, managed };
4921
5305
  }
4922
5306
  function renderOamRuntimeSection(opts) {
4923
5307
  const { status, print } = opts;
@@ -4925,12 +5309,16 @@ function renderOamRuntimeSection(opts) {
4925
5309
  print("OAM RUNTIME");
4926
5310
  if (probe.belowMin) {
4927
5311
  print(` binary: installed (v${probe.version}) \u2014 below min ${MIN_OAM_VERSION}; IGNORED, servers run on node`);
5312
+ print(" fix: oam self-update");
4928
5313
  } else if (probe.bin === null) {
4929
5314
  print(" binary: not installed \u2014 node/npx spawns are used directly");
4930
5315
  } else {
4931
5316
  print(` binary: ${probe.bin} (v${probe.version ?? "unknown"}, min ${MIN_OAM_VERSION})`);
4932
5317
  }
4933
- const dfltLabel = dflt.runtime !== null ? `${dflt.runtime} (${dflt.source === "env" ? "env YAW_MCP_DEFAULT_RUNTIME" : `bundles.json defaultRuntime @ ${dflt.path}`})` : '(not set \u2014 per-server runtime:"oam" opt-in only)';
5318
+ const rawOamVersion = process.versions.oam;
5319
+ const runningOam = typeof rawOamVersion === "string" && rawOamVersion.length > 0 ? rawOamVersion : null;
5320
+ print(` this process: ${runningOam ? `oam ${runningOam}` : `node ${process.version}`}`);
5321
+ const dfltLabel = dflt.runtime !== null ? `${dflt.runtime} (${dflt.source === "env" ? "env YAW_MCP_DEFAULT_RUNTIME" : `bundles.json defaultRuntime @ ${dflt.path}`})` : `(not set \u2014 oam when installed, currently ${probe.bin !== null ? "oam" : "node"})`;
4934
5322
  print(` default runtime: ${dfltLabel}`);
4935
5323
  if (servers.length > 0) {
4936
5324
  print(" servers (local bundles.json):");
@@ -4939,6 +5327,17 @@ function renderOamRuntimeSection(opts) {
4939
5327
  print(` ${s.namespace.padEnd(widest)} ${(s.info.runtime ?? "-").padEnd(4)} ${s.info.reason}`);
4940
5328
  }
4941
5329
  }
5330
+ const { managed } = status;
5331
+ if (managed.packages.length > 0) {
5332
+ const anyInstalled = managed.packages.some((p) => p.version !== null);
5333
+ print(` managed install: ${anyInstalled ? managed.root : "none \u2014 run `yaw-mcp sidecars install`"}`);
5334
+ if (anyInstalled) {
5335
+ const widest = managed.packages.reduce((m, p) => Math.max(m, p.pkg.length), 0);
5336
+ for (const p of managed.packages) {
5337
+ print(` ${p.pkg.padEnd(widest)} ${p.version ?? "not installed \u2014 resolves from the npx cache"}`);
5338
+ }
5339
+ }
5340
+ }
4942
5341
  print("");
4943
5342
  }
4944
5343
  function renderProjectGuideSection(opts) {
@@ -5070,14 +5469,26 @@ function renderClientStatus(c, installCmd) {
5070
5469
  if (c.hasMcpEntry && c.hasLegacyEntry) {
5071
5470
  return `OK \u2014 has "${ENTRY_NAME}" entry; legacy "${c.legacyEntryName}" entry also present \u2014 remove it to avoid running yaw-mcp twice`;
5072
5471
  }
5073
- if (c.hasMcpEntry) return `OK \u2014 has "${ENTRY_NAME}" entry`;
5472
+ if (c.launchCommandMissing) {
5473
+ return `has "${ENTRY_NAME}" entry, but its launch command does not exist: ${c.launchCommandMissing} \u2014 the client cannot start yaw-mcp; rerun \`${installCmd}\``;
5474
+ }
5475
+ if (c.hasMcpEntry) {
5476
+ return `OK \u2014 has "${ENTRY_NAME}" entry${c.launchRuntime === "oam" ? " (runs on oam)" : ""}`;
5477
+ }
5074
5478
  if (c.hasLegacyEntry) {
5075
5479
  return `legacy "${c.legacyEntryName}" entry present \u2014 run \`${installCmd}\` to migrate, then remove the legacy entry by hand`;
5076
5480
  }
5077
5481
  if (c.exists) return `present, no "${ENTRY_NAME}" entry \u2014 run \`${installCmd}\``;
5078
5482
  return `not configured \u2014 run \`${installCmd}\``;
5079
5483
  }
5080
- var MALFORMED = { hasMcpEntry: false, hasLegacyEntry: false, legacyEntryName: null, malformed: true };
5484
+ var MALFORMED = {
5485
+ hasMcpEntry: false,
5486
+ hasLegacyEntry: false,
5487
+ legacyEntryName: null,
5488
+ malformed: true,
5489
+ launchCommandMissing: null,
5490
+ launchRuntime: null
5491
+ };
5081
5492
  function* enumerateProbeSlots(opts) {
5082
5493
  for (const target of INSTALL_TARGETS) {
5083
5494
  if (!target.availableOn.includes(opts.os)) {
@@ -5088,6 +5499,8 @@ function* enumerateProbeSlots(opts) {
5088
5499
  path: "(n/a)",
5089
5500
  exists: false,
5090
5501
  hasMcpEntry: false,
5502
+ launchCommandMissing: null,
5503
+ launchRuntime: null,
5091
5504
  hasLegacyEntry: false,
5092
5505
  legacyEntryName: null,
5093
5506
  malformed: false,
@@ -5111,7 +5524,7 @@ function* enumerateProbeSlots(opts) {
5111
5524
  } catch {
5112
5525
  continue;
5113
5526
  }
5114
- const exists3 = existsSync6(resolved.absolute);
5527
+ const exists3 = existsSync7(resolved.absolute);
5115
5528
  yield {
5116
5529
  result: {
5117
5530
  clientId: target.clientId,
@@ -5119,6 +5532,8 @@ function* enumerateProbeSlots(opts) {
5119
5532
  path: resolved.absolute,
5120
5533
  exists: exists3,
5121
5534
  hasMcpEntry: false,
5535
+ launchCommandMissing: null,
5536
+ launchRuntime: null,
5122
5537
  hasLegacyEntry: false,
5123
5538
  legacyEntryName: null,
5124
5539
  malformed: false,
@@ -5134,7 +5549,7 @@ function probeClients(opts) {
5134
5549
  for (const { result, read } of enumerateProbeSlots(opts)) {
5135
5550
  if (read) {
5136
5551
  try {
5137
- Object.assign(result, classifyProbeContent(readFileSync2(read.path, "utf8"), read.containerPath));
5552
+ Object.assign(result, classifyProbeContent(readFileSync3(read.path, "utf8"), read.containerPath));
5138
5553
  } catch {
5139
5554
  Object.assign(result, MALFORMED);
5140
5555
  }
@@ -5152,28 +5567,69 @@ function walkContainer(root, path7) {
5152
5567
  if (typeof cur !== "object" || cur === null || Array.isArray(cur)) return null;
5153
5568
  return cur;
5154
5569
  }
5155
- function classifyProbeContent(raw, containerPath) {
5570
+ function classifyProbeContent(raw, containerPath, exists3 = existsSync7) {
5156
5571
  if (raw.trim().length === 0) {
5157
- return { hasMcpEntry: false, hasLegacyEntry: false, legacyEntryName: null, malformed: false };
5572
+ return {
5573
+ hasMcpEntry: false,
5574
+ hasLegacyEntry: false,
5575
+ legacyEntryName: null,
5576
+ malformed: false,
5577
+ launchCommandMissing: null,
5578
+ launchRuntime: null
5579
+ };
5158
5580
  }
5159
5581
  try {
5160
5582
  const parsed = parseJsonc(raw);
5161
5583
  if (typeof parsed !== "object" || parsed === null || Array.isArray(parsed)) {
5162
- return { hasMcpEntry: false, hasLegacyEntry: false, legacyEntryName: null, malformed: true };
5584
+ return {
5585
+ hasMcpEntry: false,
5586
+ hasLegacyEntry: false,
5587
+ legacyEntryName: null,
5588
+ malformed: true,
5589
+ launchCommandMissing: null,
5590
+ launchRuntime: null
5591
+ };
5163
5592
  }
5164
5593
  const container = walkContainer(parsed, containerPath);
5165
5594
  if (!container) {
5166
- return { hasMcpEntry: false, hasLegacyEntry: false, legacyEntryName: null, malformed: false };
5595
+ return {
5596
+ hasMcpEntry: false,
5597
+ hasLegacyEntry: false,
5598
+ legacyEntryName: null,
5599
+ malformed: false,
5600
+ launchCommandMissing: null,
5601
+ launchRuntime: null
5602
+ };
5167
5603
  }
5168
5604
  const legacyEntryName = findLegacyEntry(container);
5605
+ const entry = container[ENTRY_NAME];
5606
+ let launchCommandMissing = null;
5607
+ let launchRuntime = null;
5608
+ if (typeof entry === "object" && entry !== null && !Array.isArray(entry)) {
5609
+ const command = entry.command;
5610
+ if (typeof command === "string") {
5611
+ if (isAbsolute4(command) && !exists3(command)) launchCommandMissing = command;
5612
+ const entryArgs = entry.args;
5613
+ launchRuntime = isOamLaunch(command, Array.isArray(entryArgs) ? entryArgs : []) ? "oam" : "node";
5614
+ }
5615
+ }
5169
5616
  return {
5170
5617
  hasMcpEntry: ENTRY_NAME in container,
5171
5618
  hasLegacyEntry: legacyEntryName !== null,
5172
5619
  legacyEntryName,
5173
- malformed: false
5620
+ malformed: false,
5621
+ launchCommandMissing,
5622
+ launchRuntime
5174
5623
  };
5175
5624
  } catch {
5176
- return { hasMcpEntry: false, hasLegacyEntry: false, legacyEntryName: null, malformed: true };
5625
+ return {
5626
+ hasMcpEntry: false,
5627
+ hasLegacyEntry: false,
5628
+ legacyEntryName: null,
5629
+ malformed: true,
5630
+ launchCommandMissing: null,
5631
+ launchRuntime: null
5632
+ };
5177
5633
  }
5178
5634
  }
5179
5635
  async function probeClientsAsync(opts) {
@@ -5239,9 +5695,9 @@ function scanShellHistoryForShadows(opts) {
5239
5695
  }
5240
5696
  function shellHistorySources(opts) {
5241
5697
  const sources = [];
5242
- sources.push({ path: join9(opts.home, ".bash_history"), extractCommand: (l) => l.trim() || null });
5698
+ sources.push({ path: join10(opts.home, ".bash_history"), extractCommand: (l) => l.trim() || null });
5243
5699
  sources.push({
5244
- path: join9(opts.home, ".zsh_history"),
5700
+ path: join10(opts.home, ".zsh_history"),
5245
5701
  // Zsh extended-history lines look like `: 1700000000:0;npm audit`.
5246
5702
  // Strip the metadata prefix so we get just the command.
5247
5703
  extractCommand: (l) => {
@@ -5257,7 +5713,7 @@ function shellHistorySources(opts) {
5257
5713
  const appData = opts.env.APPDATA;
5258
5714
  if (appData) {
5259
5715
  sources.push({
5260
- path: join9(appData, "Microsoft", "Windows", "PowerShell", "PSReadLine", "ConsoleHost_history.txt"),
5716
+ path: join10(appData, "Microsoft", "Windows", "PowerShell", "PSReadLine", "ConsoleHost_history.txt"),
5261
5717
  extractCommand: (l) => l.trim() || null
5262
5718
  });
5263
5719
  }
@@ -5265,7 +5721,7 @@ function shellHistorySources(opts) {
5265
5721
  }
5266
5722
  function readTailLines(path7, n) {
5267
5723
  try {
5268
- const raw = readFileSync2(path7, "utf8");
5724
+ const raw = readFileSync3(path7, "utf8");
5269
5725
  const all = raw.split(/\r?\n/);
5270
5726
  return all.length <= n ? all : all.slice(all.length - n);
5271
5727
  } catch {
@@ -5310,13 +5766,13 @@ function compareSemver(a, b) {
5310
5766
  }
5311
5767
 
5312
5768
  // src/foundry-cmd.ts
5313
- import { mkdirSync, readFileSync as readFileSync4, writeFileSync } from "fs";
5314
- import { homedir as homedir12 } from "os";
5769
+ import { mkdirSync as mkdirSync2, readFileSync as readFileSync5, writeFileSync } from "fs";
5770
+ import { homedir as homedir14 } from "os";
5315
5771
  import path5 from "path";
5316
5772
 
5317
5773
  // src/foundry.ts
5318
5774
  import { appendFile, mkdir as mkdir4, stat as stat3 } from "fs/promises";
5319
- import { homedir as homedir11 } from "os";
5775
+ import { homedir as homedir13 } from "os";
5320
5776
  import path4 from "path";
5321
5777
 
5322
5778
  // src/relevance.ts
@@ -5540,7 +5996,7 @@ function isFoundryEnabled() {
5540
5996
  }
5541
5997
  var MAX_FOUNDRY_BYTES = 5 * 1024 * 1024;
5542
5998
  var FOUNDRY_FILENAME = "foundry.jsonl";
5543
- async function appendFoundryTrace(trace, home = homedir11()) {
5999
+ async function appendFoundryTrace(trace, home = homedir13()) {
5544
6000
  try {
5545
6001
  if (!isFoundryEnabled()) return;
5546
6002
  const dir = userConfigDir(home);
@@ -5565,7 +6021,7 @@ async function appendFoundryTrace(trace, home = homedir11()) {
5565
6021
  }
5566
6022
 
5567
6023
  // src/foundry-corpus.ts
5568
- import { readFileSync as readFileSync3 } from "fs";
6024
+ import { readFileSync as readFileSync4 } from "fs";
5569
6025
  var FOUNDRY_CORPUS_VERSION = 1;
5570
6026
  var DEFAULT_CORPUS_CAP = 500;
5571
6027
  function parseTraceLines(text) {
@@ -5724,11 +6180,11 @@ async function runFoundryExport(opts) {
5724
6180
  writeErr(`${s}
5725
6181
  `);
5726
6182
  };
5727
- const home = opts.home ?? homedir12();
6183
+ const home = opts.home ?? homedir14();
5728
6184
  const harvestPath = path5.join(userConfigDir(home), FOUNDRY_FILENAME);
5729
6185
  const blob = opts.readTraces ? opts.readTraces() : (() => {
5730
6186
  try {
5731
- return readFileSync4(harvestPath, "utf8");
6187
+ return readFileSync5(harvestPath, "utf8");
5732
6188
  } catch {
5733
6189
  return null;
5734
6190
  }
@@ -5750,7 +6206,7 @@ async function runFoundryExport(opts) {
5750
6206
  );
5751
6207
  return { exitCode: 2, lines };
5752
6208
  }
5753
- mkdirSync(path5.dirname(path5.resolve(opts.out)), { recursive: true });
6209
+ mkdirSync2(path5.dirname(path5.resolve(opts.out)), { recursive: true });
5754
6210
  writeFileSync(opts.out, `${JSON.stringify(corpus, null, 2)}
5755
6211
  `, "utf8");
5756
6212
  const score = scoreCorpus(corpus);
@@ -5780,13 +6236,13 @@ async function runFoundryExport(opts) {
5780
6236
 
5781
6237
  // src/local-add-cmd.ts
5782
6238
  import { readFile as readFile11 } from "fs/promises";
5783
- import { homedir as homedir14 } from "os";
6239
+ import { homedir as homedir16 } from "os";
5784
6240
  import { createInterface as createInterface3 } from "readline/promises";
5785
6241
 
5786
6242
  // src/trust-cmd.ts
5787
6243
  import { readFile as readFile10 } from "fs/promises";
5788
- import { homedir as homedir13 } from "os";
5789
- import { isAbsolute as isAbsolute4, resolve as resolve7 } from "path";
6244
+ import { homedir as homedir15 } from "os";
6245
+ import { isAbsolute as isAbsolute5, resolve as resolve7 } from "path";
5790
6246
  import { createInterface as createInterface2 } from "readline/promises";
5791
6247
  var TRUST_USAGE = `Usage: yaw-mcp trust [--yes]
5792
6248
  yaw-mcp trust --list [--json]
@@ -5886,7 +6342,7 @@ async function runTrustGrant(opts) {
5886
6342
  `);
5887
6343
  const printErr = (s) => err(`${s}
5888
6344
  `);
5889
- const home = opts.home ?? homedir13();
6345
+ const home = opts.home ?? homedir15();
5890
6346
  const cwd = opts.cwd ?? process.cwd();
5891
6347
  const env = opts.env ?? process.env;
5892
6348
  const probe = await probeProjectTrust({ cwd, home, env });
@@ -6023,7 +6479,7 @@ function displayArg(s) {
6023
6479
  var SCRIPT_EXT_RE = /\.(?:js|mjs|cjs|ts|mts|cts|py|rb|sh|bash|zsh|pl|php|lua|jar|bat|cmd|ps1|exe)$/i;
6024
6480
  function inRepoTokens(s) {
6025
6481
  const hits = [];
6026
- const isLocalish = (t) => t.length > 0 && !/\s/.test(t) && !isAbsolute4(t) && !t.includes("://") && !t.startsWith("-");
6482
+ const isLocalish = (t) => t.length > 0 && !/\s/.test(t) && !isAbsolute5(t) && !t.includes("://") && !t.startsWith("-");
6027
6483
  const command = s.command ?? "";
6028
6484
  if (isLocalish(command) && (/^\.{1,2}[\\/]/.test(command) || /[\\/]/.test(command))) hits.push(command);
6029
6485
  for (const a of s.args ?? []) {
@@ -6070,7 +6526,7 @@ function unversionedRegistrySpec(s) {
6070
6526
  break;
6071
6527
  }
6072
6528
  if (spec === null || spec.length === 0) return null;
6073
- if (spec.includes("://") || isAbsolute4(spec) || /^\.{1,2}[\\/]/.test(spec)) return null;
6529
+ if (spec.includes("://") || isAbsolute5(spec) || /^\.{1,2}[\\/]/.test(spec)) return null;
6074
6530
  const body = spec.startsWith("@") ? spec.slice(1) : spec;
6075
6531
  const afterScope = body.includes("/") ? body.slice(body.indexOf("/") + 1) : body;
6076
6532
  if (afterScope.includes("@") || afterScope.includes("==")) return null;
@@ -6098,7 +6554,7 @@ async function runTrustList(opts) {
6098
6554
  const err = opts.err ?? ((s) => process.stderr.write(s));
6099
6555
  const print = (s = "") => out(`${s}
6100
6556
  `);
6101
- const home = opts.home ?? homedir13();
6557
+ const home = opts.home ?? homedir15();
6102
6558
  const store = await readTrustStore(home);
6103
6559
  if (store.malformed) {
6104
6560
  const fix = store.malformedKind === "io" ? "fix its permissions (do NOT delete it -- your approvals are still in there)" : "it is fixed or deleted";
@@ -6167,7 +6623,7 @@ async function runTrustRevoke(opts) {
6167
6623
  `);
6168
6624
  const printErr = (s) => err(`${s}
6169
6625
  `);
6170
- const home = opts.home ?? homedir13();
6626
+ const home = opts.home ?? homedir15();
6171
6627
  const cwd = opts.cwd ?? process.cwd();
6172
6628
  const env = opts.env ?? process.env;
6173
6629
  let target;
@@ -6306,7 +6762,7 @@ async function runAdd(opts) {
6306
6762
  return { exitCode: 2, written: [] };
6307
6763
  }
6308
6764
  const env = opts.env ?? process.env;
6309
- const home = opts.home ?? homedir14();
6765
+ const home = opts.home ?? homedir16();
6310
6766
  const cwd = opts.cwd ?? process.cwd();
6311
6767
  let server;
6312
6768
  try {
@@ -6502,7 +6958,7 @@ async function runRemove(opts) {
6502
6958
  printErr(`yaw-mcp remove: "${opts.target}" isn't a valid slug or namespace.`);
6503
6959
  return { exitCode: 2, written: [] };
6504
6960
  }
6505
- const home = opts.home ?? homedir14();
6961
+ const home = opts.home ?? homedir16();
6506
6962
  const cwd = opts.cwd ?? process.cwd();
6507
6963
  const derived = deriveNamespace(opts.target);
6508
6964
  const candidates = derived === opts.target ? [opts.target] : [opts.target, derived];
@@ -6582,7 +7038,7 @@ async function runList(opts) {
6582
7038
  `);
6583
7039
  const printErr = (s) => err(`${s}
6584
7040
  `);
6585
- const home = opts.home ?? homedir14();
7041
+ const home = opts.home ?? homedir16();
6586
7042
  const cwd = opts.cwd ?? process.cwd();
6587
7043
  const loaded = await loadLocalBundles({ home, cwd });
6588
7044
  const servers = loaded.config?.servers ?? [];
@@ -6624,8 +7080,8 @@ ${servers.length} server${servers.length === 1 ? "" : "s"} in ${loaded.path}`);
6624
7080
 
6625
7081
  // src/reset-learning-cmd.ts
6626
7082
  import { readFile as readFile12, unlink as unlink3 } from "fs/promises";
6627
- import { homedir as homedir15 } from "os";
6628
- import { join as join10 } from "path";
7083
+ import { homedir as homedir17 } from "os";
7084
+ import { join as join11 } from "path";
6629
7085
  var RESET_LEARNING_USAGE = `Usage: yaw-mcp reset-learning
6630
7086
 
6631
7087
  Delete ~/.yaw-mcp/state.json so cross-session learning starts fresh.
@@ -6646,7 +7102,7 @@ ${RESET_LEARNING_USAGE}`
6646
7102
  };
6647
7103
  }
6648
7104
  async function runResetLearning(opts = {}) {
6649
- const home = opts.home ?? homedir15();
7105
+ const home = opts.home ?? homedir17();
6650
7106
  const env = opts.env ?? process.env;
6651
7107
  const write = opts.out ?? ((s) => process.stdout.write(s));
6652
7108
  const writeErr = opts.err ?? ((s) => process.stderr.write(s));
@@ -6661,7 +7117,7 @@ async function runResetLearning(opts = {}) {
6661
7117
  writeErr(`${s}
6662
7118
  `);
6663
7119
  };
6664
- const filePath = join10(userConfigDir(home), STATE_FILENAME);
7120
+ const filePath = join11(userConfigDir(home), STATE_FILENAME);
6665
7121
  const raw = env.YAW_MCP_DISABLE_PERSISTENCE;
6666
7122
  const disabled = raw !== void 0 && raw !== "" && (raw === "1" || raw.toLowerCase() === "true");
6667
7123
  if (disabled) {
@@ -6716,20 +7172,20 @@ function isFileNotFound2(err) {
6716
7172
  }
6717
7173
 
6718
7174
  // src/secrets-cmd.ts
6719
- import { existsSync as existsSync8 } from "fs";
6720
- import { homedir as homedir18 } from "os";
7175
+ import { existsSync as existsSync9 } from "fs";
7176
+ import { homedir as homedir20 } from "os";
6721
7177
 
6722
7178
  // src/secrets-audit.ts
6723
- import { existsSync as existsSync7 } from "fs";
7179
+ import { existsSync as existsSync8 } from "fs";
6724
7180
  import { appendFile as appendFile2, chmod as chmod5, readFile as readFile13, stat as stat4 } from "fs/promises";
6725
- import { homedir as homedir16 } from "os";
6726
- import { join as join11 } from "path";
7181
+ import { homedir as homedir18 } from "os";
7182
+ import { join as join12 } from "path";
6727
7183
  var SECRETS_AUDIT_FILENAME = "secrets-audit.log";
6728
7184
  var AUDIT_TAIL_CAP = 5e3;
6729
- function auditLogPath(home = homedir16()) {
6730
- return join11(home, CONFIG_DIRNAME, SECRETS_AUDIT_FILENAME);
7185
+ function auditLogPath(home = homedir18()) {
7186
+ return join12(home, CONFIG_DIRNAME, SECRETS_AUDIT_FILENAME);
6731
7187
  }
6732
- async function appendAuditEvent(input, home = homedir16()) {
7188
+ async function appendAuditEvent(input, home = homedir18()) {
6733
7189
  try {
6734
7190
  const event = {
6735
7191
  ts: (/* @__PURE__ */ new Date()).toISOString(),
@@ -6740,7 +7196,7 @@ async function appendAuditEvent(input, home = homedir16()) {
6740
7196
  const path7 = auditLogPath(home);
6741
7197
  const line = `${JSON.stringify(event)}
6742
7198
  `;
6743
- if (!existsSync7(path7)) {
7199
+ if (!existsSync8(path7)) {
6744
7200
  await atomicWriteFile(path7, line, "utf8", 384, 448);
6745
7201
  } else {
6746
7202
  await appendFile2(path7, line, "utf8");
@@ -6763,9 +7219,9 @@ async function trimToTailCap(path7) {
6763
7219
  await atomicWriteFile(path7, `${kept.join("\n")}
6764
7220
  `, "utf8", 384);
6765
7221
  }
6766
- async function readAuditLog(filter = {}, home = homedir16()) {
7222
+ async function readAuditLog(filter = {}, home = homedir18()) {
6767
7223
  const path7 = auditLogPath(home);
6768
- if (!existsSync7(path7)) return [];
7224
+ if (!existsSync8(path7)) return [];
6769
7225
  let raw;
6770
7226
  try {
6771
7227
  raw = await readFile13(path7, "utf8");
@@ -6797,8 +7253,8 @@ function isAuditEvent(v) {
6797
7253
  // src/secrets-vault.ts
6798
7254
  import { createHmac, randomBytes as randomBytes2, timingSafeEqual } from "crypto";
6799
7255
  import { chmod as chmod6, mkdir as mkdir5, readFile as readFile14 } from "fs/promises";
6800
- import { homedir as homedir17 } from "os";
6801
- import { dirname as dirname2, join as join12 } from "path";
7256
+ import { homedir as homedir19 } from "os";
7257
+ import { dirname as dirname3, join as join13 } from "path";
6802
7258
 
6803
7259
  // src/secrets-crypto.ts
6804
7260
  import { createCipheriv, createDecipheriv, randomBytes, scrypt as scryptCb } from "crypto";
@@ -6855,8 +7311,8 @@ function decryptEntry(entry, key) {
6855
7311
  var SECRETS_FILENAME = "secrets.json";
6856
7312
  var SECRETS_SCHEMA_VERSION = 1;
6857
7313
  var VAULT_CHECK_PLAINTEXT = "yaw-mcp-vault-v1";
6858
- function vaultPath(home = homedir17()) {
6859
- return join12(home, CONFIG_DIRNAME, SECRETS_FILENAME);
7314
+ function vaultPath(home = homedir19()) {
7315
+ return join13(home, CONFIG_DIRNAME, SECRETS_FILENAME);
6860
7316
  }
6861
7317
  function emptyVault() {
6862
7318
  return {
@@ -6917,7 +7373,7 @@ function isEncryptedEntry(v) {
6917
7373
  return typeof e.iv === "string" && typeof e.ciphertext === "string" && typeof e.authTag === "string";
6918
7374
  }
6919
7375
  async function saveVault(path7, vault) {
6920
- const dir = dirname2(path7);
7376
+ const dir = dirname3(path7);
6921
7377
  await mkdir5(dir, { recursive: true });
6922
7378
  if (process.platform !== "win32") {
6923
7379
  try {
@@ -7429,7 +7885,7 @@ async function runSecrets(opts, io = {
7429
7885
  out: (s) => process.stdout.write(s),
7430
7886
  err: (s) => process.stderr.write(s)
7431
7887
  }) {
7432
- const home = opts.home ?? homedir18();
7888
+ const home = opts.home ?? homedir20();
7433
7889
  const path7 = vaultPath(home);
7434
7890
  if (opts.action === "lock") {
7435
7891
  lock();
@@ -7449,7 +7905,7 @@ async function runSecrets(opts, io = {
7449
7905
  if (!loaded2.ok) return loaded2.result;
7450
7906
  const vault2 = loaded2.vault;
7451
7907
  const keys = vault2 ? listKeys(vault2) : [];
7452
- if (opts.json) io.out(`${JSON.stringify({ ok: true, vault: existsSync8(path7), keys }, null, 2)}
7908
+ if (opts.json) io.out(`${JSON.stringify({ ok: true, vault: existsSync9(path7), keys }, null, 2)}
7453
7909
  `);
7454
7910
  else if (!vault2) io.out(`No vault at ${path7}. Run \`yaw-mcp secrets set <name>\` to create one.
7455
7911
  `);
@@ -7502,7 +7958,7 @@ async function runSecrets(opts, io = {
7502
7958
  if (!confirmed) return abortedResult(io, opts.json, "set");
7503
7959
  }
7504
7960
  let vault = loaded.vault ?? newVault();
7505
- const isFresh = !existsSync8(path7);
7961
+ const isFresh = !existsSync9(path7);
7506
7962
  const creatingVault = opts.action === "set" && !vault.check && Object.keys(vault.entries).length === 0;
7507
7963
  const passphrase = await resolvePassphrase(opts, creatingVault);
7508
7964
  if (passphrase === CANCELLED) return cancelledResult(io, opts.json);
@@ -7620,7 +8076,7 @@ async function runSecrets(opts, io = {
7620
8076
  return { exitCode: 2 };
7621
8077
  }
7622
8078
  async function runSecretsRotate(opts, io) {
7623
- const home = opts.home ?? homedir18();
8079
+ const home = opts.home ?? homedir20();
7624
8080
  const path7 = vaultPath(home);
7625
8081
  const loaded = await safeLoadVault(path7, io, opts.json, "rotate");
7626
8082
  if (!loaded.ok) return loaded.result;
@@ -7692,7 +8148,7 @@ async function runSecretsRotate(opts, io) {
7692
8148
  return { exitCode: 0 };
7693
8149
  }
7694
8150
  async function runSecretsAudit(opts, io) {
7695
- const home = opts.home ?? homedir18();
8151
+ const home = opts.home ?? homedir20();
7696
8152
  let events;
7697
8153
  try {
7698
8154
  events = await readAuditLog(
@@ -7727,7 +8183,7 @@ async function runSecretsAudit(opts, io) {
7727
8183
  }
7728
8184
 
7729
8185
  // src/server.ts
7730
- import { homedir as homedir19 } from "os";
8186
+ import { homedir as homedir21 } from "os";
7731
8187
  import { Server } from "@modelcontextprotocol/sdk/server/index.js";
7732
8188
  import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
7733
8189
  import {
@@ -7740,9 +8196,9 @@ import {
7740
8196
  } from "@modelcontextprotocol/sdk/types.js";
7741
8197
 
7742
8198
  // src/auto-upgrade.ts
7743
- import { spawn as spawn4 } from "child_process";
8199
+ import { spawn as spawn5 } from "child_process";
7744
8200
  import { realpathSync as realpathSync2 } from "fs";
7745
- import { dirname as dirname3, sep as sep2 } from "path";
8201
+ import { dirname as dirname4, sep as sep2 } from "path";
7746
8202
  function quoteShellArgIfNeeded(arg, platform = process.platform) {
7747
8203
  if (platform !== "win32") return arg;
7748
8204
  if (/[\r\n\0"%]/.test(arg)) return null;
@@ -7757,7 +8213,7 @@ function detectRunningInstallPrefix(argvPath) {
7757
8213
  } catch {
7758
8214
  return null;
7759
8215
  }
7760
- let dir = dirname3(resolved);
8216
+ let dir = dirname4(resolved);
7761
8217
  let prev = "";
7762
8218
  let safety = 24;
7763
8219
  while (dir !== prev && safety-- > 0) {
@@ -7768,13 +8224,13 @@ function detectRunningInstallPrefix(argvPath) {
7768
8224
  return candidate;
7769
8225
  }
7770
8226
  prev = dir;
7771
- dir = dirname3(dir);
8227
+ dir = dirname4(dir);
7772
8228
  }
7773
8229
  return null;
7774
8230
  }
7775
8231
  async function compareWithNpmPrefix(detected) {
7776
8232
  await new Promise((res) => {
7777
- const child = spawn4("npm", ["prefix", "-g"], {
8233
+ const child = spawn5("npm", ["prefix", "-g"], {
7778
8234
  stdio: ["ignore", "pipe", "ignore"],
7779
8235
  shell: process.platform === "win32"
7780
8236
  });
@@ -7818,7 +8274,7 @@ async function fetchLatestVersion2() {
7818
8274
  function defaultSpawn2(cmd, args) {
7819
8275
  let errorFired = false;
7820
8276
  const correctiveCmd = cmd === "npm" ? "npm install -g @yawlabs/mcp@latest" : cmd === "pnpm" ? "pnpm add -g @yawlabs/mcp@latest" : "bun add -g @yawlabs/mcp@latest";
7821
- const child = spawn4(cmd, args, {
8277
+ const child = spawn5(cmd, args, {
7822
8278
  stdio: "ignore",
7823
8279
  // Stay a child of this process (not detached) so it dies with yaw-mcp
7824
8280
  // if yaw-mcp exits mid-install -- a half-finished install is fine
@@ -7847,7 +8303,7 @@ function defaultSpawn2(cmd, args) {
7847
8303
  async function maybeAutoUpgrade(deps = {}) {
7848
8304
  const optOut = process.env.YAW_MCP_AUTO_UPGRADE;
7849
8305
  if (optOut === "0" || optOut?.toLowerCase() === "false") return;
7850
- const current = deps.currentVersion ?? (true ? "0.74.0" : "dev");
8306
+ const current = deps.currentVersion ?? (true ? "0.74.1" : "dev");
7851
8307
  if (current === "dev") return;
7852
8308
  const method = (deps.isSeaImpl ? await deps.isSeaImpl() : await detectSea()) ? "binary" : detectInstallMethod(deps.argvPath ?? process.argv[1]);
7853
8309
  const latest = await (deps.fetchLatestImpl ?? fetchLatestVersion2)();
@@ -8436,13 +8892,13 @@ function pushToolCall(history, record, limit = HISTORY_LIMIT) {
8436
8892
  }
8437
8893
 
8438
8894
  // src/install-nudge.ts
8439
- import { existsSync as existsSync9, mkdirSync as mkdirSync2, readFileSync as readFileSync5, writeFileSync as writeFileSync2 } from "fs";
8440
- import { dirname as dirname4, join as join13 } from "path";
8895
+ import { existsSync as existsSync10, mkdirSync as mkdirSync3, readFileSync as readFileSync6, writeFileSync as writeFileSync2 } from "fs";
8896
+ import { dirname as dirname5, join as join14 } from "path";
8441
8897
  var INSTALL_NUDGE_MIN_COUNT = 5;
8442
8898
  var INSTALL_NUDGE_COOLDOWN_MS = 7 * 24 * 60 * 60 * 1e3;
8443
8899
  var INSTALL_NUDGE_STATE_FILENAME = "install-nudge-state.json";
8444
8900
  function installNudgeStatePath(home) {
8445
- return join13(home, CONFIG_DIRNAME, INSTALL_NUDGE_STATE_FILENAME);
8901
+ return join14(home, CONFIG_DIRNAME, INSTALL_NUDGE_STATE_FILENAME);
8446
8902
  }
8447
8903
  function installNudgeEnabled(env, config) {
8448
8904
  if (env.YAW_MCP_INSTALL_NUDGE === "1") return true;
@@ -8451,9 +8907,9 @@ function installNudgeEnabled(env, config) {
8451
8907
  }
8452
8908
  function readState(home) {
8453
8909
  const path7 = installNudgeStatePath(home);
8454
- if (!existsSync9(path7)) return { nudges: [] };
8910
+ if (!existsSync10(path7)) return { nudges: [] };
8455
8911
  try {
8456
- const parsed = JSON.parse(readFileSync5(path7, "utf8"));
8912
+ const parsed = JSON.parse(readFileSync6(path7, "utf8"));
8457
8913
  if (!parsed || typeof parsed !== "object") return { nudges: [] };
8458
8914
  const raw = parsed.nudges;
8459
8915
  if (!Array.isArray(raw)) return { nudges: [] };
@@ -8481,7 +8937,7 @@ function recordNudge(cli, home, now = Date.now) {
8481
8937
  const kept = state.nudges.filter((n) => n.cli !== cli && at - n.nudgedAt < INSTALL_NUDGE_COOLDOWN_MS);
8482
8938
  kept.push({ cli, nudgedAt: at });
8483
8939
  const path7 = installNudgeStatePath(home);
8484
- mkdirSync2(dirname4(path7), { recursive: true });
8940
+ mkdirSync3(dirname5(path7), { recursive: true });
8485
8941
  writeFileSync2(path7, `${JSON.stringify({ nudges: kept }, null, 2)}
8486
8942
  `, "utf8");
8487
8943
  } catch (err) {
@@ -9724,7 +10180,7 @@ import {
9724
10180
  } from "@modelcontextprotocol/sdk/types.js";
9725
10181
 
9726
10182
  // src/uv-bootstrap.ts
9727
- import { spawn as spawn5 } from "child_process";
10183
+ import { spawn as spawn6 } from "child_process";
9728
10184
  import { createHash as createHash3 } from "crypto";
9729
10185
  import { createWriteStream } from "fs";
9730
10186
  import fs from "fs/promises";
@@ -9777,7 +10233,7 @@ async function onPath(cmd) {
9777
10233
  };
9778
10234
  let child;
9779
10235
  try {
9780
- child = spawn5(cmd, ["--version"], {
10236
+ child = spawn6(cmd, ["--version"], {
9781
10237
  stdio: "ignore",
9782
10238
  // Windows needs a shell for PATHEXT shim resolution (.cmd/.exe)
9783
10239
  // so `uv --version` finds uv.cmd without an ENOENT false-negative.
@@ -9873,7 +10329,7 @@ async function extractArchive(archivePath, destDir) {
9873
10329
  }
9874
10330
  function runCommand(cmd, args) {
9875
10331
  return new Promise((resolve8, reject) => {
9876
- const child = spawn5(cmd, args, {
10332
+ const child = spawn6(cmd, args, {
9877
10333
  stdio: ["ignore", "pipe", "pipe"],
9878
10334
  shell: false,
9879
10335
  windowsHide: process.platform === "win32"
@@ -10093,7 +10549,7 @@ async function connectToUpstream(config, onDisconnect, onListChanged) {
10093
10549
  }
10094
10550
  async function connectToUpstreamOnce(config, onDisconnect, onListChanged, attempt, disableOamRewrite) {
10095
10551
  const client = new Client(
10096
- { name: "yaw-mcp", version: true ? "0.74.0" : "dev" },
10552
+ { name: "yaw-mcp", version: true ? "0.74.1" : "dev" },
10097
10553
  { capabilities: {} }
10098
10554
  );
10099
10555
  let transport;
@@ -10109,9 +10565,11 @@ async function connectToUpstreamOnce(config, onDisconnect, onListChanged, attemp
10109
10565
  ...parentEnv
10110
10566
  } = process.env;
10111
10567
  let resolved = await resolveUvSpawn(config.command, config.args ?? []);
10112
- const effectiveRuntime = config.runtime ?? await defaultRuntime();
10568
+ const configured = config.runtime ?? await defaultRuntime();
10569
+ const optedIn = configured !== null;
10570
+ const effectiveRuntime = configured ?? "oam";
10113
10571
  if (effectiveRuntime === "oam" && !disableOamRewrite && !oamDowngradedNamespaces.has(config.namespace)) {
10114
- const rewritten = await resolveOamSpawn(resolved.command, resolved.args);
10572
+ const rewritten = await resolveOamSpawn(resolved.command, resolved.args, optedIn);
10115
10573
  if (rewritten.command !== resolved.command) {
10116
10574
  attempt.oamRewritten = true;
10117
10575
  attempt.oamVersion = (await probeOam()).version;
@@ -10503,7 +10961,7 @@ var ConnectServer = class _ConnectServer {
10503
10961
  // real process values; overridable so tests can point the scan at a
10504
10962
  // synthetic home + stubbed env without touching the developer's real
10505
10963
  // shell history or ~/.yaw-mcp/ state file.
10506
- nudgeHome = homedir19();
10964
+ nudgeHome = homedir21();
10507
10965
  nudgeEnv = process.env;
10508
10966
  // Loaded YAW-MCP.md guides (user-global + project-local). Null until
10509
10967
  // start() has run the loader; fail-open if either file is missing,
@@ -10609,7 +11067,7 @@ var ConnectServer = class _ConnectServer {
10609
11067
  static STATE_SAVE_DEBOUNCE_MS = 1e3;
10610
11068
  constructor() {
10611
11069
  this.server = new Server(
10612
- { name: "yaw-mcp", version: true ? "0.74.0" : "dev" },
11070
+ { name: "yaw-mcp", version: true ? "0.74.1" : "dev" },
10613
11071
  {
10614
11072
  capabilities: {
10615
11073
  tools: { listChanged: true },
@@ -10764,7 +11222,7 @@ var ConnectServer = class _ConnectServer {
10764
11222
  //
10765
11223
  // `home` is a parameter rather than a field so tests can point it at a
10766
11224
  // synthetic ~/.yaw-mcp without running the whole of start().
10767
- async hydrateComplianceGrades(home = homedir19()) {
11225
+ async hydrateComplianceGrades(home = homedir21()) {
10768
11226
  if (!this.config) return;
10769
11227
  const grades = await readGradesCache(home).catch(() => ({}));
10770
11228
  if (Object.keys(grades).length === 0) return;
@@ -12603,6 +13061,7 @@ var KNOWN_SUBCOMMANDS = [
12603
13061
  "doctor",
12604
13062
  "reset-learning",
12605
13063
  "servers",
13064
+ "sidecars",
12606
13065
  "bundles",
12607
13066
  "completion",
12608
13067
  "upgrade",
@@ -12727,6 +13186,19 @@ if (subcommand === "compliance") {
12727
13186
  process.exit(2);
12728
13187
  }
12729
13188
  dispatch("servers", runServersCommand(parsed.options));
13189
+ } else if (subcommand === "sidecars") {
13190
+ const parsed = parseSidecarsArgs(process.argv.slice(3));
13191
+ if (!parsed.ok) {
13192
+ if (parsed.help) {
13193
+ process.stdout.write(`${parsed.error}
13194
+ `);
13195
+ process.exit(0);
13196
+ }
13197
+ process.stderr.write(`${parsed.error}
13198
+ `);
13199
+ process.exit(2);
13200
+ }
13201
+ dispatch("sidecars", runSidecarsInstall(parsed.options));
12730
13202
  } else if (subcommand === "bundles") {
12731
13203
  const parsed = parseBundlesArgs(process.argv.slice(3));
12732
13204
  if (!parsed.ok) {
@@ -12909,6 +13381,12 @@ if (subcommand === "compliance") {
12909
13381
  Maintenance:
12910
13382
  upgrade Show (or --run) the command that bumps
12911
13383
  @yawlabs/mcp to the latest version.
13384
+ sidecars install Install your servers into ~/.yaw-mcp/sidecars so
13385
+ they run from one known version. Worth doing when
13386
+ servers run on oam: it runs the copy already on
13387
+ disk and cannot re-resolve \`@latest\` the way npx
13388
+ did. Re-run to move them forward; \`doctor\` shows
13389
+ the version each one is on.
12912
13390
  reset-learning Clear cross-session learning history
12913
13391
  (~/.yaw-mcp/state.json).
12914
13392
  completion <shell> Print a shell completion script for bash, zsh,
@@ -12989,7 +13467,7 @@ if (subcommand === "compliance") {
12989
13467
  `);
12990
13468
  process.exitCode = 0;
12991
13469
  } else if (subcommand === "--version" || subcommand === "-V") {
12992
- process.stdout.write(`yaw-mcp ${true ? "0.74.0" : "dev"}
13470
+ process.stdout.write(`yaw-mcp ${true ? "0.74.1" : "dev"}
12993
13471
  `);
12994
13472
  process.exitCode = 0;
12995
13473
  } else if (subcommand && !subcommand.startsWith("-")) {