@tritard/waterbrother 0.14.20 → 0.14.22

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/src/voice.js +12 -10
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tritard/waterbrother",
3
- "version": "0.14.20",
3
+ "version": "0.14.22",
4
4
  "description": "Waterbrother: Grok-powered coding CLI with local tools, sessions, operator modes, and approval controls",
5
5
  "type": "module",
6
6
  "bin": {
package/src/voice.js CHANGED
@@ -713,17 +713,18 @@ export async function setupVoice(onStatus) {
713
713
  playCmd = "afplay";
714
714
  playArgs = [mp3Path];
715
715
  } else if (process.platform === "win32") {
716
- // PowerShell MediaPlayer write temp .ps1 to avoid escaping issues
716
+ // Use sox to play the audio it's already installed for recording
717
+ // Use PowerShell to play MP3 via Windows Media Player COM
718
+ const psScript = `
719
+ $wmp = New-Object -ComObject WMPlayer.OCX
720
+ $wmp.URL = "${mp3Path.replace(/\\/g, "\\\\")}"
721
+ $wmp.controls.play()
722
+ Start-Sleep -Milliseconds 500
723
+ while($wmp.playState -eq 3){ Start-Sleep -Milliseconds 200 }
724
+ $wmp.close()
725
+ `.trim();
717
726
  const psPath = path.join(tmpDir, `tts-${ts}.ps1`);
718
- await fs.writeFile(psPath, [
719
- "Add-Type -AssemblyName PresentationCore",
720
- "$p = New-Object System.Windows.Media.MediaPlayer",
721
- `$p.Open([uri]"${mp3Path.replace(/\\/g, "/")}")`,
722
- "$p.Play()",
723
- "Start-Sleep -Milliseconds 500",
724
- "while($p.Position -lt $p.NaturalDuration.TimeSpan){ Start-Sleep -Milliseconds 200 }",
725
- "$p.Close()",
726
- ].join("\n"));
727
+ await fs.writeFile(psPath, psScript);
727
728
  cleanupFiles.push(psPath);
728
729
  playCmd = "powershell.exe";
729
730
  playArgs = ["-NoProfile", "-ExecutionPolicy", "Bypass", "-File", psPath];
@@ -732,6 +733,7 @@ export async function setupVoice(onStatus) {
732
733
  playArgs = ["--no-video", "--really-quiet", mp3Path];
733
734
  }
734
735
 
736
+ process.stderr.write(`[speak] playing: ${playCmd} ${playArgs.join(" ")}\n`);
735
737
  await new Promise((resolve) => {
736
738
  const child = spawn(playCmd, playArgs, { stdio: "ignore" });
737
739
  _ttsPlayback = child;