opencode-interrupt-plugin 0.4.14 → 0.4.16

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.
Files changed (2) hide show
  1. package/dist/tui.js +7 -18
  2. package/package.json +1 -1
package/dist/tui.js CHANGED
@@ -2,10 +2,8 @@ import { spawn, execSync } from "node:child_process";
2
2
  import { readFileSync, existsSync, unlinkSync } from "node:fs";
3
3
  const RECORDING_FILE = "/tmp/interrupt-ptt.wav";
4
4
  const WHISPER_MODEL = process.env.WHISPER_MODEL || `${process.env.HOME}/.local/bin/ggml-base.bin`;
5
- const RELEASE_TIMEOUT_MS = 300;
6
5
  let recordingProcess = null;
7
6
  let active = false;
8
- let releaseTimer = null;
9
7
  function pttStartRecording() {
10
8
  if (recordingProcess)
11
9
  return;
@@ -117,7 +115,7 @@ const tui = async (api, _options, _meta) => {
117
115
  commands: [
118
116
  {
119
117
  name: "interrupt.ptt",
120
- title: "Walkie-Talkie (hold alt+space to talk, release to redirect)",
118
+ title: "Walkie-Talkie (press f2 to record, press again to send)",
121
119
  category: "Plugin",
122
120
  run: async () => {
123
121
  const route = api.route.current;
@@ -125,11 +123,11 @@ const tui = async (api, _options, _meta) => {
125
123
  ? route.params?.sessionID
126
124
  : undefined;
127
125
  const directory = api.state.path.directory;
128
- if (releaseTimer) {
129
- clearTimeout(releaseTimer);
130
- releaseTimer = null;
126
+ if (active) {
127
+ active = false;
128
+ await transcribeAndSend(sessionID, directory, api);
131
129
  }
132
- if (!active) {
130
+ else {
133
131
  active = true;
134
132
  if (sessionID) {
135
133
  try {
@@ -138,23 +136,14 @@ const tui = async (api, _options, _meta) => {
138
136
  catch { /* ignore */ }
139
137
  }
140
138
  pttStartRecording();
141
- api.ui.toast({ variant: "info", title: "PTT", message: "Recording... (release space to send)" });
139
+ api.ui.toast({ variant: "info", title: "PTT", message: "Recording... (press f2 again to send)" });
142
140
  }
143
- releaseTimer = setTimeout(() => {
144
- releaseTimer = null;
145
- if (!active)
146
- return;
147
- active = false;
148
- transcribeAndSend(sessionID, directory, api);
149
- }, RELEASE_TIMEOUT_MS);
150
141
  },
151
142
  },
152
143
  ],
153
- bindings: [{ key: "alt+space", cmd: "interrupt.ptt" }],
144
+ bindings: [{ key: "f2", cmd: "interrupt.ptt" }],
154
145
  });
155
146
  api.lifecycle.onDispose(() => {
156
- if (releaseTimer)
157
- clearTimeout(releaseTimer);
158
147
  if (recordingProcess) {
159
148
  recordingProcess.kill("SIGTERM");
160
149
  recordingProcess = null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencode-interrupt-plugin",
3
- "version": "0.4.14",
3
+ "version": "0.4.16",
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",