agentgui 1.0.448 → 1.0.450

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.
@@ -0,0 +1,76 @@
1
+ import { spawn } from 'child_process';
2
+ import os from 'os';
3
+ import fs from 'fs';
4
+ import path from 'path';
5
+
6
+ const isWindows = os.platform() === 'win32';
7
+
8
+ const GM_PACKAGES = [
9
+ { id: 'opencode', pkg: 'gm-oc', marker: path.join(os.homedir(), '.config', 'opencode', 'agents') },
10
+ { id: 'gemini', pkg: 'gm-gc', marker: path.join(os.homedir(), '.gemini', 'extensions', 'gm', 'agents') },
11
+ { id: 'kilo', pkg: 'gm-kilo', marker: path.join(os.homedir(), '.config', 'kilo', 'agents') },
12
+ ];
13
+
14
+ function log(msg) { console.log('[GM-CONFIG] ' + msg); }
15
+
16
+ function runInstaller(pkg) {
17
+ return new Promise((resolve) => {
18
+ const npxCmd = isWindows ? 'npx.cmd' : 'npx';
19
+ const proc = spawn(npxCmd, ['--yes', pkg], {
20
+ stdio: ['ignore', 'pipe', 'pipe'],
21
+ timeout: 60000,
22
+ shell: isWindows,
23
+ });
24
+
25
+ let stdout = '';
26
+ let stderr = '';
27
+ proc.stdout.on('data', (d) => { stdout += d.toString(); });
28
+ proc.stderr.on('data', (d) => { stderr += d.toString(); });
29
+ proc.stdout.on('error', () => {});
30
+ proc.stderr.on('error', () => {});
31
+
32
+ proc.on('close', (code) => {
33
+ if (code === 0) {
34
+ log(pkg + ' installed successfully');
35
+ } else {
36
+ log(pkg + ' exited with code ' + code);
37
+ if (stderr.trim()) log(pkg + ' stderr: ' + stderr.trim().substring(0, 200));
38
+ }
39
+ resolve(code === 0);
40
+ });
41
+
42
+ proc.on('error', (err) => {
43
+ log(pkg + ' spawn error: ' + err.message);
44
+ resolve(false);
45
+ });
46
+ });
47
+ }
48
+
49
+ export async function installGMAgentConfigs() {
50
+ const needed = GM_PACKAGES.filter(p => !fs.existsSync(p.marker));
51
+ if (needed.length === 0) {
52
+ log('all agent configs already installed');
53
+ return;
54
+ }
55
+
56
+ log('installing agent configs for: ' + needed.map(p => p.pkg).join(', '));
57
+ const results = await Promise.allSettled(needed.map(p => runInstaller(p.pkg)));
58
+
59
+ const summary = needed.map((p, i) => {
60
+ const r = results[i];
61
+ const ok = r.status === 'fulfilled' && r.value;
62
+ return p.pkg + ': ' + (ok ? 'ok' : 'failed');
63
+ });
64
+ log('results: ' + summary.join(', '));
65
+ }
66
+
67
+ export async function forceReinstallGMAgentConfigs() {
68
+ log('force reinstalling all agent configs');
69
+ const results = await Promise.allSettled(GM_PACKAGES.map(p => runInstaller(p.pkg)));
70
+ const summary = GM_PACKAGES.map((p, i) => {
71
+ const r = results[i];
72
+ const ok = r.status === 'fulfilled' && r.value;
73
+ return p.pkg + ': ' + (ok ? 'ok' : 'failed');
74
+ });
75
+ log('results: ' + summary.join(', '));
76
+ }
package/lib/speech.js CHANGED
@@ -1,4 +1,4 @@
1
1
  import { createRequire } from 'module';
2
2
  const require = createRequire(import.meta.url);
3
3
  const speech = require('webtalk/speech');
4
- export const { transcribe, synthesize, synthesizeStream, getSTT, getStatus, getVoices, preloadTTS, ttsCacheKey, ttsCacheGet, splitSentences } = speech;
4
+ export const { transcribe, synthesize, synthesizeStream, getSTT, getStatus, getVoices, preloadTTS, ttsCacheKey, ttsCacheGet, splitSentences, resetSTTError, clearCorruptedSTTCache } = speech;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agentgui",
3
- "version": "1.0.448",
3
+ "version": "1.0.450",
4
4
  "description": "Multi-agent ACP client with real-time communication",
5
5
  "type": "module",
6
6
  "main": "server.js",
package/server.js CHANGED
@@ -23,6 +23,7 @@ import { register as registerSessionHandlers } from './lib/ws-handlers-session.j
23
23
  import { register as registerRunHandlers } from './lib/ws-handlers-run.js';
24
24
  import { register as registerUtilHandlers } from './lib/ws-handlers-util.js';
25
25
  import { startAll as startACPTools, stopAll as stopACPTools, getStatus as getACPStatus, getPort as getACPPort, queryModels as queryACPModels, touch as touchACP } from './lib/acp-manager.js';
26
+ import { installGMAgentConfigs } from './lib/gm-agent-configs.js';
26
27
 
27
28
 
28
29
  process.on('uncaughtException', (err, origin) => {
@@ -2485,15 +2486,17 @@ const server = http.createServer(async (req, res) => {
2485
2486
  let errorMsg = err.message || 'STT failed';
2486
2487
  if (errorMsg.includes('VERS_1.21') || errorMsg.includes('onnxruntime')) {
2487
2488
  errorMsg = 'STT model load failed: onnxruntime version mismatch. Try: npm install or npm ci';
2488
- } else if (errorMsg.includes('not valid JSON') || errorMsg.includes('Unexpected token')) {
2489
- errorMsg = 'STT model load failed: corrupted cache. Clearing... try again.';
2490
- const modelsDir = path.join(os.homedir(), '.gmgui', 'models');
2489
+ } else if (errorMsg.includes('not valid JSON') || errorMsg.includes('Unexpected token') || errorMsg.includes('corrupted files cleared')) {
2491
2490
  try {
2492
- const manifestPath = path.join(modelsDir, '.manifests.json');
2493
- if (fs.existsSync(manifestPath)) fs.unlinkSync(manifestPath);
2494
- console.log('[STT] Cleared corrupted manifest');
2491
+ const speech = await getSpeech();
2492
+ const cleared = speech.clearCorruptedSTTCache();
2493
+ speech.resetSTTError();
2494
+ console.log('[STT] Cleared', cleared, 'corrupted files and reset error state');
2495
+ await ensureModelsDownloaded();
2496
+ errorMsg = 'STT cache was corrupted, re-downloaded models. Please try again.';
2495
2497
  } catch (e) {
2496
- console.warn('[STT] Failed to clear manifest:', e.message);
2498
+ console.warn('[STT] Recovery failed:', e.message);
2499
+ errorMsg = 'STT model load failed: corrupted cache. Recovery attempted, try again.';
2497
2500
  }
2498
2501
  }
2499
2502
  broadcastSync({ type: 'stt_progress', status: 'failed', percentComplete: 0, error: errorMsg });
@@ -4173,6 +4176,8 @@ function onServerReady() {
4173
4176
 
4174
4177
  resumeInterruptedStreams().catch(err => console.error('[RESUME] Startup error:', err.message));
4175
4178
 
4179
+ installGMAgentConfigs().catch(err => console.error('[GM-CONFIG] Startup error:', err.message));
4180
+
4176
4181
  startACPTools().then(() => {
4177
4182
  setTimeout(() => {
4178
4183
  const acpStatus = getACPStatus();