4runr-os 2.1.20 → 2.1.22

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/dist/index.js CHANGED
@@ -2520,14 +2520,12 @@ else {
2520
2520
  // Try to find mk3-tui binary in multiple locations
2521
2521
  const binaryName = process.platform === 'win32' ? 'mk3-tui.exe' : 'mk3-tui';
2522
2522
  const possiblePaths = [
2523
- // From npm package 4runr-os-mk3 (global install) - binary is in PATH as 'mk3-tui'
2524
- binaryName,
2525
- // From npm package 4runr-os-mk3 (local node_modules via dependency)
2526
- path.join(__dirname, '..', 'node_modules', '4runr-os-mk3', 'target', 'release', binaryName),
2523
+ // From 4runr-os package itself (included mk3-tui)
2524
+ path.join(__dirname, '..', 'mk3-tui', 'target', 'release', binaryName),
2527
2525
  // From local build in monorepo (development)
2528
2526
  path.join(__dirname, '..', '..', '..', 'apps', 'mk3-tui', 'target', 'release', binaryName),
2529
- // From npm package 4runr-os-mk3 (local node_modules at root)
2530
- path.join(__dirname, '..', '..', '..', 'node_modules', '4runr-os-mk3', 'target', 'release', binaryName),
2527
+ // Fallback: try PATH (for backwards compatibility)
2528
+ binaryName,
2531
2529
  ];
2532
2530
  let binaryPath = null;
2533
2531
  for (const testPath of possiblePaths) {
@@ -2555,85 +2553,52 @@ else {
2555
2553
  const platform = process.platform;
2556
2554
  const isWindows = platform === 'win32';
2557
2555
  process.stderr.write('\n[ERROR] mk3-tui binary not found.\n');
2558
- if (isWindows) {
2559
- process.stderr.write('\n⚠️ Windows binary not yet available in npm package.\n');
2560
- process.stderr.write(' The current package only includes Linux binaries.\n\n');
2561
- // Check if Rust is installed
2562
- const { checkAndInstallRust } = await import('./rust-check.js');
2563
- const autoInstallRust = process.env.AUTO_INSTALL_RUST === '1';
2564
- const rustInstalled = await checkAndInstallRust(autoInstallRust);
2565
- if (rustInstalled) {
2566
- process.stderr.write('\n✅ Rust is installed! You can now build mk3-tui:\n');
2567
- process.stderr.write(' 1. Clone the repo: git clone https://github.com/KyanBergeron4Runr/4Runr-AI-Agent-OS.git\n');
2568
- process.stderr.write(' 2. Build: cd 4Runr-AI-Agent-OS\\apps\\mk3-tui && cargo build --release\n');
2569
- process.stderr.write(' 3. Add to PATH: $env:PATH += ";$PWD\\target\\release"\n');
2570
- process.stderr.write(' 4. Run: 4r\n\n');
2571
- }
2572
- else {
2573
- process.stderr.write(' To use 4runr-os on Windows, you have two options:\n\n');
2574
- process.stderr.write(' Option 1: Install Rust and build locally\n');
2575
- process.stderr.write(' 1. Install Rust (see instructions above)\n');
2576
- process.stderr.write(' 2. Build: cd %USERPROFILE% && git clone https://github.com/KyanBergeron4Runr/4Runr-AI-Agent-OS.git\n');
2577
- process.stderr.write(' 3. Build: cd 4Runr-AI-Agent-OS\\apps\\mk3-tui && cargo build --release\n');
2578
- process.stderr.write(' 4. Add to PATH or run: .\\target\\release\\mk3-tui.exe\n\n');
2579
- process.stderr.write(' Option 2: Use WSL (Windows Subsystem for Linux)\n');
2580
- process.stderr.write(' 1. Install WSL: wsl --install\n');
2581
- process.stderr.write(' 2. In WSL: npm install -g 4runr-os\n');
2582
- process.stderr.write(' 3. Run: 4r\n\n');
2583
- process.stderr.write(' Windows binary support coming soon!\n\n');
2584
- }
2585
- }
2586
- else {
2587
- process.stderr.write('The 4runr-os package requires 4runr-os-mk3.\n');
2588
- process.stderr.write('Installing automatically...\n\n');
2556
+ // Check if Rust is installed and try to build
2557
+ const { checkAndInstallRust, getRustInstallCommand } = await import('./rust-check.js');
2558
+ const autoInstallRust = process.env.AUTO_INSTALL_RUST === '1';
2559
+ const rustInstalled = await checkAndInstallRust(autoInstallRust);
2560
+ if (rustInstalled) {
2561
+ process.stderr.write('\n✅ Rust is installed! Building mk3-tui from 4runr-os package...\n\n');
2562
+ // Try to build from 4runr-os package (mk3-tui is included)
2589
2563
  try {
2590
- // Try to install 4runr-os-mk3 automatically
2591
2564
  const { execSync } = await import('child_process');
2592
- execSync('npm install -g 4runr-os-mk3', { stdio: 'inherit' });
2593
- // Retry finding binary after install
2594
- const retryPaths = [
2595
- binaryName,
2596
- path.join(__dirname, '..', 'node_modules', '4runr-os-mk3', 'target', 'release', binaryName),
2597
- ];
2598
- for (const testPath of retryPaths) {
2599
- if (testPath === binaryName) {
2600
- try {
2601
- const whichCmd = platform === 'win32' ? 'where' : 'which';
2602
- execSync(`${whichCmd} ${testPath}`, { stdio: 'ignore' });
2603
- binaryPath = testPath;
2604
- break;
2605
- }
2606
- catch {
2607
- continue;
2608
- }
2565
+ const mk3Path = path.join(__dirname, '..', 'mk3-tui');
2566
+ if (fs.existsSync(mk3Path)) {
2567
+ process.stderr.write('🔨 Building from 4runr-os package...\n');
2568
+ execSync('cargo build --release', {
2569
+ cwd: mk3Path,
2570
+ stdio: 'inherit',
2571
+ });
2572
+ // Retry finding binary
2573
+ const builtBinary = path.join(mk3Path, 'target', 'release', binaryName);
2574
+ if (fs.existsSync(builtBinary)) {
2575
+ binaryPath = builtBinary;
2576
+ process.stderr.write('\n✅ Build successful! Launching...\n\n');
2609
2577
  }
2610
- else if (fs.existsSync(testPath)) {
2611
- binaryPath = testPath;
2612
- break;
2578
+ else {
2579
+ process.stderr.write('\n⚠️ Build completed but binary not found at expected location.\n');
2580
+ process.stderr.write(' Please try running "4r" again.\n\n');
2581
+ process.exit(1);
2613
2582
  }
2614
2583
  }
2615
- if (!binaryPath) {
2616
- process.stderr.write('\n[ERROR] Installation completed but binary still not found.\n');
2617
- process.stderr.write('Please run: npm install -g 4runr-os-mk3\n');
2618
- process.stderr.write('Then try again: 4r\n\n');
2584
+ else {
2585
+ process.stderr.write('\n⚠️ mk3-tui source not found in 4runr-os package.\n');
2586
+ process.stderr.write(' Please reinstall: npm install -g 4runr-os@latest\n\n');
2619
2587
  process.exit(1);
2620
2588
  }
2621
2589
  }
2622
- catch (installError) {
2623
- process.stderr.write('\n[ERROR] Auto-install failed. Please install manually:\n');
2624
- process.stderr.write(' npm install -g 4runr-os-mk3\n');
2625
- process.stderr.write('Then run: 4r\n\n');
2626
- // Check if Rust might help (for building from source)
2627
- const { isRustInstalled, getRustInstallCommand } = await import('./rust-check.js');
2628
- if (!isRustInstalled()) {
2629
- process.stderr.write('\n💡 Alternative: Build from source (requires Rust):\n');
2630
- process.stderr.write(` Install Rust: ${getRustInstallCommand()}\n`);
2631
- process.stderr.write(' Then build: git clone https://github.com/KyanBergeron4Runr/4Runr-AI-Agent-OS.git\n');
2632
- process.stderr.write(' cd 4Runr-AI-Agent-OS/apps/mk3-tui && cargo build --release\n\n');
2633
- }
2590
+ catch (buildError) {
2591
+ process.stderr.write('\n⚠️ Build failed. Please ensure Rust is properly installed.\n');
2592
+ process.stderr.write(` Install Rust: ${getRustInstallCommand()}\n`);
2593
+ process.stderr.write(' Then run "4r" again.\n\n');
2634
2594
  process.exit(1);
2635
2595
  }
2636
2596
  }
2597
+ else {
2598
+ process.stderr.write('\n💡 To build mk3-tui, you need Rust installed.\n');
2599
+ process.stderr.write(` Install Rust: ${getRustInstallCommand()}\n`);
2600
+ process.stderr.write(' Then run "4r" again - it will build automatically.\n\n');
2601
+ }
2637
2602
  if (!binaryPath) {
2638
2603
  process.exit(1);
2639
2604
  }