Skip to content
This repository was archived by the owner on Apr 1, 2026. It is now read-only.

Commit ee1ff8c

Browse files
committed
tui: add ability to interrupt running sessions from command palette
1 parent 434c0ff commit ee1ff8c

1 file changed

Lines changed: 19 additions & 12 deletions

File tree

  • packages/opencode/src/cli/cmd/tui/component/prompt

packages/opencode/src/cli/cmd/tui/component/prompt/index.tsx

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -115,15 +115,11 @@ export function Prompt(props: PromptProps) {
115115
{
116116
title: "Clear prompt",
117117
value: "prompt.clear",
118-
disabled: true,
119118
category: "Prompt",
119+
disabled: true,
120120
onSelect: (dialog) => {
121121
input.extmarks.clear()
122-
setStore("prompt", {
123-
input: "",
124-
parts: [],
125-
})
126-
setStore("extmarkToPartIndex", new Map())
122+
input.clear()
127123
dialog.clear()
128124
},
129125
},
@@ -156,16 +152,27 @@ export function Prompt(props: PromptProps) {
156152
}
157153
},
158154
},
155+
{
156+
title: "Interrupt session",
157+
value: "session.interrupt",
158+
keybind: "session_interrupt",
159+
category: "Session",
160+
disabled: true,
161+
onSelect: (dialog) => {
162+
if (!props.sessionID) return
163+
sdk.client.session.abort({
164+
path: {
165+
id: props.sessionID,
166+
},
167+
})
168+
dialog.clear()
169+
},
170+
},
159171
]
160172
})
161173

162174
sdk.event.on(TuiEvent.PromptAppend.type, (evt) => {
163-
setStore(
164-
"prompt",
165-
produce((draft) => {
166-
draft.input += evt.properties.text
167-
}),
168-
)
175+
input.insertText(evt.properties.text)
169176
})
170177

171178
createEffect(() => {

0 commit comments

Comments
 (0)