agentgui 1.0.569 → 1.0.571

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.569",
3
+ "version": "1.0.571",
4
4
  "description": "Multi-agent ACP client with real-time communication",
5
5
  "type": "module",
6
6
  "main": "server.js",
@@ -272,7 +272,15 @@ class AgentGUIClient {
272
272
  if (window.conversationManager) {
273
273
  window.conversationManager.select(conversationId);
274
274
  } else {
275
- this.loadConversationMessages(conversationId).finally(() => {
275
+ this.loadConversationMessages(conversationId).catch((err) => {
276
+ console.warn('Failed to restore conversation from URL, loading latest instead:', err);
277
+ // If the URL conversation doesn't exist, try loading the most recent conversation
278
+ if (this.state.conversations && this.state.conversations.length > 0) {
279
+ const latestConv = this.state.conversations[0];
280
+ console.log('Loading latest conversation instead:', latestConv.id);
281
+ return this.loadConversationMessages(latestConv.id);
282
+ }
283
+ }).finally(() => {
276
284
  this._isLoadingConversation = false;
277
285
  });
278
286
  }
@@ -2488,6 +2496,8 @@ class AgentGUIClient {
2488
2496
  this._previousConvAbort = new AbortController();
2489
2497
  const convSignal = this._previousConvAbort.signal;
2490
2498
 
2499
+ const prevConversationId = this.state.currentConversation?.id;
2500
+ const availableFallback = this.state.conversations?.find(c => c.id !== conversationId) || null;
2491
2501
  this.cacheCurrentConversation();
2492
2502
  this.stopChunkPolling();
2493
2503
  this.removeScrollUpDetection();
@@ -2558,9 +2568,17 @@ class AgentGUIClient {
2558
2568
  console.warn('Conversation no longer exists:', conversationId);
2559
2569
  this.state.currentConversation = null;
2560
2570
  if (window.conversationManager) window.conversationManager.loadConversations();
2561
- const outputEl = document.getElementById('output');
2562
- if (outputEl) outputEl.innerHTML = '<p class="text-secondary" style="padding:2rem;text-align:center">Conversation not found. It may have been lost during a server restart.</p>';
2563
- this.enableControls();
2571
+ // Resume from last successful conversation if available, or fall back to any available conversation
2572
+ const fallbackConv = prevConversationId ? prevConversationId : availableFallback?.id;
2573
+ if (fallbackConv && fallbackConv !== conversationId) {
2574
+ console.log('Resuming from fallback conversation:', fallbackConv);
2575
+ this.showError('Conversation not found. Resuming previous conversation.');
2576
+ await this.loadConversationMessages(fallbackConv);
2577
+ } else {
2578
+ const outputEl = document.getElementById('output');
2579
+ if (outputEl) outputEl.innerHTML = '<p class="text-secondary" style="padding:2rem;text-align:center">Conversation not found. It may have been lost during a server restart.</p>';
2580
+ this.enableControls();
2581
+ }
2564
2582
  return;
2565
2583
  }
2566
2584
  throw e;
@@ -2779,7 +2797,20 @@ class AgentGUIClient {
2779
2797
  } catch (error) {
2780
2798
  if (error.name === 'AbortError') return;
2781
2799
  console.error('Failed to load conversation messages:', error);
2782
- this.showError('Failed to load conversation: ' + error.message);
2800
+ // Resume from last successful conversation if available, or fall back to any available conversation
2801
+ const fallbackConv = prevConversationId ? prevConversationId : availableFallback?.id;
2802
+ if (fallbackConv && fallbackConv !== conversationId) {
2803
+ console.log('Resuming from fallback conversation due to error:', fallbackConv);
2804
+ this.showError('Failed to load conversation. Resuming previous conversation.');
2805
+ try {
2806
+ await this.loadConversationMessages(fallbackConv);
2807
+ } catch (fallbackError) {
2808
+ console.error('Failed to resume fallback conversation:', fallbackError);
2809
+ this.showError('Failed to load conversation: ' + error.message);
2810
+ }
2811
+ } else {
2812
+ this.showError('Failed to load conversation: ' + error.message);
2813
+ }
2783
2814
  }
2784
2815
  }
2785
2816
 
@@ -751,7 +751,6 @@ class StreamingRenderer {
751
751
  if (block.id) details.dataset.toolUseId = block.id;
752
752
  details.classList.add(this._getBlockTypeClass('tool_use'));
753
753
  details.classList.add(this._getToolColorClass(toolName));
754
- details.open = true;
755
754
  const summary = document.createElement('summary');
756
755
  summary.className = 'folded-tool-bar';
757
756
  const displayName = this.getToolUseDisplayName(toolName);