pi-agent-browser-native 0.7.1 → 0.8.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.
@@ -254,9 +254,13 @@ export function createLeaseWarmupFailureResult(config, targetName, warmupResult,
254
254
  return { ok: false, suiteDir, assertions };
255
255
  }
256
256
 
257
- export function buildPlatformBuildCommand(targetName, packageName = "pi-agent-browser-native", nodeValidationMajor = 22) {
257
+ export function nodeVersionAtLeast(actual, minimum) {
258
+ return /^v?\d+\.\d+\.\d+$/.test(actual) && actual.replace(/^v/, "").localeCompare(minimum, undefined, { numeric: true }) >= 0;
259
+ }
260
+
261
+ export function buildPlatformBuildCommand(targetName, packageName, nodeValidationVersion) {
258
262
  if (platformFor(targetName) === "powershell") {
259
- return `powershell.exe -NoLogo -NoProfile -ExecutionPolicy Bypass -File .\\scripts\\platform-smoke\\platform-build-windows.ps1 -PackageName ${psSingleQuote(packageName)} -NodeValidationMajor ${nodeValidationMajor}`;
263
+ return `powershell.exe -NoLogo -NoProfile -ExecutionPolicy Bypass -File .\\scripts\\platform-smoke\\platform-build-windows.ps1 -PackageName ${psSingleQuote(packageName)} -NodeValidationVersion ${psSingleQuote(nodeValidationVersion)}`;
260
264
  }
261
265
 
262
266
  const lines = [];
@@ -268,10 +272,8 @@ export function buildPlatformBuildCommand(targetName, packageName = "pi-agent-br
268
272
  lines.push(`mkdir -p "$PACK_DIR" "$PI_PROJECT"`);
269
273
  lines.push(`echo "PLATFORM_RUN_ROOT=$RUN_ROOT"`);
270
274
  lines.push(`NODE_VERSION=$(node --version)`);
271
- lines.push(`NODE_MAJOR="${"${NODE_VERSION#v}"}"`);
272
- lines.push(`NODE_MAJOR="${"${NODE_MAJOR%%.*}"}"`);
273
275
  lines.push(`echo "PLATFORM_NODE_VERSION=$NODE_VERSION"`);
274
- lines.push(`if [ "$NODE_MAJOR" -ge ${nodeValidationMajor} ]; then NODE_VERSION_EXIT=0; else NODE_VERSION_EXIT=1; fi`);
276
+ lines.push(`if node -e 'process.exit(process.versions.node.localeCompare(process.argv[1], undefined, { numeric: true }) < 0 ? 1 : 0)' ${shellQuote(nodeValidationVersion)}; then NODE_VERSION_EXIT=0; else NODE_VERSION_EXIT=1; fi`);
275
277
  lines.push(`echo "PLATFORM_NODE_VERSION_EXIT=$NODE_VERSION_EXIT"`);
276
278
  lines.push(`npm ci 2>&1`);
277
279
  lines.push(`NPM_CI_EXIT=$?`);
@@ -418,7 +420,7 @@ async function runPlatformBuildSuite(config, targetName, suiteName, leaseSession
418
420
  const startedAt = Date.now();
419
421
  const platform = platformFor(targetName);
420
422
  const slug = `${config.packageName}-${targetName}`;
421
- const command = buildPlatformBuildCommand(targetName, config.packageName, config.nodeValidationMajor);
423
+ const command = buildPlatformBuildCommand(targetName, config.packageName, config.nodeValidationVersion);
422
424
  mkdirSync(dirname(suiteDir), { recursive: true });
423
425
  writeFileSync(resolve(suiteDir, "target.json"), JSON.stringify(targetEvidence(config, targetName, runId, slug), null, 2));
424
426
  writeFileSync(resolve(suiteDir, "suite.json"), JSON.stringify({ suiteName, modelCalls: 0 }, null, 2));
@@ -453,7 +455,7 @@ async function runPlatformBuildSuite(config, targetName, suiteName, leaseSession
453
455
 
454
456
  const stdout = result.stdout;
455
457
  const listOutput = section(stdout, "PI_LIST_STDOUT");
456
- const nodeMajor = Number(marker(stdout, "PLATFORM_NODE_VERSION").replace(/^v/, "").split(".")[0] ?? 0);
458
+ const nodeVersion = marker(stdout, "PLATFORM_NODE_VERSION");
457
459
  const secretViolations = [
458
460
  ...scanForSecrets(`${result.stdout}\n${result.stderr}`, secretValues),
459
461
  ...scanArtifactTextFiles(suiteDir, secretValues).map((finding) => `${finding.file}: ${finding.violation}`),
@@ -461,7 +463,7 @@ async function runPlatformBuildSuite(config, targetName, suiteName, leaseSession
461
463
  const checks = [
462
464
  { id: "command-exit-zero", fn: () => result.code === 0, error: `exit ${result.code}` },
463
465
  { id: "platform-marker", fn: () => stdout.includes("PLATFORM_BUILD_OK") },
464
- { id: "node-version", fn: () => nodeMajor >= (config.nodeValidationMajor ?? 22), error: `Node major ${nodeMajor}` },
466
+ { id: "node-version", fn: () => nodeVersionAtLeast(nodeVersion, config.nodeValidationVersion), error: `Node ${nodeVersion || "unknown"} < ${config.nodeValidationVersion}` },
465
467
  { id: "npm-ci", fn: () => /PLATFORM_NPM_CI_EXIT=0/.test(stdout) },
466
468
  { id: "npm-run-verify", fn: () => /PLATFORM_VERIFY_EXIT=0/.test(stdout) },
467
469
  { id: "npm-pack", fn: () => /PLATFORM_NPM_PACK_EXIT=0/.test(stdout) && marker(stdout, "PLATFORM_PACKED_TARBALL").length > 0 },