nothumanallowed 15.1.31 → 15.1.32

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": "nothumanallowed",
3
- "version": "15.1.31",
3
+ "version": "15.1.32",
4
4
  "description": "NotHumanAllowed — 38 AI agents, 80 tools, Studio (visual agentic workflows). Email, calendar, browser automation, screen capture, canvas, cron/heartbeat, Alexandria E2E messaging, GitHub, Notion, Slack, voice chat, free AI (Liara), 28 languages. Zero-dependency CLI.",
5
5
  "type": "module",
6
6
  "bin": {
package/src/constants.mjs CHANGED
@@ -5,7 +5,7 @@ import { fileURLToPath } from 'url';
5
5
  const __filename = fileURLToPath(import.meta.url);
6
6
  const __dirname = path.dirname(__filename);
7
7
 
8
- export const VERSION = '15.1.31';
8
+ export const VERSION = '15.1.32';
9
9
  export const BASE_URL = 'https://nothumanallowed.com/cli';
10
10
  export const API_BASE = 'https://nothumanallowed.com/api/v1';
11
11
 
@@ -14,9 +14,15 @@
14
14
 
15
15
  import fs from 'fs';
16
16
  import path from 'path';
17
- import { exec, spawn } from 'child_process';
18
- import { createServer } from 'net';
17
+ import { exec, spawn, execSync } from 'child_process';
18
+ import { createServer, Socket } from 'net';
19
19
  import { promisify } from 'util';
20
+ import { createRequire } from 'module';
21
+ // `require` shim for the rare spots where CJS-style require() was historically
22
+ // used in this ESM file. Without this, every `require(...)` here throws
23
+ // "ReferenceError: require is not defined" — which is exactly the bug that
24
+ // took 31 releases to diagnose because it surfaced in the SSE error channel.
25
+ const require = createRequire(import.meta.url);
20
26
  import { sendJSON, sendError, parseBody, sendSSE } from '../index.mjs';
21
27
  import { loadConfig } from '../../config.mjs';
22
28
  import { callLLM, callLLMStream, callLLMWithTools, getApiKey, fixQwen3BPE } from '../../services/llm.mjs';
@@ -2410,9 +2416,9 @@ export function register(router) {
2410
2416
  path.resolve(__dir, '../../../node_modules/.bin/tsc'),
2411
2417
  path.resolve(__dir, '../../../../node_modules/.bin/tsc'),
2412
2418
  ];
2413
- // Also try global
2419
+ // Also try global — execSync imported at top of file (ESM).
2414
2420
  try {
2415
- const globalTsc = require('child_process').execSync('which tsc 2>/dev/null || where tsc 2>nul', { encoding: 'utf-8', timeout: 3000 }).trim();
2421
+ const globalTsc = execSync('which tsc 2>/dev/null || where tsc 2>nul', { encoding: 'utf-8', timeout: 3000 }).trim();
2416
2422
  if (globalTsc) candidates.push(globalTsc);
2417
2423
  } catch {}
2418
2424
  for (const c of candidates) {
@@ -3525,8 +3531,11 @@ function _waitForPort(port, timeoutMs) {
3525
3531
  return new Promise((resolve) => {
3526
3532
  const deadline = Date.now() + timeoutMs;
3527
3533
  const check = () => {
3528
- // Try to connect to the port if connection succeeds, the server is listening
3529
- const { Socket } = require('net');
3534
+ // Use the ESM-imported SocketNEVER `require('net')` here, this file
3535
+ // is .mjs and `require` is not defined in ESM. The require call here
3536
+ // was the single root cause of "[error] require is not defined" with
3537
+ // no autofix flow visible — the crash happened INSIDE the nha ui
3538
+ // server itself (in this exact function), not in the child sandbox.
3530
3539
  const sock = new Socket();
3531
3540
  sock.setTimeout(500);
3532
3541
  sock.once('connect', () => { sock.destroy(); resolve(true); });