opencode-interrupt-plugin 0.4.27 → 0.4.30
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.d.ts +0 -2
- package/dist/index.js +3 -54
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import type { Plugin } from '@opencode-ai/plugin';
|
|
2
|
-
import type { TuiPlugin } from '@opencode-ai/plugin/tui';
|
|
3
2
|
import { type PluginConfig } from './config.js';
|
|
4
3
|
export declare const InterruptPlugin: (userConfig?: PluginConfig) => Plugin;
|
|
5
|
-
export declare const tui: TuiPlugin;
|
|
6
4
|
declare const _default: Plugin;
|
|
7
5
|
export default _default;
|
package/dist/index.js
CHANGED
|
@@ -147,7 +147,7 @@ const TTS_COMMANDS = [
|
|
|
147
147
|
{ name: 'tts-on', description: 'Enable streaming TTS', template: 'TTS enabled.' },
|
|
148
148
|
{ name: 'tts-off', description: 'Disable streaming TTS', template: 'TTS disabled.' },
|
|
149
149
|
{ name: 'tts-speak', description: 'Speak text immediately', template: '$ARGUMENTS' },
|
|
150
|
-
{ name: '
|
|
150
|
+
{ name: 'ptt', description: 'Toggle walkie-talkie recording (start/stop + transcribe)', template: 'Toggles PTT recording.' },
|
|
151
151
|
];
|
|
152
152
|
export const InterruptPlugin = (userConfig = {}) => {
|
|
153
153
|
return async ({ client }) => {
|
|
@@ -320,9 +320,9 @@ export const InterruptPlugin = (userConfig = {}) => {
|
|
|
320
320
|
}
|
|
321
321
|
},
|
|
322
322
|
'command.execute.before': async (cmdInput) => {
|
|
323
|
-
if (!cmdInput.command.startsWith('tts-') && cmdInput.command !== '
|
|
323
|
+
if (!cmdInput.command.startsWith('tts-') && cmdInput.command !== 'ptt')
|
|
324
324
|
return;
|
|
325
|
-
if (cmdInput.command === '
|
|
325
|
+
if (cmdInput.command === 'ptt') {
|
|
326
326
|
const sessionID = cmdInput.sessionID;
|
|
327
327
|
if (pttActive) {
|
|
328
328
|
pttActive = false;
|
|
@@ -443,55 +443,4 @@ function extractText(parts) {
|
|
|
443
443
|
return '';
|
|
444
444
|
}
|
|
445
445
|
}
|
|
446
|
-
export const tui = async (api, _options, _meta) => {
|
|
447
|
-
console.log("[interrupt] TUI plugin initializing");
|
|
448
|
-
try {
|
|
449
|
-
api.keymap.registerLayer({
|
|
450
|
-
priority: 0,
|
|
451
|
-
commands: [
|
|
452
|
-
{
|
|
453
|
-
name: "interrupt.ptt",
|
|
454
|
-
title: "Walkie-Talkie (insert to record, press again to send)",
|
|
455
|
-
category: "Plugin",
|
|
456
|
-
run: async () => {
|
|
457
|
-
console.log("[interrupt] Command interrupt.ptt executed");
|
|
458
|
-
const route = api.route.current;
|
|
459
|
-
const sessionID = route.name === "session"
|
|
460
|
-
? route.params?.sessionID
|
|
461
|
-
: undefined;
|
|
462
|
-
const directory = api.state.path.directory;
|
|
463
|
-
if (pttActive) {
|
|
464
|
-
pttActive = false;
|
|
465
|
-
await transcribeAndSend(sessionID, directory, api);
|
|
466
|
-
}
|
|
467
|
-
else {
|
|
468
|
-
pttActive = true;
|
|
469
|
-
if (sessionID) {
|
|
470
|
-
try {
|
|
471
|
-
await api.client.session.abort({ sessionID, directory });
|
|
472
|
-
}
|
|
473
|
-
catch { /* ignore */ }
|
|
474
|
-
}
|
|
475
|
-
pttStartRecording();
|
|
476
|
-
api.ui.toast({ variant: "info", title: "PTT", message: "Recording... (insert again to send)" });
|
|
477
|
-
}
|
|
478
|
-
},
|
|
479
|
-
},
|
|
480
|
-
],
|
|
481
|
-
bindings: [{ key: "insert", cmd: "interrupt.ptt" }],
|
|
482
|
-
});
|
|
483
|
-
console.log("[interrupt] Layer registered successfully");
|
|
484
|
-
}
|
|
485
|
-
catch (err) {
|
|
486
|
-
console.error("[interrupt] Failed to register layer:", err);
|
|
487
|
-
}
|
|
488
|
-
api.lifecycle.onDispose(() => {
|
|
489
|
-
console.log("[interrupt] TUI plugin disposed");
|
|
490
|
-
if (recordingProcess) {
|
|
491
|
-
recordingProcess.kill("SIGTERM");
|
|
492
|
-
recordingProcess = null;
|
|
493
|
-
}
|
|
494
|
-
pttActive = false;
|
|
495
|
-
});
|
|
496
|
-
};
|
|
497
446
|
export default InterruptPlugin();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "opencode-interrupt-plugin",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.30",
|
|
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",
|