neoagent 2.3.1-beta.76 → 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
  });
@@ -156,7 +156,6 @@ function createCloudInitScript({
156
156
  'echo "NeoAgent guest bootstrap completed."',
157
157
  '',
158
158
  ].join('\n');
159
- ].join('\n');
160
159
  }
161
160
 
162
161
  function createCloudInitUserData({
@@ -390,6 +389,7 @@ function ensureGuestBootstrapSeed({
390
389
  guestToken,
391
390
  hostShareMount = '/mnt/neoagent-host',
392
391
  guestAgentPort = 8421,
392
+ guestArch = 'x64',
393
393
  }) {
394
394
  const seedRoot = path.join(userRoot, 'cloud-init');
395
395
  const seedDir = path.join(seedRoot, 'seed');
@@ -405,14 +405,23 @@ function ensureGuestBootstrapSeed({
405
405
  instanceId: `neoagent-${path.basename(userRoot)}`,
406
406
  localHostName: `neoagent-${path.basename(userRoot)}`,
407
407
  });
408
- const startupNsh = [
409
- '@echo -off',
410
- 'map -r',
411
- 'fs0:',
412
- '\\EFI\\ubuntu\\shimx64.efi',
413
- '\\EFI\\ubuntu\\grubx64.efi',
414
- '\\EFI\\BOOT\\BOOTX64.EFI',
415
- ].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');
416
425
 
417
426
  fs.writeFileSync(userDataPath, userData);
418
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) => {