nothumanallowed 9.9.5 → 9.9.7
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 +1 -1
- package/src/commands/ui.mjs +22 -48
- package/src/constants.mjs +1 -1
- package/src/services/web-ui.mjs +3 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nothumanallowed",
|
|
3
|
-
"version": "9.9.
|
|
3
|
+
"version": "9.9.7",
|
|
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": {
|
package/src/commands/ui.mjs
CHANGED
|
@@ -1869,56 +1869,30 @@ export async function cmdUI(args) {
|
|
|
1869
1869
|
|
|
1870
1870
|
const server = http.createServer(handleRequest);
|
|
1871
1871
|
|
|
1872
|
-
// ── WebSocket
|
|
1873
|
-
|
|
1874
|
-
const
|
|
1875
|
-
|
|
1876
|
-
|
|
1877
|
-
|
|
1878
|
-
|
|
1879
|
-
|
|
1880
|
-
|
|
1881
|
-
|
|
1882
|
-
|
|
1883
|
-
|
|
1884
|
-
|
|
1885
|
-
|
|
1886
|
-
|
|
1887
|
-
|
|
1888
|
-
|
|
1889
|
-
|
|
1890
|
-
// Connect to daemon WS on port 3848 and relay messages
|
|
1891
|
-
let daemonWs = null;
|
|
1892
|
-
try {
|
|
1893
|
-
const daemonReq = http.request({
|
|
1894
|
-
hostname: '127.0.0.1', port: 3848, path: '/',
|
|
1895
|
-
headers: { 'Upgrade': 'websocket', 'Connection': 'Upgrade', 'Sec-WebSocket-Key': crypto.randomBytes(16).toString('base64'), 'Sec-WebSocket-Version': '13' },
|
|
1896
|
-
});
|
|
1897
|
-
daemonReq.on('upgrade', (res, daemonSocket) => {
|
|
1898
|
-
daemonWs = daemonSocket;
|
|
1899
|
-
// Relay daemon → browser
|
|
1900
|
-
daemonSocket.on('data', (buf) => { try { socket.write(buf); } catch {} });
|
|
1901
|
-
daemonSocket.on('close', () => {});
|
|
1902
|
-
daemonSocket.on('error', () => {});
|
|
1903
|
-
});
|
|
1904
|
-
daemonReq.on('error', () => {}); // daemon not running — WS works without it
|
|
1905
|
-
daemonReq.end();
|
|
1906
|
-
} catch {}
|
|
1872
|
+
// ── WebSocket server (ws package) — relay daemon events to browser ──
|
|
1873
|
+
try {
|
|
1874
|
+
const { WebSocketServer } = await import('ws');
|
|
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 {}
|
|
1907
1889
|
|
|
1908
|
-
|
|
1909
|
-
|
|
1910
|
-
if (buf.length < 2) return;
|
|
1911
|
-
const opcode = buf[0] & 0x0f;
|
|
1912
|
-
if (opcode === 0x08) { socket.end(); if (daemonWs) daemonWs.end(); return; }
|
|
1913
|
-
if (opcode === 0x09) { // ping → pong
|
|
1914
|
-
const pong = Buffer.alloc(2);
|
|
1915
|
-
pong[0] = 0x8a; pong[1] = 0;
|
|
1916
|
-
socket.write(pong);
|
|
1917
|
-
}
|
|
1890
|
+
browserWs.on('close', () => { if (daemonWs) try { daemonWs.close(); } catch {} });
|
|
1891
|
+
browserWs.on('error', () => { if (daemonWs) try { daemonWs.close(); } catch {} });
|
|
1918
1892
|
});
|
|
1919
|
-
|
|
1920
|
-
|
|
1921
|
-
}
|
|
1893
|
+
} catch {
|
|
1894
|
+
// ws package not available — live updates disabled, everything else works
|
|
1895
|
+
}
|
|
1922
1896
|
|
|
1923
1897
|
server.on('error', (err) => {
|
|
1924
1898
|
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 = '9.9.
|
|
8
|
+
export const VERSION = '9.9.7';
|
|
9
9
|
export const BASE_URL = 'https://nothumanallowed.com/cli';
|
|
10
10
|
export const API_BASE = 'https://nothumanallowed.com/api/v1';
|
|
11
11
|
|
package/src/services/web-ui.mjs
CHANGED
|
@@ -1924,11 +1924,11 @@ function showToast(type, title, body, durationMs) {
|
|
|
1924
1924
|
var ws = null;
|
|
1925
1925
|
var wsReconnectTimer = null;
|
|
1926
1926
|
var wsRetryCount = 0;
|
|
1927
|
-
var wsMaxRetries =
|
|
1927
|
+
var wsMaxRetries = 1;
|
|
1928
1928
|
function connectWebSocket() {
|
|
1929
1929
|
if (wsRetryCount >= wsMaxRetries) return; // Stop trying after 3 failures
|
|
1930
1930
|
try {
|
|
1931
|
-
ws = new WebSocket('ws://' + window.location.host
|
|
1931
|
+
ws = new WebSocket('ws://' + window.location.host);
|
|
1932
1932
|
} catch(e) { return; }
|
|
1933
1933
|
|
|
1934
1934
|
ws.onopen = function() {
|
|
@@ -1953,7 +1953,7 @@ function connectWebSocket() {
|
|
|
1953
1953
|
wsReconnectTimer = setTimeout(function() {
|
|
1954
1954
|
wsReconnectTimer = null;
|
|
1955
1955
|
connectWebSocket();
|
|
1956
|
-
},
|
|
1956
|
+
}, 3000); // 3s between retries
|
|
1957
1957
|
}
|
|
1958
1958
|
};
|
|
1959
1959
|
|