diff --git a/packages/opencode/src/cli/cmd/tui/routes/session/index.tsx b/packages/opencode/src/cli/cmd/tui/routes/session/index.tsx index d5298518700..fbf6eb25c4b 100644 --- a/packages/opencode/src/cli/cmd/tui/routes/session/index.tsx +++ b/packages/opencode/src/cli/cmd/tui/routes/session/index.tsx @@ -248,13 +248,35 @@ export function Session() { dialog.clear() } - useKeyboard((evt) => { + useKeyboard(async (evt) => { if (dialog.stack.length > 0) return const first = permissions()[0] if (first) { + if (evt.ctrl || evt.meta) return + + // Handle interject with "i" key - opens prompt for user suggestion + if (evt.name === "i") { + const interjection = await DialogPrompt.show(dialog, "Interject", { + placeholder: "Enter your suggestion...", + description: () => ( + + Provide a suggestion or correction for the model to consider + + ), + }) + if (interjection !== null && interjection.trim()) { + sdk.client.permission.respond({ + permissionID: first.id, + sessionID: route.sessionID, + response: "interject", + interjection: interjection.trim(), + }) + } + return + } + const response = iife(() => { - if (evt.ctrl || evt.meta) return if (evt.name === "return") return "once" if (evt.name === "a") return "always" if (evt.name === "d") return "reject" @@ -1495,6 +1517,10 @@ function ToolPart(props: { last: boolean; part: ToolPart; message: AssistantMess d deny + + i + interject + )} diff --git a/packages/opencode/src/cli/cmd/tui/ui/dialog-prompt.tsx b/packages/opencode/src/cli/cmd/tui/ui/dialog-prompt.tsx index 1b9acb5898e..519a75dd1a1 100644 --- a/packages/opencode/src/cli/cmd/tui/ui/dialog-prompt.tsx +++ b/packages/opencode/src/cli/cmd/tui/ui/dialog-prompt.tsx @@ -21,6 +21,7 @@ export function DialogPrompt(props: DialogPromptProps) { useKeyboard((evt) => { if (evt.name === "return") { props.onConfirm?.(textarea.plainText) + dialog.clear() } }) @@ -45,6 +46,7 @@ export function DialogPrompt(props: DialogPromptProps) {