4runr-os 2.1.21 → 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,135 +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! Building mk3-tui from npm package...\n\n');
2567
- // Try to build from npm package
2568
- try {
2569
- const { execSync } = await import('child_process');
2570
- const npmPackagePath = path.join(__dirname, '..', 'node_modules', '4runr-os-mk3');
2571
- if (fs.existsSync(npmPackagePath)) {
2572
- process.stderr.write('🔨 Building from npm package...\n');
2573
- execSync('cargo build --release', {
2574
- cwd: npmPackagePath,
2575
- stdio: 'inherit',
2576
- });
2577
- // Retry finding binary
2578
- const builtBinary = path.join(npmPackagePath, 'target', 'release', binaryName);
2579
- if (fs.existsSync(builtBinary)) {
2580
- binaryPath = builtBinary;
2581
- process.stderr.write('\n✅ Build successful! Launching...\n\n');
2582
- }
2583
- else {
2584
- process.stderr.write('\n⚠️ Build completed but binary not found at expected location.\n');
2585
- process.stderr.write(' Please try running "4r" again.\n\n');
2586
- process.exit(1);
2587
- }
2588
- }
2589
- else {
2590
- process.stderr.write('\n⚠️ 4runr-os-mk3 package not found in node_modules.\n');
2591
- process.stderr.write(' Installing...\n\n');
2592
- execSync('npm install -g 4runr-os-mk3', { stdio: 'inherit' });
2593
- // The postinstall script should have built it, try to find it
2594
- const globalPath = process.platform === 'win32'
2595
- ? path.join(process.env.APPDATA || '', 'npm', 'node_modules', '4runr-os-mk3', 'target', 'release', binaryName)
2596
- : path.join('/usr/local/lib/node_modules', '4runr-os-mk3', 'target', 'release', binaryName);
2597
- if (fs.existsSync(globalPath)) {
2598
- binaryPath = globalPath;
2599
- }
2600
- else {
2601
- // Try PATH
2602
- try {
2603
- const whichCmd = platform === 'win32' ? 'where' : 'which';
2604
- execSync(`${whichCmd} ${binaryName}`, { stdio: 'ignore' });
2605
- binaryPath = binaryName;
2606
- }
2607
- catch {
2608
- process.stderr.write('\n⚠️ Please restart your terminal and run "4r" again.\n\n');
2609
- process.exit(1);
2610
- }
2611
- }
2612
- }
2613
- }
2614
- catch (buildError) {
2615
- process.stderr.write('\n⚠️ Build failed. You can build manually:\n');
2616
- process.stderr.write(' cd %APPDATA%\\npm\\node_modules\\4runr-os-mk3\n');
2617
- process.stderr.write(' cargo build --release\n');
2618
- process.stderr.write(' Then run: 4r\n\n');
2619
- process.exit(1);
2620
- }
2621
- }
2622
- else {
2623
- process.stderr.write(' To use 4runr-os on Windows, you have two options:\n\n');
2624
- process.stderr.write(' Option 1: Install Rust and build locally\n');
2625
- process.stderr.write(' 1. Install Rust (see instructions above)\n');
2626
- process.stderr.write(' 2. Build: cd %USERPROFILE% && git clone https://github.com/KyanBergeron4Runr/4Runr-AI-Agent-OS.git\n');
2627
- process.stderr.write(' 3. Build: cd 4Runr-AI-Agent-OS\\apps\\mk3-tui && cargo build --release\n');
2628
- process.stderr.write(' 4. Add to PATH or run: .\\target\\release\\mk3-tui.exe\n\n');
2629
- process.stderr.write(' Option 2: Use WSL (Windows Subsystem for Linux)\n');
2630
- process.stderr.write(' 1. Install WSL: wsl --install\n');
2631
- process.stderr.write(' 2. In WSL: npm install -g 4runr-os\n');
2632
- process.stderr.write(' 3. Run: 4r\n\n');
2633
- process.stderr.write(' Windows binary support coming soon!\n\n');
2634
- }
2635
- }
2636
- else {
2637
- process.stderr.write('The 4runr-os package requires 4runr-os-mk3.\n');
2638
- 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)
2639
2563
  try {
2640
- // Try to install 4runr-os-mk3 automatically
2641
2564
  const { execSync } = await import('child_process');
2642
- execSync('npm install -g 4runr-os-mk3', { stdio: 'inherit' });
2643
- // Retry finding binary after install
2644
- const retryPaths = [
2645
- binaryName,
2646
- path.join(__dirname, '..', 'node_modules', '4runr-os-mk3', 'target', 'release', binaryName),
2647
- ];
2648
- for (const testPath of retryPaths) {
2649
- if (testPath === binaryName) {
2650
- try {
2651
- const whichCmd = platform === 'win32' ? 'where' : 'which';
2652
- execSync(`${whichCmd} ${testPath}`, { stdio: 'ignore' });
2653
- binaryPath = testPath;
2654
- break;
2655
- }
2656
- catch {
2657
- continue;
2658
- }
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');
2659
2577
  }
2660
- else if (fs.existsSync(testPath)) {
2661
- binaryPath = testPath;
2662
- 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);
2663
2582
  }
2664
2583
  }
2665
- if (!binaryPath) {
2666
- process.stderr.write('\n[ERROR] Installation completed but binary still not found.\n');
2667
- process.stderr.write('Please run: npm install -g 4runr-os-mk3\n');
2668
- 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');
2669
2587
  process.exit(1);
2670
2588
  }
2671
2589
  }
2672
- catch (installError) {
2673
- process.stderr.write('\n[ERROR] Auto-install failed. Please install manually:\n');
2674
- process.stderr.write(' npm install -g 4runr-os-mk3\n');
2675
- process.stderr.write('Then run: 4r\n\n');
2676
- // Check if Rust might help (for building from source)
2677
- const { isRustInstalled, getRustInstallCommand } = await import('./rust-check.js');
2678
- if (!isRustInstalled()) {
2679
- process.stderr.write('\n💡 Alternative: Build from source (requires Rust):\n');
2680
- process.stderr.write(` Install Rust: ${getRustInstallCommand()}\n`);
2681
- process.stderr.write(' Then build: git clone https://github.com/KyanBergeron4Runr/4Runr-AI-Agent-OS.git\n');
2682
- process.stderr.write(' cd 4Runr-AI-Agent-OS/apps/mk3-tui && cargo build --release\n\n');
2683
- }
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');
2684
2594
  process.exit(1);
2685
2595
  }
2686
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
+ }
2687
2602
  if (!binaryPath) {
2688
2603
  process.exit(1);
2689
2604
  }