agentgui 1.0.255 → 1.0.257

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.255",
3
+ "version": "1.0.257",
4
4
  "description": "Multi-agent ACP client with real-time communication",
5
5
  "type": "module",
6
6
  "main": "server.js",
@@ -31,7 +31,7 @@
31
31
  "google-auth-library": "^10.5.0",
32
32
  "onnxruntime-node": "^1.24.1",
33
33
  "sttttsmodels": "github:AnEntrypoint/sttttsmodels",
34
- "webtalk": "github:AnEntrypoint/webtalk",
34
+ "webtalk": "^1.0.12",
35
35
  "ws": "^8.14.2"
36
36
  },
37
37
  "overrides": {
package/server.js CHANGED
@@ -2516,20 +2516,24 @@ const server = http.createServer(async (req, res) => {
2516
2516
  if (pathOnly === '/api/speech-status' && req.method === 'POST') {
2517
2517
  const body = await parseBody(req);
2518
2518
  if (body.forceDownload) {
2519
- modelDownloadState.complete = false;
2520
- modelDownloadState.downloading = false;
2521
- modelDownloadState.error = null;
2522
- ensureModelsDownloaded().then(ok => {
2523
- broadcastSync({
2524
- type: 'model_download_progress',
2525
- progress: { done: true, complete: ok, error: ok ? null : 'Download failed' }
2526
- });
2527
- }).catch(err => {
2528
- broadcastSync({
2529
- type: 'model_download_progress',
2530
- progress: { done: true, error: err.message }
2519
+ if (modelDownloadState.complete) {
2520
+ sendJSON(req, res, 200, { ok: true, modelsComplete: true, message: 'Models already ready' });
2521
+ return;
2522
+ }
2523
+ if (!modelDownloadState.downloading) {
2524
+ modelDownloadState.error = null;
2525
+ ensureModelsDownloaded().then(ok => {
2526
+ broadcastSync({
2527
+ type: 'model_download_progress',
2528
+ progress: { done: true, complete: ok, error: ok ? null : 'Download failed' }
2529
+ });
2530
+ }).catch(err => {
2531
+ broadcastSync({
2532
+ type: 'model_download_progress',
2533
+ progress: { done: true, error: err.message }
2534
+ });
2531
2535
  });
2532
- });
2536
+ }
2533
2537
  sendJSON(req, res, 200, { ok: true, message: 'Starting model download' });
2534
2538
  return;
2535
2539
  }
@@ -188,8 +188,8 @@
188
188
  buttons.forEach(function(btn) {
189
189
  btn.addEventListener('click', function() {
190
190
  var view = btn.dataset.view;
191
- if (view === 'voice' && !isVoiceReady()) {
192
- triggerVoiceModelDownload();
191
+ if (view === 'voice') {
192
+ handleVoiceTabClick();
193
193
  return;
194
194
  }
195
195
  switchView(view);
@@ -197,6 +197,42 @@
197
197
  });
198
198
  }
199
199
 
200
+ function handleVoiceTabClick() {
201
+ if (isVoiceReady()) {
202
+ switchView('voice');
203
+ return;
204
+ }
205
+ var client = window.agentGUIClient;
206
+ if (client && client._modelDownloadProgress == null) {
207
+ fetch((window.__BASE_URL || '') + '/api/speech-status')
208
+ .then(function(res) { return res.json(); })
209
+ .then(function(status) {
210
+ if (status.modelsComplete) {
211
+ if (client) {
212
+ client._modelDownloadProgress = { done: true, complete: true };
213
+ client._modelDownloadInProgress = false;
214
+ }
215
+ switchView('voice');
216
+ } else if (status.modelsDownloading) {
217
+ if (client) {
218
+ client._modelDownloadProgress = status.modelsProgress || { downloading: true };
219
+ client._modelDownloadInProgress = true;
220
+ }
221
+ showVoiceDownloadProgress();
222
+ } else {
223
+ triggerVoiceModelDownload();
224
+ }
225
+ })
226
+ .catch(function() { triggerVoiceModelDownload(); });
227
+ return;
228
+ }
229
+ if (client && client._modelDownloadInProgress) {
230
+ showVoiceDownloadProgress();
231
+ return;
232
+ }
233
+ triggerVoiceModelDownload();
234
+ }
235
+
200
236
  function showVoiceDownloadProgress() {
201
237
  if (window._voiceProgressDialog) return;
202
238
 
@@ -266,7 +302,18 @@
266
302
  body: JSON.stringify({ forceDownload: true })
267
303
  }).then(function(res) { return res.json(); })
268
304
  .then(function(data) {
269
- if (data.ok) {
305
+ if (data.ok && data.modelsComplete) {
306
+ if (window._voiceProgressDialog) {
307
+ window._voiceProgressDialog.close();
308
+ window._voiceProgressDialog = null;
309
+ }
310
+ var client = window.agentGUIClient;
311
+ if (client) {
312
+ client._modelDownloadProgress = { done: true, complete: true };
313
+ client._modelDownloadInProgress = false;
314
+ }
315
+ switchView('voice');
316
+ } else if (data.ok) {
270
317
  window._voiceTabPendingOpen = true;
271
318
  if (window._voiceProgressDialog) {
272
319
  window._voiceProgressDialog.update(0, 'Starting download...');