agentgui 1.0.392 → 1.0.393
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/server.js +8 -0
package/package.json
CHANGED
package/server.js
CHANGED
|
@@ -1825,6 +1825,12 @@ const server = http.createServer(async (req, res) => {
|
|
|
1825
1825
|
return;
|
|
1826
1826
|
}
|
|
1827
1827
|
|
|
1828
|
+
if (pathOnly === '/api/ws-stats' && req.method === 'GET') {
|
|
1829
|
+
const stats = wsOptimizer.getStats();
|
|
1830
|
+
sendJSON(req, res, 200, stats);
|
|
1831
|
+
return;
|
|
1832
|
+
}
|
|
1833
|
+
|
|
1828
1834
|
if (pathOnly === '/api/agents/search' && req.method === 'POST') {
|
|
1829
1835
|
const body = await parseBody(req);
|
|
1830
1836
|
const result = queries.searchAgents(discoveredAgents, body);
|
|
@@ -3732,6 +3738,7 @@ wss.on('connection', (ws, req) => {
|
|
|
3732
3738
|
ws.on('close', () => {
|
|
3733
3739
|
if (ws.terminalProc) { try { ws.terminalProc.kill(); } catch(e) {} ws.terminalProc = null; }
|
|
3734
3740
|
syncClients.delete(ws);
|
|
3741
|
+
wsOptimizer.removeClient(ws);
|
|
3735
3742
|
for (const sub of ws.subscriptions) {
|
|
3736
3743
|
const idx = subscriptionIndex.get(sub);
|
|
3737
3744
|
if (idx) { idx.delete(ws); if (idx.size === 0) subscriptionIndex.delete(sub); }
|
|
@@ -3785,6 +3792,7 @@ const heartbeatInterval = setInterval(() => {
|
|
|
3785
3792
|
syncClients.forEach(ws => {
|
|
3786
3793
|
if (!ws.isAlive) {
|
|
3787
3794
|
syncClients.delete(ws);
|
|
3795
|
+
wsOptimizer.removeClient(ws);
|
|
3788
3796
|
return ws.terminate();
|
|
3789
3797
|
}
|
|
3790
3798
|
ws.isAlive = false;
|