agentgui 1.0.579 → 1.0.581
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 +0 -10
- package/package.json +1 -1
- package/static/js/client.js +25 -0
package/database.js
CHANGED
|
@@ -1060,19 +1060,9 @@ export const queries = {
|
|
|
1060
1060
|
}
|
|
1061
1061
|
|
|
1062
1062
|
const deleteAllStmt = db.transaction(() => {
|
|
1063
|
-
const allSessionIds = prep('SELECT id FROM sessions').all().map(r => r.id);
|
|
1064
|
-
|
|
1065
1063
|
prep('DELETE FROM stream_updates');
|
|
1066
1064
|
prep('DELETE FROM chunks');
|
|
1067
1065
|
prep('DELETE FROM events');
|
|
1068
|
-
|
|
1069
|
-
if (allSessionIds.length > 0) {
|
|
1070
|
-
const placeholders = allSessionIds.map(() => '?').join(',');
|
|
1071
|
-
db.prepare(`DELETE FROM stream_updates WHERE sessionId IN (${placeholders})`).run(...allSessionIds);
|
|
1072
|
-
db.prepare(`DELETE FROM chunks WHERE sessionId IN (${placeholders})`).run(...allSessionIds);
|
|
1073
|
-
db.prepare(`DELETE FROM events WHERE sessionId IN (${placeholders})`).run(...allSessionIds);
|
|
1074
|
-
}
|
|
1075
|
-
|
|
1076
1066
|
prep('DELETE FROM sessions');
|
|
1077
1067
|
prep('DELETE FROM messages');
|
|
1078
1068
|
prep('DELETE FROM conversations');
|
package/package.json
CHANGED
package/static/js/client.js
CHANGED
|
@@ -699,6 +699,9 @@ class AgentGUIClient {
|
|
|
699
699
|
case 'conversation_created':
|
|
700
700
|
this.handleConversationCreated(data);
|
|
701
701
|
break;
|
|
702
|
+
case 'all_conversations_deleted':
|
|
703
|
+
this.handleAllConversationsDeleted(data);
|
|
704
|
+
break;
|
|
702
705
|
case 'message_created':
|
|
703
706
|
this.handleMessageCreated(data);
|
|
704
707
|
break;
|
|
@@ -750,6 +753,12 @@ class AgentGUIClient {
|
|
|
750
753
|
this._serverProcessingEstimate = 0.7 * this._serverProcessingEstimate + 0.3 * serverTime;
|
|
751
754
|
}
|
|
752
755
|
|
|
756
|
+
// Always subscribe to the session so blocks are not lost regardless of which conversation is active
|
|
757
|
+
if (this.wsManager.isConnected) {
|
|
758
|
+
this.wsManager.subscribeToSession(data.sessionId);
|
|
759
|
+
this.wsManager.sendMessage({ type: 'subscribe', conversationId: data.conversationId });
|
|
760
|
+
}
|
|
761
|
+
|
|
753
762
|
// If this streaming event is for a different conversation than what we are viewing,
|
|
754
763
|
// just track the state but do not modify the DOM or start polling
|
|
755
764
|
if (this.state.currentConversation?.id !== data.conversationId) {
|
|
@@ -757,6 +766,14 @@ class AgentGUIClient {
|
|
|
757
766
|
this.state.streamingConversations.set(data.conversationId, true);
|
|
758
767
|
this.updateBusyPromptArea(data.conversationId);
|
|
759
768
|
this.emit('streaming:start', data);
|
|
769
|
+
|
|
770
|
+
// Auto-load if no conversation is currently selected (e.g. server resumed on startup)
|
|
771
|
+
if (!this.state.currentConversation && !this._isLoadingConversation) {
|
|
772
|
+
this._isLoadingConversation = true;
|
|
773
|
+
this.loadConversationMessages(data.conversationId).finally(() => {
|
|
774
|
+
this._isLoadingConversation = false;
|
|
775
|
+
});
|
|
776
|
+
}
|
|
760
777
|
return;
|
|
761
778
|
}
|
|
762
779
|
|
|
@@ -1300,6 +1317,14 @@ class AgentGUIClient {
|
|
|
1300
1317
|
this.enableControls();
|
|
1301
1318
|
}
|
|
1302
1319
|
|
|
1320
|
+
handleAllConversationsDeleted(data) {
|
|
1321
|
+
this.state.currentConversation = null;
|
|
1322
|
+
window.dispatchEvent(new CustomEvent('conversation-deselected'));
|
|
1323
|
+
if (window.conversationManager) {
|
|
1324
|
+
window.conversationManager.loadConversations();
|
|
1325
|
+
}
|
|
1326
|
+
}
|
|
1327
|
+
|
|
1303
1328
|
isHtmlContent(text) {
|
|
1304
1329
|
const htmlPattern = /<(?:div|table|section|article|ul|ol|dl|nav|header|footer|main|aside|figure|details|summary|h[1-6]|p|blockquote|pre|code|span|strong|em|a|img|br|hr|li|td|tr|th|thead|tbody|tfoot)\b[^>]*>/i;
|
|
1305
1330
|
return htmlPattern.test(text);
|