aurix-ai 2.7.8 → 2.7.9

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aurix-ai",
3
- "version": "2.7.8",
3
+ "version": "2.7.9",
4
4
  "description": "Open-source terminal AI agent for coding, deep research, automation, and multi-platform task execution.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -1,63 +1,86 @@
1
1
  #!/usr/bin/env node
2
- import { readFileSync, writeFileSync, existsSync } from 'fs';
2
+ // Runs automatically after `npm install` (postinstall hook).
3
+ // Fixes the two things that commonly break aurix on Windows:
4
+ // 1. @opentui/core-win32-x64 optional dependency sometimes gets skipped
5
+ // (network glitch, --omit=optional, pnpm strict).
6
+ // 2. Bun runtime (preferred over Node because it has built-in FFI,
7
+ // no --experimental-ffi flag needed).
8
+ // Safe to re-run; idempotent and skips when already satisfied.
9
+
10
+ import { existsSync } from 'fs';
3
11
  import { join, dirname } from 'path';
4
12
  import { fileURLToPath } from 'url';
13
+ import { spawnSync, execSync } from 'child_process';
5
14
 
6
15
  const __dirname = dirname(fileURLToPath(import.meta.url));
16
+ const projectRoot = join(__dirname, '..');
7
17
 
8
- console.log('\n╔═══════════════════════════════════════════════════════════╗');
9
- console.log('║ Aurix Agent - Post-install Setup ║');
10
- console.log('╚═══════════════════════════════════════════════════════════╝\n');
18
+ function log(msg) { console.log(`[aurix postinstall] ${msg}`); }
19
+ function run(cmd, args, opts = {}) {
20
+ return spawnSync(cmd, args, { stdio: 'inherit', ...opts }).status === 0;
21
+ }
11
22
 
12
- const results = [];
23
+ // ─── 1. Ensure native OpenTUI binary is installed (Windows only) ───────────
24
+ if (process.platform === 'win32') {
25
+ const pkgName = process.arch === 'arm64'
26
+ ? '@opentui/core-win32-arm64'
27
+ : '@opentui/core-win32-x64';
28
+ const expected = join(projectRoot, 'node_modules', '@opentui', pkgName.replace('@opentui/', ''));
13
29
 
14
- try {
15
- console.log('[1/2] Patching react-reconciler for ESM compatibility...');
16
- const pkgPath = join(__dirname, '..', 'node_modules', 'react-reconciler', 'package.json');
17
- const pkg = JSON.parse(readFileSync(pkgPath, 'utf-8'));
18
- if (!pkg.exports) {
19
- pkg.exports = {
20
- '.': './index.js',
21
- './constants': './constants.js',
22
- './reflection': './reflection.js',
23
- './package.json': './package.json',
24
- };
25
- writeFileSync(pkgPath, JSON.stringify(pkg, null, 2) + '\n', 'utf-8');
26
- console.log(' ✓ React-reconciler patched\n');
27
- results.push(['React-reconciler patch', 'success']);
30
+ if (existsSync(expected)) {
31
+ log(`✓ ${pkgName} already installed`);
28
32
  } else {
29
- console.log(' ✓ Already patched\n');
30
- results.push(['React-reconciler patch', 'skipped']);
33
+ log(`⚠ ${pkgName} missing — installing (this optionalDependency is sometimes skipped by npm)`);
34
+ // shell:true needed on Windows so `npm` resolves through npm.cmd
35
+ const ok = run('npm', [
36
+ 'install', '--no-save', '--no-audit', '--no-fund', `${pkgName}@0.4.1`,
37
+ ], { cwd: projectRoot, shell: true });
38
+ if (!ok) log(`⚠ failed to install ${pkgName} — TUI may fail to start`);
39
+ else log(`✓ ${pkgName} installed`);
31
40
  }
32
- } catch (e) {
33
- console.warn(' ⚠ Could not patch react-reconciler:', e.message, '\n');
34
- results.push(['React-reconciler patch', 'failed']);
35
41
  }
36
42
 
43
+ // ─── 2. Hint about Bun (don't auto-install on Windows — UAC prompt) ───────
37
44
  try {
38
- console.log('[2/2] Downloading CloakBrowser stealth Chromium binary...');
39
- console.log(' (This may take 1-2 minutes on first install)');
40
- const { ensureBinary } = await import('cloakbrowser');
41
- const binaryPath = await ensureBinary();
42
- console.log(' ✓ CloakBrowser binary ready:', binaryPath, '\n');
43
- results.push(['CloakBrowser binary', 'success']);
44
- } catch (e) {
45
- console.warn(' ⚠ CloakBrowser binary download skipped:', e.message);
46
- console.warn(' Browser automation features will not be available.');
47
- console.warn(' To fix: ensure internet access and run "npm install" again.\n');
48
- results.push(['CloakBrowser binary', 'failed']);
45
+ execSync('bun --version', { stdio: 'ignore' });
46
+ log(' Bun already installed');
47
+ } catch {
48
+ if (process.platform === 'win32') {
49
+ log('');
50
+ log(' Bun not found. Bun is RECOMMENDED on Windows because it has');
51
+ log(' built-in FFI (no --experimental-ffi flag needed).');
52
+ log('');
53
+ log(' To install, run in PowerShell:');
54
+ log(' powershell -c "irm bun.sh/install.ps1 | iex"');
55
+ log('');
56
+ log(' Skipping auto-install to avoid UAC prompts in non-interactive mode.');
57
+ } else {
58
+ log('Installing Bun...');
59
+ if (run('bash', ['-c', 'curl -fsSL https://bun.sh/install | bash'])) {
60
+ log('✓ Bun installed');
61
+ } else {
62
+ log('⚠ Bun install failed — aurix will fall back to Node');
63
+ }
64
+ }
49
65
  }
50
66
 
51
- console.log('╔═══════════════════════════════════════════════════════════╗');
52
- console.log('║ Installation Summary ║');
53
- console.log('╚═══════════════════════════════════════════════════════════╝');
54
-
55
- for (const [name, status] of results) {
56
- const icon = status === 'success' ? '✓' : status === 'skipped' ? '⊘' : '⚠';
57
- console.log(` ${icon} ${name}: ${status}`);
67
+ // ─── 3. Node FFI probe (informative) ──────────────────────────────────────
68
+ try {
69
+ execSync(`"${process.execPath}" -e "require(\\"node:ffi\\")"`, { stdio: 'ignore' });
70
+ log('✓ node:ffi available without flag');
71
+ } catch {
72
+ let flagWorks = false;
73
+ try {
74
+ execSync(`"${process.execPath}" --experimental-ffi -e "0"`, { stdio: 'ignore' });
75
+ flagWorks = true;
76
+ } catch {}
77
+ if (flagWorks) {
78
+ log('ℹ node:ffi requires --experimental-ffi (launcher injects it automatically)');
79
+ } else {
80
+ log('⚠ node:ffi not available on this Node build.');
81
+ log(' Install Bun (recommended) or use official Node from nodejs.org.');
82
+ }
58
83
  }
59
84
 
60
- console.log('\n╔═══════════════════════════════════════════════════════════╗');
61
- console.log('║ Setup complete! Run "aurix" to start the agent.');
62
- console.log('║ For issues: https://github.com/DekaPrayoga/AurixAgent ║');
63
- console.log('╚═══════════════════════════════════════════════════════════╝\n');
85
+ log('');
86
+ log(' postinstall complete. Run `aurix` to start.');