evals 2.2.5 → 2.2.6

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": "evals",
3
- "version": "2.2.5",
3
+ "version": "2.2.6",
4
4
  "description": "Arize evals package",
5
5
  "type": "module",
6
6
  "main": "cli.js",
@@ -2,30 +2,50 @@ import { spawn } from 'child_process';
2
2
  import { openSync } from 'fs';
3
3
 
4
4
  function tryOpenTTY() {
5
- try {
6
- const device = process.platform === 'win32' ? 'CON' : '/dev/tty';
7
- openSync(device, 'r');
8
- return { device, available: true };
9
- } catch (err) {
5
+ if (process.platform === 'win32') {
6
+ // On Windows, avoid CON device (issues in Node.js 22)
7
+ // Use isTTY check instead, and stdio: 'inherit' for spawning
8
+ if (process.stdin.isTTY && process.stdout.isTTY && process.stderr.isTTY) {
9
+ return { available: true, useInherit: true };
10
+ }
10
11
  return { available: false };
12
+ } else {
13
+ // On macOS/Linux, use direct /dev/tty access
14
+ try {
15
+ const device = '/dev/tty';
16
+ openSync(device, 'r');
17
+ return { device, available: true, useInherit: false };
18
+ } catch (err) {
19
+ return { available: false };
20
+ }
11
21
  }
12
22
  }
13
23
 
14
24
  const tty = tryOpenTTY();
15
25
 
16
26
  if (tty.available) {
17
- const child = spawn('node', ['./cli.js'], {
18
- stdio: [
19
- openSync(tty.device, 'r'),
20
- openSync(tty.device, 'w'),
21
- openSync(tty.device, 'w')
22
- ]
23
- });
27
+ const spawnOptions = tty.useInherit
28
+ ? { stdio: 'inherit', shell: true }
29
+ : {
30
+ stdio: [
31
+ openSync(tty.device, 'r'),
32
+ openSync(tty.device, 'w'),
33
+ openSync(tty.device, 'w')
34
+ ]
35
+ };
36
+
37
+ const child = spawn('node', ['./cli.js'], spawnOptions);
24
38
 
25
39
  child.on('close', (code) => {
26
- process.exit(code);
40
+ process.exit(code || 0);
41
+ });
42
+
43
+ child.on('error', (err) => {
44
+ console.error('Failed to start interactive CLI:', err.message);
45
+ console.log('Run `npx evals` to complete setup.');
46
+ process.exit(1);
27
47
  });
28
48
  } else {
29
49
  console.log('Run `npx evals` to complete setup.');
30
- process.exit(1)
50
+ process.exit(1);
31
51
  }