mirror of
https://github.com/HKUDS/nanobot.git
synced 2026-09-01 00:31:51 +03:00
* feat(tui): support pasting clipboard images * fix(tui): keep image placeholders atomic * fix(tui): reconcile duplicate image placeholders * fix(tui): retain highlighted image placeholders * fix(tui): preserve image placeholder layout * fix(tui): keep image display state local * fix(tui): reject images in commands
43 lines
816 B
TypeScript
43 lines
816 B
TypeScript
import type { MessageOptions } from "./protocol"
|
|
|
|
export interface QueuedPrompt {
|
|
content: string
|
|
displayContent?: string
|
|
options: MessageOptions
|
|
}
|
|
|
|
/** Owns prompts that should start after the active turn finishes. */
|
|
export class PromptQueue {
|
|
private prompts: QueuedPrompt[] = []
|
|
|
|
get length(): number {
|
|
return this.prompts.length
|
|
}
|
|
|
|
enqueue(prompt: QueuedPrompt): void {
|
|
this.prompts.push(prompt)
|
|
}
|
|
|
|
takeLast(): QueuedPrompt | null {
|
|
return this.prompts.pop() ?? null
|
|
}
|
|
|
|
takeFollowUp(): QueuedPrompt | null {
|
|
return this.prompts.shift() ?? null
|
|
}
|
|
|
|
snapshot(): readonly QueuedPrompt[] {
|
|
return this.prompts
|
|
}
|
|
|
|
restore(): QueuedPrompt[] {
|
|
const prompts = this.prompts
|
|
this.prompts = []
|
|
return prompts
|
|
}
|
|
|
|
clear(): void {
|
|
this.prompts = []
|
|
}
|
|
}
|