import type { InteractiveMessage, WorkflowStep } from '../../../../../../packages/core/src/domain/generated/output.js';
/** Shape matching UserInteractionData from the agent executor interface. */
export interface InteractionData {
    toolCallId: string;
    questions: {
        question: string;
        header: string;
        options: {
            label: string;
            description: string;
            preview?: string;
        }[];
        multiSelect: boolean;
    }[];
}
/** Chat state returned by the backend — matches ChatState from service interface */
interface ChatState {
    messages: InteractiveMessage[];
    sessionStatus: string | null;
    streamingText: string | null;
    sessionInfo: SessionInfo | null;
    turnStatus?: string;
    pendingInteraction?: InteractionData | null;
    workflow?: WorkflowView | null;
}
/** Workflow view shape — mirrors the core port. */
export interface WorkflowView {
    workflowId: string;
    steps: WorkflowStep[];
    currentStepId: string | null;
}
/** Step view consumed by `StepTracker`. */
export interface EnhancedStepState {
    definition: {
        id: string;
        stepKey: string;
        title: string;
        description: string;
    };
    status: 'pending' | 'running' | 'done' | 'failed' | 'interrupted';
    metadata: Record<string, unknown> | null;
    toolMessages: InteractiveMessage[];
    /** Milliseconds since epoch when the step flipped to `running`. */
    startedAt: number | null;
    /** Milliseconds since epoch when the step reached a terminal state. */
    finishedAt: number | null;
}
/** Enhanced progress consumed by `StepTracker` + `ChatTab`. */
export interface EnhancedStepProgress {
    hasPlan: boolean;
    steps: EnhancedStepState[];
    activeStepId: string | null;
    allDone: boolean;
    /**
     * Short live-status string ("Thinking…", "Reading file X", a chunk
     * of the agent's streaming reply) that the running step card shows
     * inline next to its spinner. NEVER rendered as a flat bubble — the
     * step tracker is the only allowed surface for in-progress activity
     * while a workflow is active.
     */
    liveStatus: string | null;
}
interface SessionInfo {
    pid: number | null;
    sessionId: string | null;
    model: string | null;
    startedAt: string;
    lastActivityAt: string;
    totalCostUsd: number | null;
    totalInputTokens: number | null;
    totalOutputTokens: number | null;
}
export interface ChatStatus {
    /** Whether the agent is actively working (booting, thinking, streaming). */
    isRunning: boolean;
    /** Human-readable status text (e.g. "Agent is waking up...", "Using tool: Read"). */
    statusText: string | null;
}
export interface ChatRuntimeOptions {
    /** Transform message content before sending (e.g. append attachment refs). */
    contentTransform?: (content: string) => string;
    /** Called after a message is successfully sent (e.g. clear attachments). */
    onMessageSent?: () => void;
    /** Override model for new sessions (e.g. 'claude-sonnet-4-6'). */
    model?: string;
    /** Override agent type for new sessions (e.g. 'claude-code'). */
    agentType?: string;
    /** When true, inject debug bubbles showing SSE events, session info, etc. */
    debugMode?: boolean;
    /**
     * Optional SSR-loaded chat state used as the TanStack Query `initialData`.
     * When provided the hook renders immediately with those messages and the
     * background refetch only confirms / updates them.
     */
    initialChatState?: ChatState;
    /**
     * When true, the host page intends to render the first stepless user
     * message ABOVE the step tracker via its own pinned bubble — so the
     * hook must (a) always surface that message as `initialRequestMessage`
     * and (b) filter it out of the flat thread, even when no workflow plan
     * has landed yet (placeholder-only state). Without this flag the bubble
     * would appear BELOW the tracker during the window between app creation
     * and the first workflow-step row, because the filter previously only
     * kicked in once `hasPlan` became true.
     */
    pinInitialRequest?: boolean;
    /**
     * Message ids to filter out of the flat thread. These belong to
     * server-derived "turn groups" that the host page renders as
     * collapsible cards above the thread — the raw bubbles must not
     * also appear in the flat message list, or the user would see the
     * same content twice (once inside the card, once flat below).
     * See `GetChatTurnGroupsUseCase` for the server-side derivation.
     */
    hiddenMessageIds?: readonly string[];
    /**
     * When true, the hook stops injecting its synthetic `streaming`
     * message (the one that carries the live delta + "Thinking…" /
     * "Agent is waking up…" placeholders) into `threadMessages`. The
     * same streaming data is exposed separately on the return value
     * (`streamingState`) so the host can render it wherever it wants —
     * typically inside an in-progress turn card owned by the server.
     */
    suppressStreamingIndicator?: boolean;
    /**
     * When true, `threadMessages` is returned as an empty list — the
     * flat thread renders no persisted bubbles at all. The host is
     * expected to render the full conversation via its own grouping
     * layer (e.g. `CurrentTurnCard` + `CompletedTurnGroupsList`) using
     * `rawMessages`. Stable contract used by the web UI when turn-group
     * rendering is on: the flat thread is dead, the overlay is the
     * only visible surface.
     */
    hideAllMessages?: boolean;
}
/** A debug event captured from SSE for display in debug mode. */
export interface DebugEvent {
    id: string;
    timestamp: Date;
    label: string;
    detail?: string;
}
/**
 * `featureId` is a polymorphic scope key: a feature UUID, "repo-<id>", or "global".
 * All API calls and SSE subscriptions are scoped to this key.
 */
export declare function useChatRuntime(featureId: string, worktreePath?: string, options?: ChatRuntimeOptions): {
    runtime: import("@assistant-ui/react").AssistantRuntime;
    status: ChatStatus;
    clearChat: () => Promise<void>;
    stopAgent: () => Promise<void>;
    sessionInfo: SessionInfo | null;
    isChatLoading: boolean;
    pendingInteraction: InteractionData | null;
    respondToInteraction: (answers: Record<string, string>) => Promise<void>;
    stepProgress: EnhancedStepProgress;
    initialRequestMessage: InteractiveMessage | null;
    /** Raw persisted messages — exposed so the host can hydrate
     *  collapsed server-derived turn-group cards by id lookup. */
    rawMessages: InteractiveMessage[];
    /**
     * Live streaming state for external renderers (in-progress turn
     * card). Always populated whether or not the synthetic streaming
     * thread message is injected — `suppressStreamingIndicator`
     * only controls the flat-thread injection, not the data exposure.
     */
    streamingState: {
        text: string;
        statusLog: string | null;
        awaiting: boolean;
        sessionStatus: string | null;
    };
};
export {};
//# sourceMappingURL=useChatRuntime.d.ts.map