@hxnnxs/opencode-voice 0.1.4 → 0.1.5
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/CHANGELOG.md +6 -0
- package/index.js +4 -1
- package/lib/engine.js +38 -5
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project are documented here.
|
|
4
4
|
|
|
5
|
+
## 0.1.5 - 2026-06-17
|
|
6
|
+
|
|
7
|
+
### Fixed
|
|
8
|
+
|
|
9
|
+
- Recovered missing `ffmpeg-static` at runtime on Windows by installing it locally when not present, preventing `No recorder found` failures after fresh plugin installs.
|
|
10
|
+
|
|
5
11
|
## 0.1.4 - 2026-06-16
|
|
6
12
|
|
|
7
13
|
### Added
|
package/index.js
CHANGED
|
@@ -362,10 +362,13 @@ function showDiagnostics(ctx) {
|
|
|
362
362
|
const model = getModel(settings.model);
|
|
363
363
|
const commandOptions = { ...ctx.options, downloadDir: settings.downloadDir };
|
|
364
364
|
const whisperCli = resolveCommand("whisper-cli", commandOptions);
|
|
365
|
+
const ffmpeg = resolveCommand("ffmpeg", commandOptions);
|
|
366
|
+
const arecord = resolveCommand("arecord", commandOptions);
|
|
367
|
+
const sox = resolveCommand("sox", commandOptions);
|
|
365
368
|
const engine = getEngineStatus("whisper.cpp", ctx.options, settings);
|
|
366
369
|
const lines = [
|
|
367
370
|
`Platform: ${process.platform}-${process.arch}`,
|
|
368
|
-
`Recorder: ffmpeg=${
|
|
371
|
+
`Recorder: ffmpeg=${ffmpeg ? "yes" : "no"}${ffmpeg ? ` (${ffmpeg})` : ""}, arecord=${arecord ? "yes" : "no"}, sox=${sox ? "yes" : "no"}`,
|
|
369
372
|
`Engine: ${engine.id}`,
|
|
370
373
|
`Engine source: ${engine.source}`,
|
|
371
374
|
`whisper-cli: ${whisperCli || "missing"}`,
|
package/lib/engine.js
CHANGED
|
@@ -3,10 +3,15 @@ import os from "node:os";
|
|
|
3
3
|
import path from "node:path";
|
|
4
4
|
import { createRequire } from "node:module";
|
|
5
5
|
import { spawn, spawnSync } from "node:child_process";
|
|
6
|
+
import { fileURLToPath } from "node:url";
|
|
6
7
|
import { ensureDir } from "./download.js";
|
|
7
8
|
import { getAudioDir, getEnginesDir, getModelPath } from "./models.js";
|
|
8
9
|
|
|
9
10
|
const require = createRequire(import.meta.url);
|
|
11
|
+
const FFMPEG_STATIC_PACKAGE = "ffmpeg-static@^5.2.0";
|
|
12
|
+
const PLUGIN_ROOT = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "..");
|
|
13
|
+
let ffmpegStaticPathCache;
|
|
14
|
+
let ffmpegStaticInstallAttempted = false;
|
|
10
15
|
|
|
11
16
|
const RECORDING_MIN_BYTES = 44;
|
|
12
17
|
|
|
@@ -36,12 +41,40 @@ function executableNames(command) {
|
|
|
36
41
|
|
|
37
42
|
function bundledFfmpegPath() {
|
|
38
43
|
if (process.platform !== "win32") return "";
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
+
if (ffmpegStaticPathCache !== undefined) return ffmpegStaticPathCache;
|
|
45
|
+
|
|
46
|
+
const resolveFromDependency = () => {
|
|
47
|
+
try {
|
|
48
|
+
const candidate = require("ffmpeg-static");
|
|
49
|
+
return typeof candidate === "string" ? path.resolve(candidate) : "";
|
|
50
|
+
} catch {
|
|
51
|
+
return "";
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
const installDependency = () => {
|
|
56
|
+
const npm = process.platform === "win32" ? "npm.cmd" : "npm";
|
|
57
|
+
try {
|
|
58
|
+
const result = spawnSync(npm, ["install", "--no-save", "--no-audit", "--no-fund", FFMPEG_STATIC_PACKAGE], {
|
|
59
|
+
cwd: PLUGIN_ROOT,
|
|
60
|
+
stdio: "ignore",
|
|
61
|
+
});
|
|
62
|
+
return result.status === 0;
|
|
63
|
+
} catch {
|
|
64
|
+
return false;
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
let candidate = resolveFromDependency();
|
|
69
|
+
if (!candidate && !ffmpegStaticInstallAttempted) {
|
|
70
|
+
ffmpegStaticInstallAttempted = true;
|
|
71
|
+
if (installDependency()) {
|
|
72
|
+
candidate = resolveFromDependency();
|
|
73
|
+
}
|
|
44
74
|
}
|
|
75
|
+
|
|
76
|
+
ffmpegStaticPathCache = candidate || "";
|
|
77
|
+
return ffmpegStaticPathCache;
|
|
45
78
|
}
|
|
46
79
|
|
|
47
80
|
function platformKey(options = {}) {
|