nothumanallowed 9.9.4 → 9.9.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": "nothumanallowed",
3
- "version": "9.9.4",
3
+ "version": "9.9.6",
4
4
  "description": "NotHumanAllowed — 38 AI agents, 53 tools. Email, calendar, browser automation, screen capture, canvas, cron/heartbeat, GitHub, Notion, Slack, voice chat, 28 languages. Zero-dependency CLI.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -1869,16 +1869,29 @@ export async function cmdUI(args) {
1869
1869
 
1870
1870
  const server = http.createServer(handleRequest);
1871
1871
 
1872
- // ── WebSocket via ws package (compatible with Node.js 20-24+) ──────
1873
- let wss = null;
1872
+ // ── WebSocket server (ws package) relay daemon events to browser ──
1874
1873
  try {
1875
1874
  const { WebSocketServer } = await import('ws');
1876
- wss = new WebSocketServer({ server });
1877
- wss.on('connection', (ws) => {
1878
- ws.on('error', () => {});
1875
+ const wss = new WebSocketServer({ server });
1876
+
1877
+ wss.on('connection', (browserWs) => {
1878
+ // Connect to daemon WS on port 3848 and relay messages
1879
+ let daemonWs = null;
1880
+ try {
1881
+ const { WebSocket: WsClient } = require('ws');
1882
+ daemonWs = new WsClient('ws://127.0.0.1:3848');
1883
+ daemonWs.on('message', (data) => {
1884
+ if (browserWs.readyState === 1) browserWs.send(data.toString());
1885
+ });
1886
+ daemonWs.on('error', () => {});
1887
+ daemonWs.on('close', () => { daemonWs = null; });
1888
+ } catch {}
1889
+
1890
+ browserWs.on('close', () => { if (daemonWs) try { daemonWs.close(); } catch {} });
1891
+ browserWs.on('error', () => { if (daemonWs) try { daemonWs.close(); } catch {} });
1879
1892
  });
1880
1893
  } catch {
1881
- // ws package not available — WS disabled, everything else works
1894
+ // ws package not available — live updates disabled, everything else works
1882
1895
  }
1883
1896
 
1884
1897
  server.on('error', (err) => {
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 = '9.9.4';
8
+ export const VERSION = '9.9.6';
9
9
  export const BASE_URL = 'https://nothumanallowed.com/cli';
10
10
  export const API_BASE = 'https://nothumanallowed.com/api/v1';
11
11
 
@@ -1924,7 +1924,7 @@ function showToast(type, title, body, durationMs) {
1924
1924
  var ws = null;
1925
1925
  var wsReconnectTimer = null;
1926
1926
  var wsRetryCount = 0;
1927
- var wsMaxRetries = 3;
1927
+ var wsMaxRetries = 1;
1928
1928
  function connectWebSocket() {
1929
1929
  if (wsRetryCount >= wsMaxRetries) return; // Stop trying after 3 failures
1930
1930
  try {
@@ -1953,7 +1953,7 @@ function connectWebSocket() {
1953
1953
  wsReconnectTimer = setTimeout(function() {
1954
1954
  wsReconnectTimer = null;
1955
1955
  connectWebSocket();
1956
- }, 30000); // 30s between retries
1956
+ }, 3000); // 3s between retries
1957
1957
  }
1958
1958
  };
1959
1959