opencode-interrupt-plugin 0.4.45 → 0.4.46
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/dist/index.js +16 -6
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -78,6 +78,19 @@ function incrementInterruptCount() {
|
|
|
78
78
|
const RECORDING_FILE = "/tmp/interrupt-ptt.wav";
|
|
79
79
|
let recordingProcess = null;
|
|
80
80
|
let pttActive = false;
|
|
81
|
+
let whisperAvailable = null;
|
|
82
|
+
function checkWhisperAvailable() {
|
|
83
|
+
if (whisperAvailable !== null)
|
|
84
|
+
return whisperAvailable;
|
|
85
|
+
try {
|
|
86
|
+
execSync("whisper --help", { stdio: "ignore", timeout: 5000 });
|
|
87
|
+
whisperAvailable = true;
|
|
88
|
+
}
|
|
89
|
+
catch {
|
|
90
|
+
whisperAvailable = false;
|
|
91
|
+
}
|
|
92
|
+
return whisperAvailable;
|
|
93
|
+
}
|
|
81
94
|
function pttStartRecording() {
|
|
82
95
|
if (recordingProcess)
|
|
83
96
|
return;
|
|
@@ -96,19 +109,16 @@ function pttStopRecording() {
|
|
|
96
109
|
recordingProcess = null;
|
|
97
110
|
}
|
|
98
111
|
const TXT_FILE = "/tmp/interrupt-ptt.txt";
|
|
112
|
+
const WHISPER_FLAGS = ["-t", "1", "-bo", "1", "-bs", "1", "-nf"];
|
|
99
113
|
async function transcribeLocal(modelPath) {
|
|
100
|
-
|
|
101
|
-
execSync("whisper --help", { stdio: "ignore", timeout: 3000 });
|
|
102
|
-
}
|
|
103
|
-
catch {
|
|
114
|
+
if (!checkWhisperAvailable())
|
|
104
115
|
return null;
|
|
105
|
-
}
|
|
106
116
|
try {
|
|
107
117
|
unlinkSync(TXT_FILE);
|
|
108
118
|
}
|
|
109
119
|
catch { /* ignore */ }
|
|
110
120
|
try {
|
|
111
|
-
execSync(`whisper -f "${RECORDING_FILE}" -m "${modelPath}" -otxt -of /tmp/interrupt-ptt`, { stdio: "ignore", timeout: 30000 });
|
|
121
|
+
execSync(`whisper -f "${RECORDING_FILE}" -m "${modelPath}" -otxt -of /tmp/interrupt-ptt ${WHISPER_FLAGS.join(" ")}`, { stdio: "ignore", timeout: 30000 });
|
|
112
122
|
}
|
|
113
123
|
catch {
|
|
114
124
|
return null;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "opencode-interrupt-plugin",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.46",
|
|
4
4
|
"description": "Streaming TTS + voice interruption for OpenCode. Speaks responses as they arrive and detects when you talk over it.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|