agentgui 1.0.230 → 1.0.232

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.230",
3
+ "version": "1.0.232",
4
4
  "description": "Multi-agent ACP client with real-time communication",
5
5
  "type": "module",
6
6
  "main": "server.js",
@@ -27,7 +27,7 @@
27
27
  "better-sqlite3": "^12.6.2",
28
28
  "busboy": "^1.6.0",
29
29
  "express": "^5.2.1",
30
- "fsbrowse": "^0.2.17",
30
+ "fsbrowse": "^0.2.18",
31
31
  "google-auth-library": "^10.5.0",
32
32
  "onnxruntime-node": "^1.24.1",
33
33
  "sttttsmodels": "github:AnEntrypoint/sttttsmodels",
package/server.js CHANGED
@@ -11,6 +11,9 @@ import { createRequire } from 'module';
11
11
  import { OAuth2Client } from 'google-auth-library';
12
12
  import { queries } from './database.js';
13
13
  import { runClaudeWithStreaming } from './lib/claude-runner.js';
14
+
15
+ const ttsTextAccumulators = new Map();
16
+
14
17
  let speechModule = null;
15
18
  async function getSpeech() {
16
19
  if (!speechModule) speechModule = await import('./lib/speech.js');
@@ -87,6 +90,24 @@ async function ensureModelsDownloaded() {
87
90
  }
88
91
 
89
92
  function eagerTTS(text, conversationId, sessionId) {
93
+ const key = `${conversationId}:${sessionId}`;
94
+ let acc = ttsTextAccumulators.get(key);
95
+ if (!acc) {
96
+ acc = { text: '', timer: null };
97
+ ttsTextAccumulators.set(key, acc);
98
+ }
99
+ acc.text += text;
100
+ if (acc.timer) clearTimeout(acc.timer);
101
+ acc.timer = setTimeout(() => flushTTSaccumulator(key, conversationId, sessionId), 600);
102
+ }
103
+
104
+ function flushTTSaccumulator(key, conversationId, sessionId) {
105
+ const acc = ttsTextAccumulators.get(key);
106
+ if (!acc || !acc.text) return;
107
+ const text = acc.text.trim();
108
+ acc.text = '';
109
+ ttsTextAccumulators.delete(key);
110
+
90
111
  getSpeech().then(speech => {
91
112
  const status = speech.getStatus();
92
113
  if (!status.ttsReady || status.ttsError) return;
@@ -284,7 +284,10 @@ class AgentGUIClient {
284
284
  const scrollContainer = document.getElementById(this.config.scrollContainerId);
285
285
  if (scrollContainer && !isNaN(scrollTop)) {
286
286
  requestAnimationFrame(() => {
287
- scrollContainer.scrollTop = scrollTop;
287
+ requestAnimationFrame(() => {
288
+ const maxScroll = scrollContainer.scrollHeight - scrollContainer.clientHeight;
289
+ scrollContainer.scrollTop = Math.min(scrollTop, maxScroll);
290
+ });
288
291
  });
289
292
  }
290
293
  }
@@ -830,6 +833,19 @@ class AgentGUIClient {
830
833
  this.emit('message:created', data);
831
834
  return;
832
835
  }
836
+ // Also check for pending ID (in case message-sending was already removed by _confirmOptimisticMessage)
837
+ const pendingById = outputEl.querySelector('[id^="pending-"]');
838
+ if (pendingById) {
839
+ pendingById.id = '';
840
+ pendingById.setAttribute('data-msg-id', data.message.id);
841
+ const ts = pendingById.querySelector('.message-timestamp');
842
+ if (ts) {
843
+ ts.style.opacity = '1';
844
+ ts.textContent = new Date(data.message.created_at).toLocaleString();
845
+ }
846
+ this.emit('message:created', data);
847
+ return;
848
+ }
833
849
  // Check if a user message with this ID already exists (prevents duplicate on race condition)
834
850
  const existingMsg = outputEl.querySelector(`[data-msg-id="${data.message.id}"]`);
835
851
  if (existingMsg) {