/**
 * GetChatTurnGroupsUseCase
 *
 * Server-side derivation of "user turn groups" for the chat thread.
 *
 * The raw interactive_messages table is a flat, append-only log of
 * user/assistant pairs. The chat UI wants to collapse every COMPLETED
 * user turn into a single named card ("Working on: …") so the thread
 * doesn't become an endless scroll of raw bubbles — but the MOST
 * RECENT turn must stay live so the user keeps seeing the reply that
 * is actively streaming in response to what they just typed.
 *
 * Grouping rules:
 *   1. Ignore messages that carry a `stepId` — those are setup-workflow
 *      messages and live inside the StepTracker, not the flat thread.
 *   2. Walk the remaining messages in chronological order. Every user
 *      message opens a new turn; every subsequent assistant message is
 *      attached to the open turn until the next user message.
 *   3. The LAST turn is never grouped (it is the live turn).
 *   4. `hiddenMessageIds` lists every message id that a client should
 *      FILTER OUT of the flat thread render — the client then draws
 *      a collapsible group card in its place.
 *
 * This use case is read-only. It speaks exclusively to the
 * IInteractiveMessageRepository port, so presentation layers can ask
 * for groups without any coupling to the underlying SQLite schema.
 *
 * Feature: application-chat turn grouping (see spec in CLAUDE memo).
 */
import type { IInteractiveMessageRepository } from '../../ports/output/repositories/interactive-message-repository.interface.js';
/** One user-turn group, ready for the client to render as a card. */
export interface ChatTurnGroup {
    /** Stable id derived from the first (user) message id in the turn. */
    id: string;
    /** User-facing title, e.g. "Working on: Fix login bug". */
    title: string;
    /** Trimmed preview of the user message text, capped to PREVIEW_MAX. */
    userMessagePreview: string;
    /** Message ids that belong to this turn, in order. */
    messageIds: string[];
    /** Number of assistant replies collected inside the turn. */
    assistantMessageCount: number;
    /** When the user message was written (epoch ms). */
    startedAt: number;
    /** When the last message in the turn was written (epoch ms). */
    endedAt: number;
    /**
     * `completed` for everything the client should collapse by default.
     * `in-progress` is reserved for `currentTurn` — the most recent
     * user turn, which the client renders as an expanded "Working on
     * your request…" card with the live streaming indicator inside it.
     */
    status: 'completed' | 'in-progress';
}
export interface GetChatTurnGroupsInput {
    featureId: string;
}
export interface GetChatTurnGroupsResult {
    /** Completed turn groups in chronological order. */
    groups: ChatTurnGroup[];
    /**
     * The most recent user-initiated turn, always `status: 'in-progress'`
     * when present. The client renders this as an expanded card with
     * the streaming indicator pinned inside it, so a new "Working on
     * your request…" surface appears the instant the user sends a
     * message — no flat "Thinking…" bubble in the thread. Null when
     * the feature has no user-initiated turns yet (e.g. only setup
     * messages exist).
     */
    currentTurn: ChatTurnGroup | null;
    /**
     * Every message id that belongs to a returned group — completed
     * groups AND the current turn. The UI filters these out of the raw
     * thread so nothing renders twice.
     */
    hiddenMessageIds: string[];
}
export declare class GetChatTurnGroupsUseCase {
    private readonly messages;
    constructor(messages: IInteractiveMessageRepository);
    execute(input: GetChatTurnGroupsInput): Promise<GetChatTurnGroupsResult>;
}
//# sourceMappingURL=get-chat-turn-groups.use-case.d.ts.map