@wix/evalforge-evaluator 0.69.0 → 0.71.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.
package/build/index.js CHANGED
@@ -6548,121 +6548,6 @@ spawn error: ${err.message}`;
6548
6548
  }, probeMs);
6549
6549
  });
6550
6550
  }
6551
- async function preInstallMcpPackages(mcps, timeoutMs = 12e4) {
6552
- const packages = extractNpxPackages(mcps);
6553
- if (packages.length === 0) return [];
6554
- const results = [];
6555
- for (const pkg of packages) {
6556
- const startMs = Date.now();
6557
- const alreadyInstalled = await isPackageGloballyInstalled(pkg);
6558
- if (alreadyInstalled) {
6559
- const durationMs2 = Date.now() - startMs;
6560
- console.log(
6561
- `[MCP] Package already installed globally, skipping: ${pkg} (${durationMs2}ms)`
6562
- );
6563
- results.push({
6564
- package: pkg,
6565
- success: true,
6566
- skipped: true,
6567
- output: "already installed",
6568
- durationMs: durationMs2
6569
- });
6570
- continue;
6571
- }
6572
- console.log(`[MCP] Pre-installing npx package globally: ${pkg}`);
6573
- const result = await installPackageGlobally(pkg, timeoutMs);
6574
- const durationMs = Date.now() - startMs;
6575
- results.push({ package: pkg, skipped: false, durationMs, ...result });
6576
- console.log(
6577
- `[MCP] Install ${pkg}: ${result.success ? "SUCCESS" : "FAILED"} (${durationMs}ms)`
6578
- );
6579
- }
6580
- return results;
6581
- }
6582
- function isPackageGloballyInstalled(pkg) {
6583
- return new Promise((resolve2) => {
6584
- let settled = false;
6585
- const child = (0, import_child_process.spawn)("npm", ["ls", "-g", "--depth=0", pkg], {
6586
- stdio: ["pipe", "pipe", "pipe"],
6587
- env: process.env
6588
- });
6589
- child.on("close", (code2) => {
6590
- if (!settled) {
6591
- settled = true;
6592
- resolve2(code2 === 0);
6593
- }
6594
- });
6595
- child.on("error", () => {
6596
- if (!settled) {
6597
- settled = true;
6598
- resolve2(false);
6599
- }
6600
- });
6601
- setTimeout(() => {
6602
- if (!settled) {
6603
- settled = true;
6604
- child.kill("SIGTERM");
6605
- resolve2(false);
6606
- }
6607
- }, 5e3);
6608
- });
6609
- }
6610
- function extractNpxPackages(mcps) {
6611
- const packages = [];
6612
- for (const mcp of mcps) {
6613
- const config = mcp.config;
6614
- for (const [, value] of Object.entries(config)) {
6615
- if (typeof value !== "object" || value === null) continue;
6616
- const cfg = value;
6617
- if (cfg.command !== "npx" || !Array.isArray(cfg.args)) continue;
6618
- for (const arg of cfg.args) {
6619
- if (!arg.startsWith("-")) {
6620
- packages.push(arg);
6621
- break;
6622
- }
6623
- }
6624
- }
6625
- }
6626
- return [...new Set(packages)];
6627
- }
6628
- function installPackageGlobally(pkg, timeoutMs) {
6629
- return new Promise((resolve2) => {
6630
- let output = "";
6631
- let settled = false;
6632
- const child = (0, import_child_process.spawn)("sh", ["-c", `npm install -g ${pkg} 2>&1`], {
6633
- stdio: ["pipe", "pipe", "pipe"],
6634
- env: process.env
6635
- });
6636
- child.stdout.on("data", (chunk) => {
6637
- output += chunk.toString();
6638
- });
6639
- child.stderr.on("data", (chunk) => {
6640
- output += chunk.toString();
6641
- });
6642
- child.on("close", (code2) => {
6643
- if (!settled) {
6644
- settled = true;
6645
- resolve2({ success: code2 === 0, output: output.slice(-1e3) });
6646
- }
6647
- });
6648
- child.on("error", (err) => {
6649
- if (!settled) {
6650
- settled = true;
6651
- resolve2({ success: false, output: `spawn error: ${err.message}` });
6652
- }
6653
- });
6654
- setTimeout(() => {
6655
- if (!settled) {
6656
- settled = true;
6657
- child.kill("SIGTERM");
6658
- resolve2({
6659
- success: false,
6660
- output: output.slice(-1e3) + "\n[install timed out]"
6661
- });
6662
- }
6663
- }, timeoutMs);
6664
- });
6665
- }
6666
6551
  async function probeNpmConfig(cwd) {
6667
6552
  const homedir = process.env.HOME ?? "~";
6668
6553
  const [wixAuthFile, npmInstallDryRun, mcpPackageInstalled] = await Promise.all([
@@ -7001,29 +6886,6 @@ async function executeWithClaudeCode(skills, scenario, options) {
7001
6886
  const allMessages = [];
7002
6887
  if (options.mcps && options.mcps.length > 0) {
7003
6888
  await writeMcpToFilesystem(options.cwd, options.mcps);
7004
- const installResults = await preInstallMcpPackages(options.mcps);
7005
- if (installResults.length > 0 && options.traceContext) {
7006
- emitTraceEvent(
7007
- {
7008
- evalRunId: options.traceContext.evalRunId,
7009
- scenarioId: options.traceContext.scenarioId,
7010
- scenarioName: options.traceContext.scenarioName,
7011
- targetId: options.traceContext.targetId,
7012
- targetName: options.traceContext.targetName,
7013
- stepNumber: 0,
7014
- type: import_evalforge_types3.LiveTraceEventType.DIAGNOSTIC,
7015
- outputPreview: JSON.stringify({
7016
- event: "mcp-pre-install",
7017
- results: installResults
7018
- }).slice(0, 2e3),
7019
- timestamp: (/* @__PURE__ */ new Date()).toISOString(),
7020
- isComplete: false
7021
- },
7022
- options.traceContext.tracePushUrl,
7023
- options.traceContext.routeHeader,
7024
- options.traceContext.authToken
7025
- );
7026
- }
7027
6889
  const probeResults = await probeMcpServers(options.mcps);
7028
6890
  if (options.traceContext) {
7029
6891
  emitTraceEvent(