clideck 1.31.14 → 1.31.15

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/handlers.js +39 -4
  2. package/package.json +1 -1
package/handlers.js CHANGED
@@ -295,6 +295,13 @@ function remoteCliEnv() {
295
295
  return { ...process.env, CLIDECK_PORT: String(PORT) };
296
296
  }
297
297
 
298
+ function remoteVoiceCapabilityError() {
299
+ const voicePlugin = plugins.getInfo().find(p => p.id === 'voice-input' && p.installed);
300
+ return voicePlugin
301
+ ? 'Restart CliDeck so the Voice Input plugin update can finish loading.'
302
+ : 'Install the Voice Input plugin in CliDeck first.';
303
+ }
304
+
298
305
  function onConnection(ws) {
299
306
  sessions.clients.add(ws);
300
307
 
@@ -606,10 +613,7 @@ function onConnection(ws) {
606
613
  const requestId = String(msg.requestId || '');
607
614
  const replyError = (error) => ws.send(JSON.stringify({ type: 'remote.voice.error', requestId, error }));
608
615
  if (!plugins.hasCapability('voice-input', 'transcribeAudio')) {
609
- const voicePlugin = plugins.getInfo().find(p => p.id === 'voice-input' && p.installed);
610
- replyError(voicePlugin
611
- ? 'Restart CliDeck so the Voice Input plugin update can finish loading.'
612
- : 'Install the Voice Input plugin in CliDeck first.');
616
+ replyError(remoteVoiceCapabilityError());
613
617
  break;
614
618
  }
615
619
  if (typeof msg.audio !== 'string' || !msg.audio) {
@@ -622,6 +626,37 @@ function onConnection(ws) {
622
626
  break;
623
627
  }
624
628
 
629
+ case 'remote.voice.send': {
630
+ const requestId = String(msg.requestId || '');
631
+ const id = String(msg.id || '');
632
+ const replyError = (error) => ws.send(JSON.stringify({ type: 'remote.voice.error', requestId, error }));
633
+ if (!plugins.hasCapability('voice-input', 'transcribeAudio')) {
634
+ replyError(remoteVoiceCapabilityError());
635
+ break;
636
+ }
637
+ if (!id || !sessions.getSessions().has(id)) {
638
+ replyError('Session is not available.');
639
+ break;
640
+ }
641
+ if (typeof msg.audio !== 'string' || !msg.audio) {
642
+ replyError('No audio received.');
643
+ break;
644
+ }
645
+ plugins.invoke('voice-input', 'transcribeAudio', { audio: msg.audio })
646
+ .then(result => {
647
+ const text = String(result?.text || '').trim();
648
+ if (!text) {
649
+ ws.send(JSON.stringify({ type: 'remote.voice.sent', requestId, id, skipped: true }));
650
+ return;
651
+ }
652
+ sessions.input({ id, data: text });
653
+ setTimeout(() => sessions.input({ id, data: '\r' }), 150);
654
+ ws.send(JSON.stringify({ type: 'remote.voice.sent', requestId, id, text }));
655
+ })
656
+ .catch(e => replyError(e.message || 'Voice transcription failed.'));
657
+ break;
658
+ }
659
+
625
660
  case 'remote.install': {
626
661
  const update = !!msg.update;
627
662
  const proc = require('child_process').spawn('npm', ['install', '-g', 'clideck-remote'], {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "clideck",
3
- "version": "1.31.14",
3
+ "version": "1.31.15",
4
4
  "description": "One screen for all your AI coding agents — run, monitor, and manage multiple CLI agents from a single browser tab",
5
5
  "main": "server.js",
6
6
  "bin": {