import type { AgentSessionEvent } from "../../../core/agent-session.ts";
import type { AgentSession } from "../../../core/agent-session.ts";
import type { BashResult } from "../../../core/bash-executor.ts";
import type { ReadonlyFooterDataProvider } from "../../../core/footer-data-provider.ts";
import { type Component, type EditorComponent, type EditorTheme, type Focusable, type MarkdownTheme, type TUI } from "@earendil-works/pi-tui";
import { type ChatMessageEntry, type ChatMessageRenderOptions } from "./chat-message-renderer.ts";
import { type ChatTranscriptEntryLike } from "./chat-transcript.ts";
export interface ChatSessionHostStyle {
    dim(text: string): string;
    text(text: string): string;
    textMuted(text: string): string;
    accent(text: string): string;
    accentBold(text: string): string;
    rule(hex: string, text: string): string;
    cursor(): string;
    blank(width: number): string;
    editorRuleColor(disabled: boolean, agentSession: AgentSession | undefined, state?: {
        isBashMode: boolean;
    }): string;
}
export interface ChatSessionHostBashRequest {
    command: string;
    excludeFromContext: boolean;
    onChunk: (chunk: string) => void;
}
export interface ChatSessionHostCommands {
    ensureAttached?: () => Promise<void>;
    prompt?: (text: string) => Promise<void>;
    steer?: (text: string) => Promise<void>;
    followUp?: (text: string) => Promise<void>;
    interrupt?: () => Promise<void>;
    resume?: (message?: string) => Promise<void>;
    runBash?: (request: ChatSessionHostBashRequest) => Promise<BashResult>;
    abortBash?: () => void | Promise<void>;
    abortCompaction?: () => void | Promise<void>;
    handleSlashCommand?: (text: string) => Promise<boolean> | boolean;
}
export interface ChatSessionHostOpts<TExtraEntry extends ChatTranscriptEntryLike = never> {
    style: ChatSessionHostStyle;
    commands?: ChatSessionHostCommands;
    requestRender?: () => void;
    getAgentSession?: () => AgentSession | undefined;
    isStreaming?: () => boolean;
    isPaused?: () => boolean;
    isDisabled?: () => boolean;
    isBashRunning?: () => boolean;
    showWarning?: (message: string) => void;
    showStatus?: (message: string) => void;
    actions?: Record<string, () => void | Promise<void>>;
    getActionKeyDisplay?: (action: string) => string;
    getMarkdownTheme?: () => MarkdownTheme;
    tui?: TUI;
    keybindings?: unknown;
    editorFactory?: (tui: TUI, theme: EditorTheme, keybindings: unknown) => EditorComponent;
    editorTheme: EditorTheme;
    getChatRenderSettings?: () => Partial<Omit<ChatMessageRenderOptions, "ui" | "cwd">> | undefined;
    getCwd?: () => string;
    footerData?: ReadonlyFooterDataProvider;
    renderExtraEntry?: (entry: TExtraEntry) => Component;
}
export type ChatSessionHostEntry<TExtraEntry extends ChatTranscriptEntryLike = never> = ChatMessageEntry | TExtraEntry;
type AgentSnapshotMessage = AgentSession["messages"][number];
export declare class ChatSessionHost<TExtraEntry extends ChatTranscriptEntryLike = never> implements Component, Focusable {
    focused: boolean;
    private readonly style;
    private readonly commands;
    private readonly requestRender;
    private readonly getAgentSession;
    private readonly isStreamingOverride;
    private readonly isPaused;
    private readonly isDisabled;
    private readonly isBashRunningOverride;
    private readonly showWarning;
    private readonly showStatus;
    private readonly actions;
    private readonly getActionKeyDisplay;
    private readonly getMarkdownTheme;
    private readonly getChatRenderSettings;
    private readonly getCwd;
    private readonly footerData;
    private readonly renderExtraEntry;
    private readonly tui;
    private inputBuffer;
    private transcript;
    private statusMessage;
    private isBashMode;
    private localBashRunning;
    private sdkBusy;
    private workingMessage;
    private pendingSteeringMessages;
    private pendingFollowUpMessages;
    private compactionQueuedMessages;
    private compacting;
    private animationTimer;
    private renderThrottleTimer;
    private bodyViewport;
    private liveChat;
    private editor;
    private optimisticUserSignatureCounts;
    constructor(opts: ChatSessionHostOpts<TExtraEntry>);
    appendMessages(messages: readonly AgentSnapshotMessage[]): void;
    loadSessionFile(sessionFile: string | undefined): void;
    appendExtraEntry(entry: TExtraEntry): void;
    entries(): readonly ChatSessionHostEntry<TExtraEntry>[];
    private incrementOptimisticUserSignature;
    private decrementOptimisticUserSignature;
    applyAgentEvent(event: AgentSessionEvent): boolean;
    render(width: number): string[];
    invalidate(): void;
    renderBody(width: number, budget: number): string[];
    renderPendingMessages(width: number): string[];
    renderWorkingStatus(width: number): string[];
    renderUsage(width: number): string[];
    renderEditor(width: number): string[];
    renderFooter(width: number): string[];
    handleScrollInput(data: string): boolean;
    handleInput(data: string): boolean;
    interrupt(): Promise<void>;
    submit(mode?: "auto" | "followUp", submittedText?: string): Promise<void>;
    isStreaming(): boolean;
    isBashRunning(): boolean;
    isEditingBashCommand(): boolean;
    hasInputText(): boolean;
    hasAnimationTick(): boolean;
    bodyScrollFromBottom(): number;
    bodyMaxScroll(): number;
    inputText(): string;
    statusText(): string;
    scrollToBottom(): void;
    syncAnimationTick(): void;
    dispose(): void;
    private createEditor;
    private createInheritedEditor;
    private editorAccess;
    private openExternalEditor;
    private tuiHost;
    private setEditorText;
    private renderEntry;
    private streamingWindowedEntry;
    private chatMessageRenderOptions;
    private toolTui;
    private pendingMessageLine;
    private abortCompaction;
    private abortBash;
    private runBashCommand;
    private flushCompactionQueue;
    private queueSteer;
    private queueFollowUp;
    restoreQueuedMessagesToEditor(): boolean;
    private notifyWarning;
    private notifyStatus;
    private requiredCommand;
    private afterEvent;
    private requestEventRender;
}
export {};
//# sourceMappingURL=chat-session-host.d.ts.map