agentgui 1.0.237 → 1.0.239
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/lib/speech.js +16 -5
- package/package.json +1 -1
- package/server.js +14 -4
- package/static/js/client.js +7 -14
- package/static/js/voice.js +13 -1
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
|
-
|
|
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 =
|
|
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
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
|
|
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
|
}
|
|
@@ -1765,10 +1773,12 @@ const server = http.createServer(async (req, res) => {
|
|
|
1765
1773
|
const remoteUrl = result.trim();
|
|
1766
1774
|
const statusResult = execSync('git status --porcelain', { encoding: 'utf-8', cwd: STARTUP_CWD });
|
|
1767
1775
|
const hasChanges = statusResult.trim().length > 0;
|
|
1776
|
+
const unpushedResult = execSync('git rev-list --count --not --remotes 2>/dev/null', { encoding: 'utf-8', cwd: STARTUP_CWD });
|
|
1777
|
+
const hasUnpushed = parseInt(unpushedResult.trim() || '0', 10) > 0;
|
|
1768
1778
|
const ownsRemote = !remoteUrl.includes('github.com/') || remoteUrl.includes(process.env.GITHUB_USER || '');
|
|
1769
|
-
sendJSON(req, res, 200, { ownsRemote, hasChanges, remoteUrl });
|
|
1779
|
+
sendJSON(req, res, 200, { ownsRemote, hasChanges, hasUnpushed, remoteUrl });
|
|
1770
1780
|
} catch {
|
|
1771
|
-
sendJSON(req, res, 200, { ownsRemote: false, hasChanges: false, remoteUrl: '' });
|
|
1781
|
+
sendJSON(req, res, 200, { ownsRemote: false, hasChanges: false, hasUnpushed: false, remoteUrl: '' });
|
|
1772
1782
|
}
|
|
1773
1783
|
return;
|
|
1774
1784
|
}
|
package/static/js/client.js
CHANGED
|
@@ -788,28 +788,21 @@ class AgentGUIClient {
|
|
|
788
788
|
this.enableControls();
|
|
789
789
|
this.emit('streaming:complete', data);
|
|
790
790
|
|
|
791
|
-
|
|
792
|
-
this._promptPushIfWeOwnRemote();
|
|
793
|
-
}
|
|
794
|
-
}
|
|
795
|
-
|
|
796
|
-
_isACPAgent(agentId) {
|
|
797
|
-
const acpAgents = ['opencode', 'gemini', 'goose', 'openhands', 'augment', 'cline', 'kimi', 'qwen', 'codex', 'mistral', 'kiro', 'fast-agent'];
|
|
798
|
-
return acpAgents.includes(agentId);
|
|
791
|
+
this._promptPushIfWeOwnRemote();
|
|
799
792
|
}
|
|
800
793
|
|
|
801
794
|
async _promptPushIfWeOwnRemote() {
|
|
802
795
|
try {
|
|
803
796
|
const result = await fetch(window.__BASE_URL + '/api/git/check-remote-ownership');
|
|
804
|
-
const { ownsRemote, hasChanges, remoteUrl } = await result.json();
|
|
805
|
-
if (ownsRemote && hasChanges) {
|
|
806
|
-
const
|
|
807
|
-
if (
|
|
808
|
-
|
|
797
|
+
const { ownsRemote, hasChanges, hasUnpushed, remoteUrl } = await result.json();
|
|
798
|
+
if (ownsRemote && (hasChanges || hasUnpushed)) {
|
|
799
|
+
const conv = this.state.currentConversation;
|
|
800
|
+
if (conv) {
|
|
801
|
+
this.streamToConversation(conv.id, 'Push the changes to the remote repository.', conv.agentId);
|
|
809
802
|
}
|
|
810
803
|
}
|
|
811
804
|
} catch (e) {
|
|
812
|
-
console.warn('
|
|
805
|
+
console.warn('Auto-push check failed:', e);
|
|
813
806
|
}
|
|
814
807
|
}
|
|
815
808
|
|
package/static/js/voice.js
CHANGED
|
@@ -296,7 +296,19 @@
|
|
|
296
296
|
if (!ttsEnabled) return;
|
|
297
297
|
var clean = text.replace(/<[^>]*>/g, '').trim();
|
|
298
298
|
if (!clean) return;
|
|
299
|
-
|
|
299
|
+
var parts = [];
|
|
300
|
+
if (typeof agentGUIClient !== 'undefined' && agentGUIClient && typeof agentGUIClient.parseMarkdownCodeBlocks === 'function') {
|
|
301
|
+
parts = agentGUIClient.parseMarkdownCodeBlocks(clean);
|
|
302
|
+
} else {
|
|
303
|
+
parts = [{ type: 'text', content: clean }];
|
|
304
|
+
}
|
|
305
|
+
parts.forEach(function(part) {
|
|
306
|
+
if (part.type === 'code') return;
|
|
307
|
+
var segment = part.content.trim();
|
|
308
|
+
if (segment) {
|
|
309
|
+
speechQueue.push(segment);
|
|
310
|
+
}
|
|
311
|
+
});
|
|
300
312
|
processQueue();
|
|
301
313
|
}
|
|
302
314
|
|