agentgui 1.0.151 → 1.0.152
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/database.js +87 -66
- package/package.json +1 -1
- package/server.js +245 -119
- package/static/js/client.js +7 -6
- package/static/js/websocket-manager.js +16 -27
- package/static/styles.css +0 -1989
package/static/js/client.js
CHANGED
|
@@ -544,12 +544,13 @@ class AgentGUIClient {
|
|
|
544
544
|
}
|
|
545
545
|
|
|
546
546
|
scrollToBottom() {
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
547
|
+
if (this._scrollRafPending) return;
|
|
548
|
+
this._scrollRafPending = true;
|
|
549
|
+
requestAnimationFrame(() => {
|
|
550
|
+
this._scrollRafPending = false;
|
|
551
|
+
const scrollContainer = document.getElementById('output-scroll');
|
|
552
|
+
if (scrollContainer) scrollContainer.scrollTop = scrollContainer.scrollHeight;
|
|
553
|
+
});
|
|
553
554
|
}
|
|
554
555
|
|
|
555
556
|
handleStreamingError(data) {
|
|
@@ -137,26 +137,23 @@ class WebSocketManager {
|
|
|
137
137
|
*/
|
|
138
138
|
onMessage(event) {
|
|
139
139
|
try {
|
|
140
|
-
const
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
140
|
+
const parsed = JSON.parse(event.data);
|
|
141
|
+
const messages = Array.isArray(parsed) ? parsed : [parsed];
|
|
142
|
+
this.stats.totalMessagesReceived += messages.length;
|
|
143
|
+
|
|
144
|
+
for (const data of messages) {
|
|
145
|
+
if (data.type === 'pong') {
|
|
146
|
+
const requestId = data.requestId;
|
|
147
|
+
if (requestId && this.requestMap.has(requestId)) {
|
|
148
|
+
const request = this.requestMap.get(requestId);
|
|
149
|
+
request.resolve({ latency: Date.now() - request.sentTime });
|
|
150
|
+
this.requestMap.delete(requestId);
|
|
151
|
+
}
|
|
152
|
+
continue;
|
|
150
153
|
}
|
|
151
|
-
return;
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
// Route message to listeners
|
|
155
|
-
this.emit('message', data);
|
|
156
154
|
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
this.emit(`message:${data.type}`, data);
|
|
155
|
+
this.emit('message', data);
|
|
156
|
+
if (data.type) this.emit(`message:${data.type}`, data);
|
|
160
157
|
}
|
|
161
158
|
} catch (error) {
|
|
162
159
|
console.error('WebSocket message parse error:', error);
|
|
@@ -234,15 +231,7 @@ class WebSocketManager {
|
|
|
234
231
|
* Start heartbeat/keepalive
|
|
235
232
|
*/
|
|
236
233
|
startHeartbeat() {
|
|
237
|
-
if (this.heartbeatTimer)
|
|
238
|
-
clearTimeout(this.heartbeatTimer);
|
|
239
|
-
}
|
|
240
|
-
|
|
241
|
-
this.heartbeatTimer = setInterval(() => {
|
|
242
|
-
if (this.isConnected) {
|
|
243
|
-
this.ping();
|
|
244
|
-
}
|
|
245
|
-
}, this.config.heartbeatInterval);
|
|
234
|
+
if (this.heartbeatTimer) clearTimeout(this.heartbeatTimer);
|
|
246
235
|
}
|
|
247
236
|
|
|
248
237
|
/**
|