opencode-interrupt-plugin 0.4.20 → 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.
Files changed (2) hide show
  1. package/dist/tui.js +37 -30
  2. 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, registering insert keybinding");
115
- api.keymap.registerLayer({
116
- commands: [
117
- {
118
- name: "interrupt.ptt",
119
- title: "Walkie-Talkie (press insert to record, press again to send)",
120
- category: "Plugin",
121
- run: async () => {
122
- const route = api.route.current;
123
- const sessionID = route.name === "session"
124
- ? route.params?.sessionID
125
- : undefined;
126
- const directory = api.state.path.directory;
127
- if (active) {
128
- active = false;
129
- await transcribeAndSend(sessionID, directory, api);
130
- }
131
- else {
132
- active = true;
133
- if (sessionID) {
134
- try {
135
- await api.client.session.abort({ sessionID, directory });
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
- catch { /* ignore */ }
141
+ pttStartRecording();
142
+ api.ui.toast({ variant: "info", title: "PTT", message: "Recording... (ctrl+alt+m again to send)" });
138
143
  }
139
- pttStartRecording();
140
- api.ui.toast({ variant: "info", title: "PTT", message: "Recording... (press insert again to send)" });
141
- }
144
+ },
142
145
  },
143
- },
144
- ],
145
- bindings: [{ key: "insert", cmd: "interrupt.ptt" }],
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.20",
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",