agentgui 1.0.485 → 1.0.487

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.485",
3
+ "version": "1.0.487",
4
4
  "description": "Multi-agent ACP client with real-time communication",
5
5
  "type": "module",
6
6
  "main": "server.js",
@@ -115,16 +115,29 @@
115
115
  }
116
116
  }
117
117
 
118
- // Check if terminal view is initially active
119
- if (document.getElementById('terminalContainer') &&
120
- window.getComputedStyle(document.getElementById('terminalContainer')).display !== 'none') {
121
- console.log('Terminal: Terminal view initially visible, starting');
122
- startTerminal();
118
+ function initTerminalEarly() {
119
+ console.log('Terminal: Initializing terminal early (not yet active)');
120
+ if (!ensureTerm()) {
121
+ console.log('Terminal: Waiting for xterm.js to load');
122
+ setTimeout(initTerminalEarly, 200);
123
+ return;
124
+ }
125
+ console.log('Terminal: Terminal UI initialized and ready for interaction');
126
+ }
127
+
128
+ if (document.readyState === 'loading') {
129
+ document.addEventListener('DOMContentLoaded', initTerminalEarly);
130
+ } else {
131
+ initTerminalEarly();
123
132
  }
124
133
 
125
134
  window.addEventListener('view-switched', function(e) {
126
135
  if (e.detail.view === 'terminal') {
127
- startTerminal();
136
+ if (!termActive) {
137
+ termActive = true;
138
+ connectAndStart();
139
+ setTimeout(function() { if (fitAddon) try { fitAddon.fit(); } catch(_) {} }, 100);
140
+ }
128
141
  } else if (termActive) {
129
142
  stopTerminal();
130
143
  }
@@ -508,6 +508,11 @@
508
508
  var streamingSupported = true;
509
509
  var streamingFailedAt = 0;
510
510
 
511
+ function optimizePromptForSpeech(text) {
512
+ var optimizationInstructions = ' [Optimize for speech: Keep it short. Use simple words. Use short sentences. Focus on clarity.]';
513
+ return text + optimizationInstructions;
514
+ }
515
+
511
516
  function playNextChunk() {
512
517
  if (audioChunkQueue.length === 0) {
513
518
  isPlayingChunk = false;
@@ -582,6 +587,7 @@
582
587
  }
583
588
 
584
589
  var remainingText = uncachedText.join(' ');
590
+ var optimizedText = optimizePromptForSpeech(remainingText);
585
591
 
586
592
  function onTtsSuccess() {
587
593
  ttsConsecutiveFailures = 0;
@@ -602,11 +608,11 @@
602
608
  }
603
609
 
604
610
  function tryStreaming() {
605
- if (!streamingSupported) { tryNonStreaming(remainingText); return; }
611
+ if (!streamingSupported) { tryNonStreaming(optimizedText); return; }
606
612
  fetch(BASE + '/api/tts-stream', {
607
613
  method: 'POST',
608
614
  headers: { 'Content-Type': 'application/json' },
609
- body: JSON.stringify({ text: remainingText, voiceId: selectedVoiceId })
615
+ body: JSON.stringify({ text: optimizedText, voiceId: selectedVoiceId })
610
616
  }).then(function(resp) {
611
617
  if (!resp.ok) {
612
618
  streamingSupported = false;