nothumanallowed 6.4.4 → 6.5.0

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.4",
3
+ "version": "6.5.0",
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": {
@@ -46,5 +46,8 @@
46
46
  "type": "git",
47
47
  "url": "https://github.com/adoslabsproject-gif/nothumanallowed"
48
48
  },
49
- "homepage": "https://nothumanallowed.com"
49
+ "homepage": "https://nothumanallowed.com",
50
+ "dependencies": {
51
+ "ws": "^8.18.0"
52
+ }
50
53
  }
@@ -490,11 +490,6 @@ 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
-
498
493
  const start = Date.now();
499
494
  const url = new URL(req.url, `http://${HOST}:${port}`);
500
495
  const pathname = url.pathname;
@@ -892,37 +887,17 @@ export async function cmdUI(args) {
892
887
 
893
888
  const server = http.createServer(handleRequest);
894
889
 
895
- // ── WebSocket on same port as HTTP (upgrade handler) ──────────────────
896
- const wsClients = new Set();
897
-
898
- server.on('upgrade', (req, socket, head) => {
899
- const key = req.headers['sec-websocket-key'];
900
- if (!key) { socket.destroy(); return; }
901
-
902
- const acceptKey = crypto
903
- .createHash('sha1')
904
- .update(key + '258EAFA5-E914-47DA-95CA-5AB5DC86C11B')
905
- .digest('base64');
906
-
907
- socket.write(
908
- 'HTTP/1.1 101 Switching Protocols\r\n' +
909
- 'Upgrade: websocket\r\n' +
910
- 'Connection: Upgrade\r\n' +
911
- `Sec-WebSocket-Accept: ${acceptKey}\r\n` +
912
- '\r\n'
913
- );
914
-
915
- wsClients.add(socket);
916
-
917
- socket.on('data', (buf) => {
918
- if (buf.length < 2) return;
919
- const opcode = buf[0] & 0x0f;
920
- if (opcode === 0x08) { wsClients.delete(socket); socket.end(); }
921
- if (opcode === 0x09) { socket.write(Buffer.from([0x8a, 0])); }
890
+ // ── WebSocket via ws package (compatible with Node.js 20-24+) ──────
891
+ let wss = null;
892
+ try {
893
+ const { WebSocketServer } = await import('ws');
894
+ wss = new WebSocketServer({ server });
895
+ wss.on('connection', (ws) => {
896
+ ws.on('error', () => {});
922
897
  });
923
- socket.on('close', () => wsClients.delete(socket));
924
- socket.on('error', () => wsClients.delete(socket));
925
- });
898
+ } catch {
899
+ // ws package not available — WS disabled, everything else works
900
+ }
926
901
 
927
902
  server.on('error', (err) => {
928
903
  if (err.code === 'EADDRINUSE') {
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.4';
8
+ export const VERSION = '6.5.0';
9
9
  export const BASE_URL = 'https://nothumanallowed.com/cli';
10
10
  export const API_BASE = 'https://nothumanallowed.com/api/v1';
11
11