agentgui 1.0.560 → 1.0.562

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.560",
3
+ "version": "1.0.562",
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
 
@@ -2557,6 +2557,13 @@ class AgentGUIClient {
2557
2557
  const shouldResumeStreaming = latestSession &&
2558
2558
  (latestSession.status === 'active' || latestSession.status === 'pending');
2559
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
+
2560
2567
  if (this.ui.messageInput) {
2561
2568
  this.ui.messageInput.disabled = shouldResumeStreaming;
2562
2569
  }
@@ -2840,7 +2847,7 @@ class AgentGUIClient {
2840
2847
 
2841
2848
  if (result.chunks && result.chunks.length > 0) {
2842
2849
  result.chunks.forEach(chunk => {
2843
- const blockEl = this.renderer.renderBlock(chunk.data, chunk.type, false);
2850
+ const blockEl = this.renderer.renderBlock(chunk.data, {}, false);
2844
2851
  if (blockEl) {
2845
2852
  const wrapper = document.createElement('div');
2846
2853
  wrapper.setAttribute('data-chunk-created', chunk.created_at);
@@ -619,8 +619,13 @@ class StreamingRenderer {
619
619
  case 'TodoWrite':
620
620
  if (input.todos && Array.isArray(input.todos)) {
621
621
  const statusIcons = { completed: '✅', in_progress: '⚙', pending: '☐' };
622
+ const hasInProgress = input.todos.some(t => t.status === 'in_progress');
623
+ const completedCount = input.todos.filter(t => t.status === 'completed').length;
624
+ const totalCount = input.todos.length;
622
625
  const items = input.todos.map(t => `<div class="todo-item"><span class="todo-status">${statusIcons[t.status] || '&#9744;'}</span><span class="todo-text">${this.escapeHtml(t.content || '')}</span></div>`).join('');
623
- return `<div class="tool-params"><div class="tool-param-todos">${items}</div></div>`;
626
+ const openAttr = hasInProgress ? 'open' : '';
627
+ const summary = `<summary class="folded-tool-bar" style="cursor:pointer;padding:0.5rem;background:var(--color-bg-secondary);border-radius:0.25rem;user-select:none"><span style="font-weight:600;font-size:0.9rem">📋 Tasks</span><span style="margin-left:0.5rem;font-size:0.8rem;color:var(--color-text-secondary)">${completedCount}/${totalCount} complete</span></summary>`;
628
+ return `<details class="folded-tool" ${openAttr}>${summary}<div class="folded-tool-body tool-param-todos" style="padding:0.75rem">${items}</div></details>`;
624
629
  }
625
630
  return this.renderJsonParams(input);
626
631