agentgui 1.0.237 → 1.0.238

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.
Files changed (3) hide show
  1. package/lib/speech.js +16 -5
  2. package/package.json +1 -1
  3. package/server.js +10 -2
package/lib/speech.js CHANGED
@@ -29,7 +29,14 @@ const POCKET_TTS_VOICES = [
29
29
  const PREDEFINED_IDS = new Set(POCKET_TTS_VOICES.filter(v => v.id !== 'default').map(v => v.id));
30
30
  const POCKET_PORT = 8787;
31
31
 
32
- const needsPatch = !serverTTS.getVoices(EXTRA_VOICE_DIRS).some(v => v.id === 'alba' && !v.isCustom);
32
+ function safeGetVoices(extraDirs) {
33
+ if (typeof serverTTS.getVoices === 'function') {
34
+ return serverTTS.getVoices(extraDirs || []);
35
+ }
36
+ return [];
37
+ }
38
+
39
+ const needsPatch = !safeGetVoices(EXTRA_VOICE_DIRS).some(v => v.id === 'alba' && !v.isCustom);
33
40
 
34
41
  function synthesizeDirect(text, voiceId) {
35
42
  const voicePath = serverTTS.findVoiceFile(voiceId, EXTRA_VOICE_DIRS);
@@ -96,7 +103,7 @@ function synthesizeStream(text, voiceId) {
96
103
  }
97
104
 
98
105
  function getVoices() {
99
- const upstream = serverTTS.getVoices(EXTRA_VOICE_DIRS);
106
+ const upstream = safeGetVoices(EXTRA_VOICE_DIRS);
100
107
  const custom = upstream.filter(v => v.isCustom);
101
108
  return [...POCKET_TTS_VOICES, ...custom];
102
109
  }
@@ -116,6 +123,10 @@ function getStatus() {
116
123
  }
117
124
 
118
125
  function preloadTTS() {
126
+ if (typeof serverTTS.findVoiceFile !== 'function' || typeof serverTTS.start !== 'function') {
127
+ console.log('[TTS] pocket-tts functions not available');
128
+ return;
129
+ }
119
130
  const defaultVoice = serverTTS.findVoiceFile('custom_cleetus', EXTRA_VOICE_DIRS) || '/config/voices/cleetus.wav';
120
131
  const voicePath = fs.existsSync(defaultVoice) ? defaultVoice : null;
121
132
  serverTTS.start(voicePath, {}).then(ok => {
@@ -127,15 +138,15 @@ function preloadTTS() {
127
138
  }
128
139
 
129
140
  function ttsCacheKey(text, voiceId) {
130
- return serverTTS.ttsCacheKey(text, voiceId);
141
+ return typeof serverTTS.ttsCacheKey === 'function' ? serverTTS.ttsCacheKey(text, voiceId) : null;
131
142
  }
132
143
 
133
144
  function ttsCacheGet(key) {
134
- return serverTTS.ttsCacheGet(key);
145
+ return typeof serverTTS.ttsCacheGet === 'function' ? serverTTS.ttsCacheGet(key) : null;
135
146
  }
136
147
 
137
148
  function splitSentences(text) {
138
- return serverTTS.splitSentences(text);
149
+ return typeof serverTTS.splitSentences === 'function' ? serverTTS.splitSentences(text) : [text];
139
150
  }
140
151
 
141
152
  export { transcribe, synthesize, synthesizeStream, getSTT, getStatus, getVoices, preloadTTS, ttsCacheKey, ttsCacheGet, splitSentences };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agentgui",
3
- "version": "1.0.237",
3
+ "version": "1.0.238",
4
4
  "description": "Multi-agent ACP client with real-time communication",
5
5
  "type": "module",
6
6
  "main": "server.js",
package/server.js CHANGED
@@ -38,9 +38,17 @@ const modelDownloadState = {
38
38
  async function ensureModelsDownloaded() {
39
39
  const { createRequire: cr } = await import('module');
40
40
  const r = cr(import.meta.url);
41
- const { checkAllFilesExist, downloadModels } = r('sttttsmodels');
41
+ const models = r('sttttsmodels');
42
+ const checkAllFilesExist = models.checkAllFilesExist;
43
+ const downloadModels = models.downloadModels;
42
44
 
43
- if (checkAllFilesExist()) {
45
+ if (checkAllFilesExist && checkAllFilesExist()) {
46
+ modelDownloadState.complete = true;
47
+ return true;
48
+ }
49
+
50
+ if (!downloadModels) {
51
+ console.log('[MODELS] Download function not available, skipping');
44
52
  modelDownloadState.complete = true;
45
53
  return true;
46
54
  }