agentgui 1.0.521 → 1.0.522

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 (2) hide show
  1. package/package.json +1 -1
  2. package/static/js/client.js +33 -14
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agentgui",
3
- "version": "1.0.521",
3
+ "version": "1.0.522",
4
4
  "description": "Multi-agent ACP client with real-time communication",
5
5
  "type": "module",
6
6
  "main": "server.js",
@@ -494,21 +494,19 @@ class AgentGUIClient {
494
494
 
495
495
  let isRecording = false;
496
496
 
497
- chatMicBtn.addEventListener('mousedown', async (e) => {
498
- e.preventDefault();
497
+ const handleStartRecording = async () => {
499
498
  if (isRecording) return;
500
- isRecording = true;
501
499
  chatMicBtn.classList.add('recording');
502
500
  const result = await window.STTHandler.startRecording();
503
- if (!result.success) {
504
- isRecording = false;
501
+ if (result.success) {
502
+ isRecording = true;
503
+ } else {
505
504
  chatMicBtn.classList.remove('recording');
506
505
  alert('Microphone access denied: ' + result.error);
507
506
  }
508
- });
507
+ };
509
508
 
510
- chatMicBtn.addEventListener('mouseup', async (e) => {
511
- e.preventDefault();
509
+ const handleStopRecording = async () => {
512
510
  if (!isRecording) return;
513
511
  isRecording = false;
514
512
  chatMicBtn.classList.remove('recording');
@@ -520,16 +518,37 @@ class AgentGUIClient {
520
518
  } else {
521
519
  alert('Transcription failed: ' + result.error);
522
520
  }
521
+ };
522
+
523
+ chatMicBtn.addEventListener('mousedown', async (e) => {
524
+ e.preventDefault();
525
+ await handleStartRecording();
526
+ });
527
+
528
+ chatMicBtn.addEventListener('mouseup', async (e) => {
529
+ e.preventDefault();
530
+ await handleStopRecording();
523
531
  });
524
532
 
525
533
  chatMicBtn.addEventListener('mouseleave', async (e) => {
526
534
  if (isRecording) {
527
- isRecording = false;
528
- chatMicBtn.classList.remove('recording');
529
- const result = await window.STTHandler.stopRecording();
530
- if (result.success && this.ui.messageInput) {
531
- this.ui.messageInput.value = result.text;
532
- }
535
+ await handleStopRecording();
536
+ }
537
+ });
538
+
539
+ chatMicBtn.addEventListener('touchstart', async (e) => {
540
+ e.preventDefault();
541
+ await handleStartRecording();
542
+ });
543
+
544
+ chatMicBtn.addEventListener('touchend', async (e) => {
545
+ e.preventDefault();
546
+ await handleStopRecording();
547
+ });
548
+
549
+ chatMicBtn.addEventListener('touchcancel', async (e) => {
550
+ if (isRecording) {
551
+ await handleStopRecording();
533
552
  }
534
553
  });
535
554
  }