neoagent 2.3.1-beta.77 → 2.3.1-beta.78

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.
@@ -373,7 +373,8 @@ class LocalVmExecutionBackend {
373
373
  await client.waitForHealth({
374
374
  timeoutMs: Number(process.env.NEOAGENT_VM_BOOT_TIMEOUT_MS || 20 * 60 * 1000),
375
375
  checkLiveness: () => {
376
- const session = this.vmManager.instances.get(userId);
376
+ const key = String(userId || '').trim();
377
+ const session = this.vmManager.instances.get(key);
377
378
  return session && session.process && !session.process.killed && session.process.exitCode === null;
378
379
  },
379
380
  });
@@ -389,6 +389,7 @@ function ensureGuestBootstrapSeed({
389
389
  guestToken,
390
390
  hostShareMount = '/mnt/neoagent-host',
391
391
  guestAgentPort = 8421,
392
+ guestArch = 'x64',
392
393
  }) {
393
394
  const seedRoot = path.join(userRoot, 'cloud-init');
394
395
  const seedDir = path.join(seedRoot, 'seed');
@@ -404,14 +405,23 @@ function ensureGuestBootstrapSeed({
404
405
  instanceId: `neoagent-${path.basename(userRoot)}`,
405
406
  localHostName: `neoagent-${path.basename(userRoot)}`,
406
407
  });
407
- const startupNsh = [
408
- '@echo -off',
409
- 'map -r',
410
- 'fs0:',
411
- '\\EFI\\ubuntu\\shimx64.efi',
412
- '\\EFI\\ubuntu\\grubx64.efi',
413
- '\\EFI\\BOOT\\BOOTX64.EFI',
414
- ].join('\r\n');
408
+ const startupNsh = guestArch === 'arm64'
409
+ ? [
410
+ '@echo -off',
411
+ 'map -r',
412
+ 'fs0:',
413
+ '\\EFI\\ubuntu\\shimaa64.efi',
414
+ '\\EFI\\ubuntu\\grubaa64.efi',
415
+ '\\EFI\\BOOT\\BOOTAA64.EFI',
416
+ ].join('\r\n')
417
+ : [
418
+ '@echo -off',
419
+ 'map -r',
420
+ 'fs0:',
421
+ '\\EFI\\ubuntu\\shimx64.efi',
422
+ '\\EFI\\ubuntu\\grubx64.efi',
423
+ '\\EFI\\BOOT\\BOOTX64.EFI',
424
+ ].join('\r\n');
415
425
 
416
426
  fs.writeFileSync(userDataPath, userData);
417
427
  fs.writeFileSync(metaDataPath, metaData);
@@ -568,6 +568,7 @@ class QemuVmManager {
568
568
  const bootstrap = ensureGuestBootstrapSeed({
569
569
  userRoot,
570
570
  guestToken,
571
+ guestArch: this.guestArch,
571
572
  });
572
573
  const guestDataRoot = path.join(userRoot, 'guest-data');
573
574
  const consoleLogPath = path.join(userRoot, 'console.log');
@@ -629,6 +630,12 @@ class QemuVmManager {
629
630
  });
630
631
 
631
632
  if (consoleLogPath) {
633
+ // Ensure file exists before reading to avoid race condition
634
+ try {
635
+ fs.closeSync(fs.openSync(consoleLogPath, 'a'));
636
+ } catch (err) {
637
+ console.warn(`[VM] Failed to pre-create console log at ${consoleLogPath}: ${err.message}`);
638
+ }
632
639
  // Stream serial output to console for easier debugging on remote machines
633
640
  const serialStream = fs.createReadStream(consoleLogPath, { flags: 'r' });
634
641
  serialStream.on('data', (chunk) => {