agentgui 1.0.559 → 1.0.561

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": "agentgui",
3
- "version": "1.0.559",
3
+ "version": "1.0.561",
4
4
  "description": "Multi-agent ACP client with real-time communication",
5
5
  "type": "module",
6
6
  "main": "server.js",
package/server.js CHANGED
@@ -4462,8 +4462,19 @@ function recoverStaleSessions() {
4462
4462
 
4463
4463
  async function resumeInterruptedStreams() {
4464
4464
  try {
4465
- const resumableConvs = queries.getResumableConversations ? queries.getResumableConversations() : [];
4466
- const toResume = resumableConvs;
4465
+ // Get conversations marked as streaming in database (isStreaming=1)
4466
+ // Fall back to getResumableConversations if isStreaming is not being used
4467
+ let toResume = [];
4468
+
4469
+ // Primary: Check database isStreaming flag for conversations still marked as active
4470
+ const streamingConvs = queries.getConversations().filter(c => c.isStreaming === 1);
4471
+
4472
+ if (streamingConvs.length > 0) {
4473
+ toResume = streamingConvs;
4474
+ } else {
4475
+ // Fallback: Use session-based resumable conversations
4476
+ toResume = queries.getResumableConversations ? queries.getResumableConversations() : [];
4477
+ }
4467
4478
 
4468
4479
  if (toResume.length === 0) return;
4469
4480
 
@@ -2515,7 +2515,8 @@ class AgentGUIClient {
2515
2515
  this.conversationCache.delete(conversationId);
2516
2516
  this.syncPromptState(conversationId);
2517
2517
  this.restoreScrollPosition(conversationId);
2518
- this.enableControls();
2518
+ // Prompt state is immutable: computed from shouldResumeStreaming via syncPromptState
2519
+ // Do not call enableControls/disableControls here - prompt state is determined by streaming status
2519
2520
  return;
2520
2521
  }
2521
2522
  }
@@ -2556,6 +2557,13 @@ class AgentGUIClient {
2556
2557
  const shouldResumeStreaming = latestSession &&
2557
2558
  (latestSession.status === 'active' || latestSession.status === 'pending');
2558
2559
 
2560
+ // IMMUTABLE: Update streaming state and disable prompt atomically
2561
+ if (shouldResumeStreaming) {
2562
+ this.state.streamingConversations.set(conversationId, true);
2563
+ } else {
2564
+ this.state.streamingConversations.delete(conversationId);
2565
+ }
2566
+
2559
2567
  if (this.ui.messageInput) {
2560
2568
  this.ui.messageInput.disabled = shouldResumeStreaming;
2561
2569
  }
@@ -2747,8 +2755,11 @@ class AgentGUIClient {
2747
2755
  }
2748
2756
 
2749
2757
  syncPromptState(conversationId) {
2750
- const isStreaming = this.state.streamingConversations.has(conversationId);
2758
+ const conversation = this.state.currentConversation;
2759
+ if (!conversation || conversation.id !== conversationId) return;
2760
+
2751
2761
  if (this.ui.messageInput) {
2762
+ const isStreaming = this.state.streamingConversations.has(conversationId);
2752
2763
  if (isStreaming) {
2753
2764
  this.ui.messageInput.disabled = true;
2754
2765
  } else {