run: add shell mode to prompt (#28315)

Press `!` on an empty prompt to enter shell mode and run a command
through session.shell instead of sending a message
This commit is contained in:
Simon Klee 2026-05-20 09:09:12 +02:00 committed by GitHub
commit 539b118690
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
12 changed files with 665 additions and 47 deletions

View file

@ -102,7 +102,7 @@ export async function runPromptQueue(input: QueueInput): Promise<void> {
continue
}
if (isNewCommand(prompt.text)) {
if (prompt.mode !== "shell" && isNewCommand(prompt.text)) {
emit(
{
type: "queue",
@ -167,9 +167,11 @@ export async function runPromptQueue(input: QueueInput): Promise<void> {
break
}
const commit = { kind: "user", text: prompt.text, phase: "start", source: "system" } as const
input.trace?.write("ui.commit", commit)
input.footer.append(commit)
if (prompt.mode !== "shell") {
const commit = { kind: "user", text: prompt.text, phase: "start", source: "system" } as const
input.trace?.write("ui.commit", commit)
input.footer.append(commit)
}
input.onSend?.(prompt)
if (state.closed) {
@ -234,7 +236,7 @@ export async function runPromptQueue(input: QueueInput): Promise<void> {
return
}
if (isExitCommand(prompt.text)) {
if (prompt.mode !== "shell" && isExitCommand(prompt.text)) {
input.footer.close()
return
}
@ -249,7 +251,7 @@ export async function runPromptQueue(input: QueueInput): Promise<void> {
queue: state.queue.length,
},
)
if (isNewCommand(prompt.text)) {
if (prompt.mode !== "shell" && isNewCommand(prompt.text)) {
drain()
return
}