nothumanallowed 16.0.30 → 16.0.31

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": "16.0.30",
3
+ "version": "16.0.31",
4
4
  "description": "Local AI assistant: 80 tools (Gmail, Calendar, Drive, GitHub, Slack, browser, code, files), 38 agents, visual workflows (Studio, AWF, WebCraft). Install with `npm i -g nothumanallowed`, run with `nha ui`. Free tier built-in (Liara), no API key required. Your data stays on your PC — OAuth tokens local, no cloud. Open-source MIT.",
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 = '16.0.30';
8
+ export const VERSION = '16.0.31';
9
9
  export const BASE_URL = 'https://nothumanallowed.com/cli';
10
10
  export const API_BASE = 'https://nothumanallowed.com/api/v1';
11
11
 
@@ -3529,6 +3529,38 @@ function _patchEntry(projectDir, entryFile, shimDir, port) {
3529
3529
  `process.env.HOST = '0.0.0.0';`,
3530
3530
  `process.env.NODE_ENV = 'development';`,
3531
3531
  `require('${shimAbs}');`,
3532
+ `// Force-bind to NHA's assigned port even when the app hardcodes a port`,
3533
+ `// like 3000/5000/8080. Monkey-patch http.Server.prototype.listen so the`,
3534
+ `// FIRST positional numeric arg is replaced with our port. This prevents`,
3535
+ `// "Connessione negata" when the iframe targets ${port} but the app picked`,
3536
+ `// a different port internally.`,
3537
+ `(function(){`,
3538
+ ` const http = require('http');`,
3539
+ ` const NHA_PORT = ${port};`,
3540
+ ` const _origListen = http.Server.prototype.listen;`,
3541
+ ` let _bound = false;`,
3542
+ ` http.Server.prototype.listen = function(...args) {`,
3543
+ ` if (_bound) return _origListen.apply(this, args);`,
3544
+ ` if (typeof args[0] === 'object' && args[0] !== null && 'port' in args[0]) {`,
3545
+ ` const requested = args[0].port;`,
3546
+ ` if (requested !== NHA_PORT && requested !== 0) {`,
3547
+ ` console.log('[nha-launcher] app requested port ' + requested + ', forcing to NHA_PORT=' + NHA_PORT);`,
3548
+ ` args[0] = Object.assign({}, args[0], { port: NHA_PORT, host: '0.0.0.0' });`,
3549
+ ` }`,
3550
+ ` } else if (typeof args[0] === 'number' || typeof args[0] === 'string') {`,
3551
+ ` const requested = parseInt(args[0]);`,
3552
+ ` if (!isNaN(requested) && requested !== NHA_PORT && requested !== 0) {`,
3553
+ ` console.log('[nha-launcher] app requested port ' + requested + ', forcing to NHA_PORT=' + NHA_PORT);`,
3554
+ ` args[0] = NHA_PORT;`,
3555
+ ` // If second positional was host, replace with 0.0.0.0; otherwise insert`,
3556
+ ` if (typeof args[1] === 'string') args[1] = '0.0.0.0';`,
3557
+ ` else if (typeof args[1] === 'function') args.splice(1, 0, '0.0.0.0');`,
3558
+ ` }`,
3559
+ ` }`,
3560
+ ` _bound = true;`,
3561
+ ` return _origListen.apply(this, args);`,
3562
+ ` };`,
3563
+ `})();`,
3532
3564
  `// Inject error reporter into HTML responses`,
3533
3565
  `const _nhaErrScript = require('fs').readFileSync('${path.join(shimDir, 'error-reporter.html').replace(/\\/g, '/')}', 'utf-8');`,
3534
3566
  `const _origWrite = require('http').ServerResponse.prototype.write;`,