/**
 * Hierarchical adjacent-coalescing grouping for message parts.
 *
 * Given a group path per part (from `groupBy`), builds a tree of group
 * nodes wrapping individual parts. Adjacent parts sharing a path prefix
 * coalesce into the same group; ungrouped parts are direct children of
 * the root.
 *
 * Each node gets a structural `nodeKey` built from sibling indices
 * (`"0.1.0"`), stable under append-only streaming.
 */
/**
 * Public group key type. Group keys must be prefixed with `group-` so
 * that a unified `switch (part.type)` in the renderer can distinguish
 * a group key (e.g. `"group-thought"`) from a real part type
 * (`"text"`, `"tool-call"`).
 */
export type GroupKey<TKey extends `group-${string}` = `group-${string}`> = TKey | readonly TKey[] | null | undefined;
export type GroupNode = GroupNodeGroup | GroupNodePart;
export interface GroupNodeGroup {
    readonly type: "group";
    /** Current-level group key (last segment of the path). */
    readonly key: string;
    /** Structural React key: sibling-index path, e.g. `"0.1.0"`. */
    readonly nodeKey: string;
    /** Indices of parts in this subtree, in order. */
    readonly indices: readonly number[];
    readonly children: readonly GroupNode[];
}
export interface GroupNodePart {
    readonly type: "part";
    /** Index of the part in the message. */
    readonly index: number;
    /** Structural React key: sibling-index path within parent. */
    readonly nodeKey: string;
}
/**
 * Normalize a `groupBy` return value to a path array.
 * `null`/`undefined`/`[]` → `[]` (ungrouped).
 * `"foo"` → `["foo"]`. Arrays pass through.
 */
export declare const normalizeGroupKey: (key: GroupKey) => readonly string[];
/**
 * Build the group tree from an array of normalized group paths.
 * `paths[i]` is the path for part `i`. The output tree contains one
 * `part` node per part and one `group` node per coalesced run.
 */
export declare const buildGroupTree: (paths: readonly (readonly string[])[]) => readonly GroupNode[];
//# sourceMappingURL=groupParts.d.ts.map