import { type ReactNode } from "react";
import type { PartState } from "../../../store/scopes/part.js";
import type { MessagePartStatus, ToolCallMessagePartStatus } from "../../../types/message.js";
import { type GroupKey } from "../../utils/groupParts.js";
import { type EnrichedPartState } from "./MessageParts.js";
export declare namespace MessagePrimitiveGroupedParts {
    /**
     * A coalesced group of adjacent parts. Surfaced through the same
     * `{ part }` channel as a leaf {@link EnrichedPartState} so consumers
     * dispatch on a single `switch (part.type)`. `type` is the group key
     * (always `"group-…"`); `status` mirrors the last contained part.
     */
    type GroupPart<TKey extends `group-${string}` = `group-${string}`> = {
        readonly type: TKey;
        readonly status: MessagePartStatus | ToolCallMessagePartStatus;
        readonly indices: readonly number[];
    };
    type RenderInfo<TKey extends `group-${string}` = `group-${string}`> = {
        /**
         * Either a coalesced group ({@link GroupPart}, identified by a
         * `group-…` `type`) or a single enriched part. Use one switch over
         * `part.type` to handle both.
         */
        readonly part: GroupPart<TKey> | EnrichedPartState;
        /**
         * For group nodes: the recursively-rendered subtree (subgroups +
         * leaf parts). For leaf parts: a sentinel that throws when rendered
         * — accidental fall-through (`default: return children;`) errors
         * loudly instead of silently rendering nothing.
         */
        readonly children: ReactNode;
    };
    type Props<TKey extends `group-${string}` = `group-${string}`> = {
        /**
         * Maps each part to its group key path. Adjacent parts that share a
         * prefix coalesce up to that prefix. Return `null`, `undefined`, or
         * `[]` to leave a part ungrouped — it will be rendered as a leaf
         * through `children` with `part` set to its {@link EnrichedPartState}.
         *
         * Keys must start with `"group-"` so the renderer's
         * `switch (part.type)` can distinguish groups from real part types.
         *
         * For best performance, pass a stable reference (module-level
         * constant or `useCallback`).
         *
         * @example
         * ```ts
         * const groupBy = (part) =>
         *   part.type === "reasoning" ? ["group-thought", "group-reasoning"] :
         *   part.type === "tool-call" ? ["group-thought", "group-tool"] :
         *   null;
         * ```
         */
        readonly groupBy: (part: PartState, index: number, parts: readonly PartState[]) => GroupKey<TKey>;
        /**
         * Render function called once per group node and once per leaf part.
         * Switch on `part.type`: `"group-…"` cases wrap `children`; real
         * part types (`"text"`, `"tool-call"`, …) render the part directly.
         *
         * Leaf parts receive the same {@link EnrichedPartState} that
         * `<MessagePrimitive.Parts>` would produce (`toolUI`, `addResult`,
         * `resume`, `dataRendererUI`).
         */
        readonly children: (info: RenderInfo<TKey>) => ReactNode;
    };
}
/**
 * Groups adjacent message parts into a tree of coalesced runs and
 * renders each node — group or part — through a single `children`
 * function.
 *
 * The render function receives `{ part, children }` where `part.type`
 * is either a `"group-…"` literal (for a group, `children` is the
 * recursively-rendered subtree) or a real part type (`"text"`,
 * `"tool-call"`, …) for a leaf (`children` is a sentinel that throws
 * if rendered — use `part.type` to distinguish).
 *
 * @example
 * ```tsx
 * <MessagePrimitive.GroupedParts
 *   groupBy={(part) =>
 *     part.type === "reasoning" ? ["group-thought", "group-reasoning"] :
 *     part.type === "tool-call" ? ["group-thought", "group-tool"] :
 *     null
 *   }
 * >
 *   {({ part, children }) => {
 *     switch (part.type) {
 *       case "group-thought":   return <Thought>{children}</Thought>;
 *       case "group-reasoning": return <Reasoning>{children}</Reasoning>;
 *       case "group-tool":      return <ToolStack>{children}</ToolStack>;
 *       case "text":            return <MarkdownText />;
 *       case "tool-call":       return part.toolUI ?? <ToolFallback {...part} />;
 *       default:                return null;
 *     }
 *   }}
 * </MessagePrimitive.GroupedParts>
 * ```
 */
export declare const MessagePrimitiveGroupedParts: {
    <TKey extends `group-${string}`>({ groupBy, children, }: MessagePrimitiveGroupedParts.Props<TKey>): ReactNode;
    displayName: string;
};
//# sourceMappingURL=MessageGroupedParts.d.ts.map