import type { ChatRef } from '../chat-ref.types';
import type { MessageSegment } from '../types/message.types';
import { type ScrollAnchor } from '../utils/scroll-anchor';
import type { UnifiedChatState } from '../types/unified-chat-state.types';
/** Source identifier — opaque string ID (registry lookup happens in the
 *  hub-side platform-utils, not in lib). */
export type DocSource = string;
export interface ChatSource {
    index: number;
    name: string;
    path: string;
    documentType: string;
    externalUrl?: string;
    /** Platform that owns the destination at `externalUrl`. */
    targetPlatform?: string | null;
    /** Primary-key value for single-row chips. */
    id?: string;
    /** Per-row items for grouped chips. */
    items?: Array<{
        id: string;
        documentType: string;
        name: string;
        externalUrl?: string;
        targetPlatform?: string | null;
        /** In-app doc-tree path for markdown / data-room-doc rows so the
         *  grouped chip's anchor can trigger an in-page doc-tree swap via
         *  `handleChatNavClick` (parity with single-row chips + cards). */
        path?: string | null;
    }>;
    /** RagTableConfig.id for this source. */
    sourceRepo?: string;
    /** Optional display label override returned by the chat API. */
    label?: string;
}
export interface DocChatMessage {
    id: string;
    role: 'user' | 'assistant';
    /** String form for legacy callers that just want the answer text; structured
     *  segments include thinking blocks too, which the lib's
     *  ChatMessageEnhanced renders as <ThinkingDisplay> cards. */
    content: string;
    /** Structured segments. When set, callers should prefer this over `content`. */
    segments?: MessageSegment[];
    sources?: ChatSource[];
    /** Per-row refs for inline object-card rendering. Keyed by
     *  `<documentType>:<primaryKey>`. Populated for assistant messages only. */
    chatRefs?: Record<string, ChatRef>;
    /** Per-message viewport-positioning hint emitted by the server. */
    scrollAnchor?: ScrollAnchor;
    /** When true the message is part of the conversation history but is
     *  NOT rendered in the chat UI. */
    hidden?: boolean;
}
export type { StreamingPhase } from '../types/unified-chat-state.types';
/** Per-turn metadata extracted from the streamed metadata frame. */
export interface ChatTurnMeta {
    /** Provider key recognized by `<ModelDisplay>` for icon
     *  selection: 'anthropic' | 'openai' | 'google' (case-insensitive). */
    provider: string | null;
    modelLabel: string | null;
    contextWindowMaxTokens: number | null;
    /** Input tokens (from message_start). Includes cached tokens. */
    inputTokens: number | null;
    /** Output tokens (from message_delta). Only known after stream end. */
    outputTokens: number | null;
    /** Cache hit % (read / total-input × 100). Only known after stream end. */
    cacheHitRatePct: number | null;
    /** Cross-call usage breakdown extracted from the trailing usage frame. */
    breakdown: {
        haikuRewriter?: {
            input: number;
            output: number;
        };
        haikuClassifier?: {
            input: number;
            output: number;
        };
        haikuSummarizer?: {
            input: number;
            output: number;
        };
        routedAnswer?: {
            model: string;
            complexity: string;
            thinkingBudget: number;
        };
    } | null;
    /** Per-message viewport-positioning hint. */
    scrollAnchor: ScrollAnchor | null;
    /** Routing decision from the server's `decideRoute`. */
    routedComplexity: string | null;
    routedThinkingBudget: number | null;
}
/**
 * Optional dependency-injection options for `useSseChatAdapter`.
 *
 *   - `tableIdForDocumentType` — looks up the RagTableConfig.id for an
 *     LLM document type. Used by `displayRef` + `discussRef` to translate
 *     an inline-card click into a server-side entity-id filter.
 *
 *     **Defaults to `defaultTableIdForDocumentType` from
 *     `src/utils/source-icons.ts`** — a lib-baked map covering every
 *     documentType currently registered in the hub's RAG_TABLE_CONFIGS.
 *     This makes Ask / Display work out of the box in embedders without
 *     any callback wiring.
 *
 *     Override only when you have polymorphic / per-tenant document
 *     types that map to a different tableId than the default
 *     (hub-canonical) registry — pass your own `(docType) => tableId`
 *     callback and it wins over the default.
 */
export interface UseSseChatAdapterOptions {
    tableIdForDocumentType?: (documentType: string) => string | null;
}
/**
 * Stream-driven AI chat hook. Returns the message list, send/stop/clear
 * controls, and per-turn metadata (model name, token counts, routing
 * decision) the lib's `<ChatContainer>` consumes.
 *
 * Source identity comes from `useRequiredChatRuntime().source` — no
 * parameter. Throws if `runtime.source` is empty.
 */
export declare function useSseChatAdapter(options?: UseSseChatAdapterOptions): UnifiedChatState;
//# sourceMappingURL=use-sse-chat-adapter.d.ts.map