nothumanallowed 6.4.2 → 6.4.3

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": "6.4.2",
3
+ "version": "6.4.3",
4
4
  "description": "NotHumanAllowed — 38 AI agents for security, code, DevOps, data & daily ops. Per-agent memory, Telegram + Discord auto-responder, proactive intelligence daemon, voice chat, plugin system.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -490,6 +490,11 @@ export async function cmdUI(args) {
490
490
  // ── Route Handlers ──────────────────────────────────────────────────────
491
491
 
492
492
  async function handleRequest(req, res) {
493
+ // Skip WebSocket upgrade requests — handled by server.on('upgrade')
494
+ if (req.headers.upgrade && req.headers.upgrade.toLowerCase() === 'websocket') {
495
+ return; // Don't respond — let the upgrade event handle it
496
+ }
497
+
493
498
  const start = Date.now();
494
499
  const url = new URL(req.url, `http://${HOST}:${port}`);
495
500
  const pathname = url.pathname;
@@ -533,8 +538,8 @@ export async function cmdUI(args) {
533
538
  return;
534
539
  }
535
540
 
536
- // ── Favicon + Apple touch icons (no-content, suppress 404) ────────
537
- if (pathname === '/favicon.ico' || pathname.startsWith('/apple-touch-icon')) {
541
+ // ── Favicon + Apple touch icons + browser probes (suppress 404) ────
542
+ if (pathname === '/favicon.ico' || pathname.startsWith('/apple-touch-icon') || pathname.startsWith('/.well-known')) {
538
543
  res.writeHead(204);
539
544
  res.end();
540
545
  return;
@@ -887,12 +892,10 @@ export async function cmdUI(args) {
887
892
 
888
893
  const server = http.createServer(handleRequest);
889
894
 
890
- // ── WebSocket on separate port (3848) to avoid HTTP handler conflicts ──
891
- const wsPort = port + 1; // 3848 when port is 3847
892
- const wsHttpServer = http.createServer((req, res) => { res.writeHead(426); res.end(); });
895
+ // ── WebSocket on same port as HTTP (upgrade handler) ──────────────────
893
896
  const wsClients = new Set();
894
897
 
895
- wsHttpServer.on('upgrade', (req, socket, head) => {
898
+ server.on('upgrade', (req, socket, head) => {
896
899
  const key = req.headers['sec-websocket-key'];
897
900
  if (!key) { socket.destroy(); return; }
898
901
 
@@ -921,9 +924,6 @@ export async function cmdUI(args) {
921
924
  socket.on('error', () => wsClients.delete(socket));
922
925
  });
923
926
 
924
- wsHttpServer.on('error', () => {}); // Silently ignore if port busy
925
- wsHttpServer.listen(wsPort, HOST, () => {});
926
-
927
927
  server.on('error', (err) => {
928
928
  if (err.code === 'EADDRINUSE') {
929
929
  fail(`Port ${port} is already in use. Try: nha ui --port=${port + 1}`);
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 = '6.4.2';
8
+ export const VERSION = '6.4.3';
9
9
  export const BASE_URL = 'https://nothumanallowed.com/cli';
10
10
  export const API_BASE = 'https://nothumanallowed.com/api/v1';
11
11
 
@@ -880,8 +880,7 @@ var ws = null;
880
880
  var wsReconnectTimer = null;
881
881
  function connectWebSocket() {
882
882
  try {
883
- var wsPort = parseInt(window.location.port || '3847') + 1;
884
- ws = new WebSocket('ws://' + window.location.hostname + ':' + wsPort);
883
+ ws = new WebSocket('ws://' + window.location.host);
885
884
  } catch(e) { return; }
886
885
 
887
886
  ws.onopen = function() {