opencode-interrupt-plugin 0.4.18 → 0.4.21
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/tui.js +37 -30
- package/package.json +1 -1
package/dist/tui.js
CHANGED
|
@@ -111,39 +111,46 @@ async function transcribeAndSend(sessionID, directory, api) {
|
|
|
111
111
|
api.ui.toast({ variant: "success", title: "PTT", message: `Sent: "${text.slice(0, 60)}"` });
|
|
112
112
|
}
|
|
113
113
|
const tui = async (api, _options, _meta) => {
|
|
114
|
-
console.log("[interrupt] TUI plugin loaded,
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
114
|
+
console.log("[interrupt] TUI plugin loaded, keymap available:", !!api.keymap);
|
|
115
|
+
try {
|
|
116
|
+
const layer = api.keymap.registerLayer({
|
|
117
|
+
priority: 1000,
|
|
118
|
+
commands: [
|
|
119
|
+
{
|
|
120
|
+
name: "interrupt.ptt",
|
|
121
|
+
title: "Walkie-Talkie (ctrl+alt+m to record, press again to send)",
|
|
122
|
+
category: "Plugin",
|
|
123
|
+
run: async () => {
|
|
124
|
+
const route = api.route.current;
|
|
125
|
+
const sessionID = route.name === "session"
|
|
126
|
+
? route.params?.sessionID
|
|
127
|
+
: undefined;
|
|
128
|
+
const directory = api.state.path.directory;
|
|
129
|
+
if (active) {
|
|
130
|
+
active = false;
|
|
131
|
+
await transcribeAndSend(sessionID, directory, api);
|
|
132
|
+
}
|
|
133
|
+
else {
|
|
134
|
+
active = true;
|
|
135
|
+
if (sessionID) {
|
|
136
|
+
try {
|
|
137
|
+
await api.client.session.abort({ sessionID, directory });
|
|
138
|
+
}
|
|
139
|
+
catch { /* ignore */ }
|
|
136
140
|
}
|
|
137
|
-
|
|
141
|
+
pttStartRecording();
|
|
142
|
+
api.ui.toast({ variant: "info", title: "PTT", message: "Recording... (ctrl+alt+m again to send)" });
|
|
138
143
|
}
|
|
139
|
-
|
|
140
|
-
api.ui.toast({ variant: "info", title: "PTT", message: "Recording... (press f3 again to send)" });
|
|
141
|
-
}
|
|
144
|
+
},
|
|
142
145
|
},
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
146
|
+
],
|
|
147
|
+
bindings: [{ key: "ctrl+alt+m", cmd: "interrupt.ptt" }],
|
|
148
|
+
});
|
|
149
|
+
console.log("[interrupt] Layer registered, dispose fn type:", typeof layer);
|
|
150
|
+
}
|
|
151
|
+
catch (err) {
|
|
152
|
+
console.error("[interrupt] registerLayer failed:", err);
|
|
153
|
+
}
|
|
147
154
|
api.lifecycle.onDispose(() => {
|
|
148
155
|
if (recordingProcess) {
|
|
149
156
|
recordingProcess.kill("SIGTERM");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "opencode-interrupt-plugin",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.21",
|
|
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",
|