@wix/evalforge-evaluator 0.64.0 → 0.66.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
@@ -6544,6 +6544,96 @@ spawn error: ${err.message}`;
6544
6544
  }, probeMs);
6545
6545
  });
6546
6546
  }
6547
+ async function probeNpmConfig(cwd) {
6548
+ const homedir = process.env.HOME ?? "~";
6549
+ const [
6550
+ cwdNpmrc,
6551
+ homeNpmrc,
6552
+ projectRootNpmrc,
6553
+ globalNpmrc,
6554
+ npmConfigListFull,
6555
+ npmConfigGetRegistry,
6556
+ npmViewWixMcp
6557
+ ] = await Promise.all([
6558
+ (0, import_promises4.readFile)((0, import_path6.join)(cwd, ".npmrc"), "utf8").catch(
6559
+ (e) => `[not found: ${e.message}]`
6560
+ ),
6561
+ (0, import_promises4.readFile)((0, import_path6.join)(homedir, ".npmrc"), "utf8").catch(
6562
+ (e) => `[not found: ${e.message}]`
6563
+ ),
6564
+ (0, import_promises4.readFile)("/user-code/.npmrc", "utf8").catch(
6565
+ (e) => `[not found: ${e.message}]`
6566
+ ),
6567
+ runShellCapture(
6568
+ 'echo "=== globalconfig ===" && npm config get globalconfig && cat "$(npm config get globalconfig)" 2>/dev/null || echo "[no global npmrc]" && echo "=== userconfig ===" && npm config get userconfig && cat "$(npm config get userconfig)" 2>/dev/null || echo "[no user npmrc]" && echo "=== prefix ===" && npm config get prefix && cat "$(npm config get prefix)/etc/npmrc" 2>/dev/null || echo "[no prefix npmrc]"',
6569
+ cwd,
6570
+ 5e3
6571
+ ),
6572
+ runShellCapture("npm config list -l 2>&1 | head -60", cwd, 5e3),
6573
+ runShellCapture("npm config get registry", cwd, 3e3),
6574
+ runShellCapture(
6575
+ "npm view @wix/mcp version --registry https://registry.npmjs.org 2>&1",
6576
+ cwd,
6577
+ 1e4
6578
+ )
6579
+ ]);
6580
+ const npmEnvVars = {};
6581
+ for (const [key, value] of Object.entries(process.env)) {
6582
+ const lk = key.toLowerCase();
6583
+ if (lk.startsWith("npm_config") || lk.includes("token") || lk.includes("auth") || lk.includes("registry")) {
6584
+ npmEnvVars[key] = lk.includes("token") || lk.includes("auth") || lk.includes("secret") ? `[REDACTED, length=${(value ?? "").length}]` : value;
6585
+ }
6586
+ }
6587
+ return {
6588
+ cwd,
6589
+ processCwd: process.cwd(),
6590
+ cwdNpmrc: cwdNpmrc.slice(0, 1e3),
6591
+ homeNpmrc: homeNpmrc.slice(0, 1e3),
6592
+ projectRootNpmrc: projectRootNpmrc.slice(0, 1e3),
6593
+ globalNpmrc: globalNpmrc.slice(0, 2e3),
6594
+ npmConfigListFull: npmConfigListFull.slice(0, 3e3),
6595
+ npmConfigGetRegistry: npmConfigGetRegistry.trim(),
6596
+ npmViewWixMcp: npmViewWixMcp.trim().slice(0, 500),
6597
+ npmEnvVars,
6598
+ homedir
6599
+ };
6600
+ }
6601
+ function runShellCapture(cmd, cwd, timeoutMs) {
6602
+ return new Promise((resolve2) => {
6603
+ let output = "";
6604
+ let settled = false;
6605
+ const child = (0, import_child_process.spawn)("sh", ["-c", cmd], {
6606
+ stdio: ["pipe", "pipe", "pipe"],
6607
+ cwd,
6608
+ env: process.env
6609
+ });
6610
+ child.stdout.on("data", (chunk) => {
6611
+ output += chunk.toString();
6612
+ });
6613
+ child.stderr.on("data", (chunk) => {
6614
+ output += chunk.toString();
6615
+ });
6616
+ child.on("close", () => {
6617
+ if (!settled) {
6618
+ settled = true;
6619
+ resolve2(output);
6620
+ }
6621
+ });
6622
+ child.on("error", (err) => {
6623
+ if (!settled) {
6624
+ settled = true;
6625
+ resolve2(`[error: ${err.message}]`);
6626
+ }
6627
+ });
6628
+ setTimeout(() => {
6629
+ if (!settled) {
6630
+ settled = true;
6631
+ child.kill("SIGTERM");
6632
+ resolve2(output + "\n[timed out]");
6633
+ }
6634
+ }, timeoutMs);
6635
+ });
6636
+ }
6547
6637
 
6548
6638
  // src/run-scenario/agents/claude-code/write-sub-agents.ts
6549
6639
  var import_promises5 = require("fs/promises");
@@ -6821,6 +6911,33 @@ async function executeWithClaudeCode(skills, scenario, options) {
6821
6911
  options.traceContext.authToken
6822
6912
  );
6823
6913
  }
6914
+ const npmDiag = await probeNpmConfig(options.cwd);
6915
+ console.log(
6916
+ "[DEBUG-d744ca] npm-config-diagnostic",
6917
+ JSON.stringify(npmDiag)
6918
+ );
6919
+ if (options.traceContext) {
6920
+ emitTraceEvent(
6921
+ {
6922
+ evalRunId: options.traceContext.evalRunId,
6923
+ scenarioId: options.traceContext.scenarioId,
6924
+ scenarioName: options.traceContext.scenarioName,
6925
+ targetId: options.traceContext.targetId,
6926
+ targetName: options.traceContext.targetName,
6927
+ stepNumber: 0,
6928
+ type: import_evalforge_types3.LiveTraceEventType.DIAGNOSTIC,
6929
+ outputPreview: JSON.stringify({
6930
+ event: "npm-config-diagnostic",
6931
+ ...npmDiag
6932
+ }).slice(0, 8e3),
6933
+ timestamp: (/* @__PURE__ */ new Date()).toISOString(),
6934
+ isComplete: false
6935
+ },
6936
+ options.traceContext.tracePushUrl,
6937
+ options.traceContext.routeHeader,
6938
+ options.traceContext.authToken
6939
+ );
6940
+ }
6824
6941
  }
6825
6942
  if (options.subAgents && options.subAgents.length > 0) {
6826
6943
  await writeSubAgentsToFilesystem(options.cwd, options.subAgents);