aurix-ai 2.7.7 → 2.7.8

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.
Files changed (2) hide show
  1. package/bin/aurix.js +45 -13
  2. package/package.json +1 -1
package/bin/aurix.js CHANGED
@@ -19,23 +19,55 @@ try {
19
19
  runtime = 'bun';
20
20
  } catch {}
21
21
 
22
+ // Use shell: false with an absolute path to the Node binary. shell: true
23
+ // triggers DEP0190 (args concatenated without escaping). process.execPath
24
+ // points at the real node.exe even when launched through a .cmd shim on
25
+ // Windows, so spawn() works without shell: true.
26
+ let runtimeBin = process.execPath;
27
+ if (runtime === 'bun') {
28
+ try {
29
+ runtimeBin = execSync('bun -e "process.stdout.write(process.execPath)"', { encoding: 'utf8' }).trim() || 'bun';
30
+ } catch {
31
+ runtimeBin = 'bun';
32
+ }
33
+ }
34
+
22
35
  const nodeArgs = [];
23
- if (runtime === 'node') {
24
- // node:ffi is still experimental in Node 22.5+ / 24.x. Without this flag,
25
- // OpenTUI's backend loader falls back to an "FFI unavailable" stub and the
26
- // whole TUI refuses to start (this is what bit us on Windows).
27
- // Don't double-inject if the user (or a parent process) already passed it.
28
- const execArgv = process.execArgv || [];
29
- const hasFlag = execArgv.some(a =>
30
- a === '--experimental-ffi' || a.startsWith('--experimental-ffi=')
31
- );
32
- if (!hasFlag) nodeArgs.push('--experimental-ffi');
36
+ let selfRelaunch = false;
37
+
38
+ if (runtime === 'node' && !process.env.AURIX_RELAUNCHED) {
39
+ // OpenTUI's backend does `require("node:ffi")` which is experimental in
40
+ // Node 22.5+. Probe whether it already works without a flag, and only
41
+ // inject --experimental-ffi if it actually fails AND the flag is valid
42
+ // on this Node build. If neither works, launch without the flag and let
43
+ // the in-process fallback render a diagnostic message.
44
+ let needsFlag = false;
45
+ try {
46
+ execSync(`"${runtimeBin}" -e "require(\\"node:ffi\\")"`, { stdio: 'ignore' });
47
+ } catch {
48
+ needsFlag = true;
49
+ }
50
+
51
+ if (needsFlag) {
52
+ let flagWorks = false;
53
+ try {
54
+ execSync(`"${runtimeBin}" --experimental-ffi -e "0"`, { stdio: 'ignore' });
55
+ flagWorks = true;
56
+ } catch {}
57
+
58
+ if (flagWorks) {
59
+ nodeArgs.push('--experimental-ffi');
60
+ selfRelaunch = true;
61
+ }
62
+ }
33
63
  }
34
64
 
35
- const child = spawn(runtime, [...nodeArgs, dist, ...process.argv.slice(2)], {
65
+ const env = { ...process.env, AURIX_HOME: join(__dirname, '..') };
66
+ if (selfRelaunch) env.AURIX_RELAUNCHED = '1';
67
+
68
+ const child = spawn(runtimeBin, [...nodeArgs, dist, ...process.argv.slice(2)], {
36
69
  stdio: 'inherit',
37
- env: { ...process.env, AURIX_HOME: join(__dirname, '..') },
38
- shell: process.platform === 'win32',
70
+ env,
39
71
  });
40
72
 
41
73
  child.on('close', (code) => process.exit(code ?? 0));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aurix-ai",
3
- "version": "2.7.7",
3
+ "version": "2.7.8",
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",