add run --replay mode (#30239)

This commit is contained in:
Simon Klee 2026-06-01 15:11:45 +02:00 committed by GitHub
commit 6a3b2f339a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
16 changed files with 1292 additions and 58 deletions

View file

@ -162,7 +162,14 @@ export async function runPromptQueue(input: QueueInput): Promise<void> {
continue
}
state.active = prompt
const sent =
prompt.mode === "shell"
? prompt
: {
...prompt,
messageID: prompt.messageID ?? queued?.messageID ?? MessageID.ascending(),
}
state.active = sent
emit(
{
@ -185,18 +192,24 @@ export async function runPromptQueue(input: QueueInput): Promise<void> {
break
}
if (prompt.mode !== "shell") {
const commit = { kind: "user", text: prompt.text, phase: "start", source: "system" } as const
if (sent.mode !== "shell") {
const commit = {
kind: "user",
text: sent.text,
phase: "start",
source: "system",
messageID: sent.messageID,
} as const
input.trace?.write("ui.commit", commit)
input.footer.append(commit)
}
input.onSend?.(prompt)
input.onSend?.(sent)
if (state.closed) {
break
}
const task = input.run(prompt, ctrl.signal).then(
const task = input.run(sent, ctrl.signal).then(
() => ({ type: "done" as const }),
(error) => ({ type: "error" as const, error }),
)