agentgui 1.0.503 → 1.0.505
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/claude-runner.js +1 -0
- package/package.json +1 -1
- package/static/js/tools-manager.js +6 -0
- package/static/js/voice.js +43 -3
package/lib/claude-runner.js
CHANGED
|
@@ -360,6 +360,7 @@ class AgentRunner {
|
|
|
360
360
|
};
|
|
361
361
|
if (config.model) sessionParams.model = config.model;
|
|
362
362
|
if (config.subAgent) sessionParams.agent = config.subAgent;
|
|
363
|
+
if (config.systemPrompt) sessionParams.systemPrompt = config.systemPrompt;
|
|
363
364
|
const sessionRequest = {
|
|
364
365
|
jsonrpc: '2.0',
|
|
365
366
|
id: ++requestId,
|
package/package.json
CHANGED
|
@@ -270,7 +270,13 @@
|
|
|
270
270
|
|
|
271
271
|
for (var i = 0; i < toolsWithUpdates.length; i++) {
|
|
272
272
|
operationInProgress.add(toolsWithUpdates[i].id);
|
|
273
|
+
var tool = tools.find(function(t) { return t.id === toolsWithUpdates[i].id; });
|
|
274
|
+
if (tool) {
|
|
275
|
+
tool.status = 'updating';
|
|
276
|
+
tool.progress = 0;
|
|
277
|
+
}
|
|
273
278
|
}
|
|
279
|
+
render();
|
|
274
280
|
|
|
275
281
|
fetch('/gm/api/tools/update', { method: 'POST' })
|
|
276
282
|
.then(function(r) { return r.json(); })
|
package/static/js/voice.js
CHANGED
|
@@ -508,6 +508,9 @@
|
|
|
508
508
|
var streamingSupported = true;
|
|
509
509
|
var streamingFailedAt = 0;
|
|
510
510
|
|
|
511
|
+
var pendingVoiceUpdates = [];
|
|
512
|
+
var MAX_PENDING_UPDATES = 100;
|
|
513
|
+
|
|
511
514
|
function optimizePromptForSpeech(text) {
|
|
512
515
|
var optimizationInstructions = ' [Optimize for speech: Keep it short. Use simple words. Use short sentences. Focus on clarity.]';
|
|
513
516
|
return text + optimizationInstructions;
|
|
@@ -813,22 +816,29 @@
|
|
|
813
816
|
if (data.type === 'sync_connected') {
|
|
814
817
|
sendVoiceToServer();
|
|
815
818
|
}
|
|
819
|
+
if (data.type === 'streaming_progress' || data.type === 'message_created' || data.type === 'streaming_start') {
|
|
820
|
+
if (data.conversationId && data.conversationId !== currentConversationId) return;
|
|
821
|
+
if (!voiceActive) {
|
|
822
|
+
pendingVoiceUpdates.push(data);
|
|
823
|
+
if (pendingVoiceUpdates.length > MAX_PENDING_UPDATES) {
|
|
824
|
+
pendingVoiceUpdates.shift();
|
|
825
|
+
}
|
|
826
|
+
return;
|
|
827
|
+
}
|
|
828
|
+
}
|
|
816
829
|
if (!voiceActive) return;
|
|
817
830
|
if (data.type === 'streaming_progress' && data.block) {
|
|
818
|
-
if (data.conversationId && data.conversationId !== currentConversationId) return;
|
|
819
831
|
if (data.seq !== undefined && renderedSeqs.has(data.seq)) return;
|
|
820
832
|
if (data.seq !== undefined) renderedSeqs.add(data.seq);
|
|
821
833
|
handleVoiceBlock(data.block, true, data.blockRole);
|
|
822
834
|
}
|
|
823
835
|
if (data.type === 'message_created' && data.message) {
|
|
824
|
-
if (data.conversationId && data.conversationId !== currentConversationId) return;
|
|
825
836
|
var message = data.message;
|
|
826
837
|
if (message.role === 'user' && message.content) {
|
|
827
838
|
handleVoiceBlock({ type: 'text', text: message.content }, true, 'user');
|
|
828
839
|
}
|
|
829
840
|
}
|
|
830
841
|
if (data.type === 'streaming_start') {
|
|
831
|
-
if (data.conversationId && data.conversationId !== currentConversationId) return;
|
|
832
842
|
spokenChunks = new Set();
|
|
833
843
|
renderedSeqs = new Set();
|
|
834
844
|
_voiceBreakNext = false;
|
|
@@ -838,13 +848,16 @@
|
|
|
838
848
|
var newConversationId = e.detail.conversationId;
|
|
839
849
|
if (currentConversationId && currentConversationId !== newConversationId) {
|
|
840
850
|
unsubscribeFromConversation();
|
|
851
|
+
pendingVoiceUpdates = [];
|
|
841
852
|
}
|
|
842
853
|
currentConversationId = newConversationId;
|
|
843
854
|
stopSpeaking();
|
|
844
855
|
spokenChunks = new Set();
|
|
845
856
|
renderedSeqs = new Set();
|
|
846
857
|
if (voiceActive) {
|
|
858
|
+
subscribeToConversation(currentConversationId);
|
|
847
859
|
loadVoiceBlocks(currentConversationId);
|
|
860
|
+
processPendingUpdates();
|
|
848
861
|
}
|
|
849
862
|
});
|
|
850
863
|
}
|
|
@@ -941,7 +954,9 @@
|
|
|
941
954
|
function activate() {
|
|
942
955
|
voiceActive = true;
|
|
943
956
|
if (currentConversationId) {
|
|
957
|
+
subscribeToConversation(currentConversationId);
|
|
944
958
|
loadVoiceBlocks(currentConversationId);
|
|
959
|
+
processPendingUpdates();
|
|
945
960
|
} else {
|
|
946
961
|
var container = document.getElementById('voiceMessages');
|
|
947
962
|
if (container && !container.hasChildNodes()) {
|
|
@@ -950,10 +965,35 @@
|
|
|
950
965
|
}
|
|
951
966
|
}
|
|
952
967
|
|
|
968
|
+
function processPendingUpdates() {
|
|
969
|
+
if (!voiceActive) return;
|
|
970
|
+
var updates = pendingVoiceUpdates.splice(0, pendingVoiceUpdates.length);
|
|
971
|
+
for (var i = 0; i < updates.length; i++) {
|
|
972
|
+
var data = updates[i];
|
|
973
|
+
if (data.type === 'streaming_progress' && data.block) {
|
|
974
|
+
if (data.seq !== undefined && renderedSeqs.has(data.seq)) continue;
|
|
975
|
+
if (data.seq !== undefined) renderedSeqs.add(data.seq);
|
|
976
|
+
handleVoiceBlock(data.block, true, data.blockRole);
|
|
977
|
+
}
|
|
978
|
+
if (data.type === 'message_created' && data.message) {
|
|
979
|
+
var message = data.message;
|
|
980
|
+
if (message.role === 'user' && message.content) {
|
|
981
|
+
handleVoiceBlock({ type: 'text', text: message.content }, true, 'user');
|
|
982
|
+
}
|
|
983
|
+
}
|
|
984
|
+
if (data.type === 'streaming_start') {
|
|
985
|
+
spokenChunks = new Set();
|
|
986
|
+
renderedSeqs = new Set();
|
|
987
|
+
_voiceBreakNext = false;
|
|
988
|
+
}
|
|
989
|
+
}
|
|
990
|
+
}
|
|
991
|
+
|
|
953
992
|
function deactivate() {
|
|
954
993
|
voiceActive = false;
|
|
955
994
|
stopSpeaking();
|
|
956
995
|
unsubscribeFromConversation();
|
|
996
|
+
pendingVoiceUpdates = [];
|
|
957
997
|
}
|
|
958
998
|
|
|
959
999
|
function escapeHtml(text) {
|