import type { AssistantMessage, ToolResultMessage } from "@earendil-works/pi-ai";
import type { AgentMessage } from "@earendil-works/pi-agent-core";
import { type Component, type MarkdownTheme, type TUI } from "@earendil-works/pi-tui";
import type { MessageRenderer, ToolDefinition } from "../../../core/extensions/types.js";
import type { BashExecutionMessage, BranchSummaryMessage, CompactionSummaryMessage, CustomMessage } from "../../../core/messages.js";
export type ChatMessageEntry = {
    role: "assistant";
    kind: "assistant";
    message: AssistantMessage;
} | {
    role: "tool";
    kind: "tool";
    toolName: string;
    toolCallId: string;
    args: unknown;
    result?: ToolResultMessage;
    isPartial?: boolean;
} | {
    role: "tool";
    kind: "bashExecution";
    message: BashExecutionMessage;
} | {
    role: "user";
    kind: "user";
    text: string;
} | {
    role: "custom";
    kind: "custom";
    message: CustomMessage<unknown>;
} | {
    role: "summary";
    kind: "branchSummary";
    message: BranchSummaryMessage;
} | {
    role: "summary";
    kind: "compactionSummary";
    message: CompactionSummaryMessage;
} | {
    role: "system";
    kind: "system";
    text: string;
};
export interface ChatMessageRenderOptions {
    ui: Pick<TUI, "requestRender">;
    cwd: string;
    markdownTheme?: MarkdownTheme;
    hideThinkingBlock?: boolean;
    hiddenThinkingLabel?: string;
    toolOutputExpanded?: boolean;
    showImages?: boolean;
    imageWidthCells?: number;
    getToolDefinition?: (toolName: string) => ToolDefinition<any, any> | undefined;
    getCustomMessageRenderer?: (customType: string) => MessageRenderer | undefined;
}
export declare function chatEntriesFromAgentMessages(messages: readonly AgentMessage[]): ChatMessageEntry[];
export interface LiveChatEventLike {
    readonly type?: unknown;
    readonly message?: unknown;
    readonly assistantMessageEvent?: {
        readonly type?: unknown;
        readonly delta?: unknown;
    };
    readonly toolCallId?: unknown;
    readonly toolName?: unknown;
    readonly args?: unknown;
    readonly partialResult?: unknown;
    readonly result?: unknown;
    readonly isError?: unknown;
}
type LiveChatEntry = ChatMessageEntry | {
    role: string;
};
export declare class LiveChatEntriesController {
    private readonly entries;
    private streamingAssistantIndex;
    private pendingToolIndexes;
    constructor(entries: LiveChatEntry[]);
    appendMessages(messages: readonly AgentMessage[]): void;
    appendUserText(text: string): void;
    applyEvent(event: LiveChatEventLike): boolean;
    pendingToolIds(): string[];
    clearPendingTools(): void;
    private handleMessageStart;
    private handleMessageUpdate;
    private handleMessageEnd;
    private updateAssistantMessage;
    private appendAssistantTextDelta;
    private appendAssistantThinkingDelta;
    private currentStreamingAssistantMessage;
    private upsertToolEntry;
    private updateToolResult;
    private findToolEntryIndex;
    private reindexPendingTools;
    private isAssistantEntry;
    private isToolEntry;
}
export declare function renderChatMessageEntry(entry: ChatMessageEntry, options: ChatMessageRenderOptions): Component;
export {};
//# sourceMappingURL=chat-message-renderer.d.ts.map