import type { Interface as ReadlineInterface } from 'readline'; import type { ImageAttachment } from './attachments.js'; import type { AutocompleteState } from './autocomplete-state.js'; export interface IHistoryRing { back(draft: string): string | null; forward(): string | null; resetRecall(): void; readonly inRecall: boolean; getEntries?(): readonly string[]; push?(text: string): void; removeAt?(idx: number): boolean; clear?(): void; readonly length?: number; } export type Trigger = { kind: 'slash'; query: string; } | { kind: 'file'; query: string; } | { kind: 'flag'; command: string; query: string; }; export interface Candidate { value: string; summary?: string; hint?: string; } export interface ReadWithAutocompleteOpts { rl: ReadlineInterface; promptFn: (buffer?: string) => string; onSigint?: () => void; initialBuffer?: string; onShiftTab?: () => void; history?: IHistoryRing; compositor?: { isArmed(): boolean; }; autocompleteState?: AutocompleteState; statusLine?: { getExtraRows(): number; setExtraRows(n: number): void; withFullScrollRegion?(fn: () => T): T; }; } export interface ReadWithAutocompleteResult { text: string; attachments: ImageAttachment[]; } export interface KeyInfo { name?: string; sequence?: string; ctrl?: boolean; meta?: boolean; shift?: boolean; }