opencode-interrupt-plugin 0.4.32 → 0.4.33
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 +13 -10
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -89,13 +89,13 @@ async function transcribeAndSend(sessionID, directory, api) {
|
|
|
89
89
|
api.ui.toast({ variant: "warning", title: "PTT", message: "No audio captured" });
|
|
90
90
|
return;
|
|
91
91
|
}
|
|
92
|
-
api.ui.toast({ variant: "info", title: "PTT", message: "Transcribing..." });
|
|
92
|
+
api.ui.toast({ variant: "info", title: "PTT", message: "⏳ Transcribing with Whisper..." });
|
|
93
93
|
let text = null;
|
|
94
94
|
text = await transcribeLocal();
|
|
95
95
|
if (!text)
|
|
96
96
|
text = await transcribeAPI();
|
|
97
97
|
if (!text) {
|
|
98
|
-
api.ui.toast({ variant: "error", title: "PTT", message: "
|
|
98
|
+
api.ui.toast({ variant: "error", title: "PTT", message: "❌ Install whisper: run scripts/install-whisper.sh, or set OPENAI_API_KEY" });
|
|
99
99
|
try {
|
|
100
100
|
unlinkSync(RECORDING_FILE);
|
|
101
101
|
}
|
|
@@ -107,25 +107,27 @@ async function transcribeAndSend(sessionID, directory, api) {
|
|
|
107
107
|
}
|
|
108
108
|
catch { /* ignore */ }
|
|
109
109
|
if (!sessionID) {
|
|
110
|
-
api.ui.toast({ variant: "warning", title: "PTT", message: "
|
|
110
|
+
api.ui.toast({ variant: "warning", title: "PTT", message: "⚠️ Open a session first, then type /ptt" });
|
|
111
111
|
return;
|
|
112
112
|
}
|
|
113
|
+
api.ui.toast({ variant: "info", title: "PTT", message: "✉️ Sending transcript..." });
|
|
113
114
|
await api.client.session.prompt({ sessionID, directory, parts: [{ type: "text", text }] });
|
|
114
|
-
|
|
115
|
+
const preview = text.length > 80 ? text.slice(0, 77) + "..." : text;
|
|
116
|
+
api.ui.toast({ variant: "success", title: "PTT", message: `✅ Sent: "${preview}"` });
|
|
115
117
|
}
|
|
116
118
|
async function transcribeAndSendV1(sessionID, client) {
|
|
117
119
|
pttStopRecording();
|
|
118
120
|
if (!existsSync(RECORDING_FILE)) {
|
|
119
|
-
await client.tui.showToast({ body: { title: "PTT", message: "No audio captured — try again", variant: "warning" } });
|
|
121
|
+
await client.tui.showToast({ body: { title: "PTT", message: "⚠️ No audio captured — try again", variant: "warning" } });
|
|
120
122
|
return;
|
|
121
123
|
}
|
|
122
|
-
await client.tui.showToast({ body: { title: "PTT", message: "Transcribing with Whisper...", variant: "info" } });
|
|
124
|
+
await client.tui.showToast({ body: { title: "PTT", message: "⏳ Transcribing with Whisper...", variant: "info" } });
|
|
123
125
|
let text = null;
|
|
124
126
|
text = await transcribeLocal();
|
|
125
127
|
if (!text)
|
|
126
128
|
text = await transcribeAPI();
|
|
127
129
|
if (!text) {
|
|
128
|
-
await client.tui.showToast({ body: { title: "PTT", message: "Install whisper: run scripts/install-whisper.sh, or set OPENAI_API_KEY", variant: "error", duration: 8000 } });
|
|
130
|
+
await client.tui.showToast({ body: { title: "PTT", message: "❌ Install whisper: run scripts/install-whisper.sh, or set OPENAI_API_KEY", variant: "error", duration: 8000 } });
|
|
129
131
|
try {
|
|
130
132
|
unlinkSync(RECORDING_FILE);
|
|
131
133
|
}
|
|
@@ -137,12 +139,13 @@ async function transcribeAndSendV1(sessionID, client) {
|
|
|
137
139
|
}
|
|
138
140
|
catch { /* ignore */ }
|
|
139
141
|
if (!sessionID) {
|
|
140
|
-
await client.tui.showToast({ body: { title: "PTT", message: "Open a session first, then type /ptt", variant: "warning", duration: 5000 } });
|
|
142
|
+
await client.tui.showToast({ body: { title: "PTT", message: "⚠️ Open a session first, then type /ptt", variant: "warning", duration: 5000 } });
|
|
141
143
|
return;
|
|
142
144
|
}
|
|
145
|
+
await client.tui.showToast({ body: { title: "PTT", message: "✉️ Sending transcript...", variant: "info" } });
|
|
143
146
|
await client.session.prompt({ path: { id: sessionID }, body: { parts: [{ type: "text", text }] } });
|
|
144
147
|
const preview = text.length > 80 ? text.slice(0, 77) + "..." : text;
|
|
145
|
-
await client.tui.showToast({ body: { title: "PTT", message:
|
|
148
|
+
await client.tui.showToast({ body: { title: "PTT", message: `✅ Sent: "${preview}"`, variant: "success", duration: 5000 } });
|
|
146
149
|
}
|
|
147
150
|
const TTS_COMMANDS = [
|
|
148
151
|
{ name: 'tts-on', description: 'Enable streaming TTS', template: 'TTS enabled.' },
|
|
@@ -338,7 +341,7 @@ export const InterruptPlugin = (userConfig = {}) => {
|
|
|
338
341
|
catch { /* ignore */ }
|
|
339
342
|
}
|
|
340
343
|
pttStartRecording();
|
|
341
|
-
await client.tui.showToast({ body: { title: "PTT", message: "Recording... type /ptt to stop", variant: "info" } });
|
|
344
|
+
await client.tui.showToast({ body: { title: "PTT", message: "🎤 Recording... type /ptt to stop", variant: "info" } });
|
|
342
345
|
}
|
|
343
346
|
throw new Error('Command handled by interrupt plugin');
|
|
344
347
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "opencode-interrupt-plugin",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.33",
|
|
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",
|