agentgui 1.0.188 → 1.0.190

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.188",
3
+ "version": "1.0.190",
4
4
  "description": "Multi-agent ACP client with real-time communication",
5
5
  "type": "module",
6
6
  "main": "server.js",
@@ -977,6 +977,29 @@ class AgentGUIClient {
977
977
  body: JSON.stringify({ content: prompt, agentId })
978
978
  });
979
979
 
980
+ if (response.status === 404) {
981
+ console.warn('Conversation not found, recreating:', conversationId);
982
+ const conv = this.state.currentConversation;
983
+ const createResp = await fetch(window.__BASE_URL + '/api/conversations', {
984
+ method: 'POST',
985
+ headers: { 'Content-Type': 'application/json' },
986
+ body: JSON.stringify({
987
+ agentId,
988
+ title: conv?.title || prompt.substring(0, 50),
989
+ workingDirectory: conv?.workingDirectory || null
990
+ })
991
+ });
992
+ if (!createResp.ok) throw new Error(`Failed to recreate conversation: HTTP ${createResp.status}`);
993
+ const { conversation: newConv } = await createResp.json();
994
+ this.state.currentConversation = newConv;
995
+ if (window.conversationManager) {
996
+ window.conversationManager.loadConversations();
997
+ window.conversationManager.select(newConv.id);
998
+ }
999
+ this.updateUrlForConversation(newConv.id);
1000
+ return this.streamToConversation(newConv.id, prompt, agentId);
1001
+ }
1002
+
980
1003
  if (!response.ok) throw new Error(`HTTP ${response.status}`);
981
1004
 
982
1005
  const result = await response.json();
@@ -1367,6 +1390,17 @@ class AgentGUIClient {
1367
1390
  this.conversationCache.delete(conversationId);
1368
1391
 
1369
1392
  const resp = await fetch(window.__BASE_URL + `/api/conversations/${conversationId}/full`);
1393
+ if (resp.status === 404) {
1394
+ console.warn('Conversation no longer exists:', conversationId);
1395
+ this.state.currentConversation = null;
1396
+ if (window.conversationManager) {
1397
+ window.conversationManager.loadConversations();
1398
+ }
1399
+ const outputEl = document.getElementById('output');
1400
+ 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>';
1401
+ this.enableControls();
1402
+ return;
1403
+ }
1370
1404
  if (!resp.ok) throw new Error(`HTTP ${resp.status}`);
1371
1405
  const { conversation, isActivelyStreaming, latestSession, chunks: rawChunks, totalChunks, messages: allMessages } = await resp.json();
1372
1406
 
@@ -392,8 +392,7 @@
392
392
  }
393
393
 
394
394
  function tryStreaming() {
395
- if (!streamingSupported && (Date.now() - streamingFailedAt < 30000)) { tryNonStreaming(text); return; }
396
- streamingSupported = true;
395
+ if (!streamingSupported) { tryNonStreaming(text); return; }
397
396
  fetch(BASE + '/api/tts-stream', {
398
397
  method: 'POST',
399
398
  headers: { 'Content-Type': 'application/json' },
@@ -458,10 +457,8 @@
458
457
  onTtsSuccess();
459
458
  var blob = new Blob([buf], { type: 'audio/wav' });
460
459
  audioChunkQueue.push(blob);
461
- if (!isPlayingChunk) playNextChunk();
462
460
  streamDone = true;
463
- isSpeaking = false;
464
- processQueue();
461
+ if (!isPlayingChunk) playNextChunk();
465
462
  }).catch(function() {
466
463
  onTtsFailed();
467
464
  });