klaudio 0.12.2 → 0.12.4
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/bin/cli.js +2 -0
- package/package.json +1 -1
- package/src/installer.js +2 -2
- package/src/tts.js +8 -10
package/bin/cli.js
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
if (process.argv[2] === "play") {
|
|
5
5
|
const { handlePlayCommand } = await import("../src/player.js");
|
|
6
6
|
await handlePlayCommand(process.argv.slice(3));
|
|
7
|
+
// Hard exit: skip native module destructors (onnxruntime crashes during cleanup)
|
|
7
8
|
process.exit(0);
|
|
8
9
|
}
|
|
9
10
|
|
|
@@ -28,6 +29,7 @@ if (process.argv[2] === "say") {
|
|
|
28
29
|
const { speak } = await import("../src/tts.js");
|
|
29
30
|
await speak(text, { voice });
|
|
30
31
|
}
|
|
32
|
+
// Hard exit: skip native module destructors (onnxruntime crashes during cleanup)
|
|
31
33
|
process.exit(0);
|
|
32
34
|
}
|
|
33
35
|
|
package/package.json
CHANGED
package/src/installer.js
CHANGED
|
@@ -80,9 +80,9 @@ export async function install({ scope, sounds, tts = false, voice } = {}) {
|
|
|
80
80
|
settings.hooks[hookEvent] = [];
|
|
81
81
|
}
|
|
82
82
|
|
|
83
|
-
// Remove any existing klaudio/klonk entries
|
|
83
|
+
// Remove any existing klaudio/klonk entries (including legacy hooks without marker)
|
|
84
84
|
settings.hooks[hookEvent] = settings.hooks[hookEvent].filter(
|
|
85
|
-
(entry) => !entry._klaudio && !entry._klonk
|
|
85
|
+
(entry) => !entry._klaudio && !entry._klonk && !entry.hooks?.[0]?.command?.includes(".claude/sounds/")
|
|
86
86
|
);
|
|
87
87
|
|
|
88
88
|
// Add our hook
|
package/src/tts.js
CHANGED
|
@@ -317,10 +317,9 @@ async function speakPiper(text, onProgress) {
|
|
|
317
317
|
|
|
318
318
|
function speakMacOS(text) {
|
|
319
319
|
return new Promise((resolve) => {
|
|
320
|
-
|
|
321
|
-
execFile("say", ["-v", "Samantha", text], { timeout: 15000 }, (err) => {
|
|
320
|
+
execFile("say", ["-v", "Samantha", text], { timeout: 30000 }, (err) => {
|
|
322
321
|
if (err) {
|
|
323
|
-
execFile("say", [text], { timeout:
|
|
322
|
+
execFile("say", [text], { timeout: 30000 }, () => resolve());
|
|
324
323
|
} else {
|
|
325
324
|
resolve();
|
|
326
325
|
}
|
|
@@ -374,8 +373,12 @@ export async function speak(text, options = {}) {
|
|
|
374
373
|
? { voice: null, onProgress: options } // backwards compat: speak(text, onProgress)
|
|
375
374
|
: options;
|
|
376
375
|
|
|
377
|
-
//
|
|
378
|
-
|
|
376
|
+
// macOS: use built-in `say` (Kokoro's native phonemizer module crashes on macOS)
|
|
377
|
+
if (platform() === "darwin") {
|
|
378
|
+
return speakMacOS(text);
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
// Try Kokoro (best quality, Linux/Windows)
|
|
379
382
|
if (await isKokoroAvailable()) {
|
|
380
383
|
try {
|
|
381
384
|
await speakKokoro(text, voice);
|
|
@@ -385,11 +388,6 @@ export async function speak(text, options = {}) {
|
|
|
385
388
|
}
|
|
386
389
|
}
|
|
387
390
|
|
|
388
|
-
// macOS: use built-in `say`
|
|
389
|
-
if (platform() === "darwin") {
|
|
390
|
-
return speakMacOS(text);
|
|
391
|
-
}
|
|
392
|
-
|
|
393
391
|
// Fallback: Piper
|
|
394
392
|
return speakPiper(text, onProgress);
|
|
395
393
|
} finally {
|