import type { ChatMessage } from '@genesislcap/foundation-ai';
/**
 * A chat message lifted into the debug-log timeline as a `kind: 'message'` entry.
 *
 * @beta
 */
export type TimelineMessage = ChatMessage & {
    kind: 'message';
    /**
     * Set only on entries hoisted out of a `subAgentTrace`: the sub-agent's own
     * (un-breadcrumbed) `agentName`, kept for filtering since the displayed
     * `agentName` is rewritten to a `"<parent> › <sub-agent>"` breadcrumb.
     */
    subAgentName?: string;
    /** Delegation depth — absent/0 for top-level, 1 for a sub-agent, 2 for a sub-agent's sub-agent, … */
    subAgentDepth?: number;
    /** Id of the parent tool call that spawned this run — correlates a hoisted message back to its delegation. */
    subAgentOf?: string;
};
/**
 * Flatten sub-agent conversations into a single top-level message stream for the
 * debug-log timeline.
 *
 * A tool call that delegates to a sub-agent carries the sub-agent's entire
 * conversation on `toolCall.subAgentTrace`. The live UI reads that nested shape,
 * but a top-to-bottom timeline reads far better with those messages inline next to
 * the turn that produced them. This walks the list and, for every tool call with a
 * `subAgentTrace`, hoists the sub-agent's messages up as their own timeline
 * entries while **removing** the nested copy from the emitted parent tool call — a
 * move, not a copy. The data is relocated, never duplicated: the export stays the
 * same size and a naive `sum(timeline[].cost)` does not double-count (the
 * canonical `sumCosts` total still reads the un-flattened history).
 *
 * Hoisted entries are:
 * - **breadcrumbed**: `agentName` becomes `"<parent> › <sub-agent>"`, composing for
 *   nested sub-agents (`"<parent> › <sub> › <subsub>"`); the raw sub-agent name is
 *   preserved on `subAgentName`.
 * - **depth-tagged** (`subAgentDepth`) and **correlated** to the spawning tool call
 *   (`subAgentOf`), so the delegation tree is reconstructable even when two
 *   sub-agents run within the same parent turn.
 *
 * Top-level messages (depth 0) are emitted unchanged apart from the trace strip.
 * Order is preserved within each list; the caller sorts the whole timeline by
 * timestamp afterwards, and every sub-agent message carries its own timestamp, so
 * hoisted entries interleave chronologically between the parent's tool-call and
 * tool-result messages.
 *
 * @internal
 */
export declare function flattenSubAgentMessages(messages: readonly ChatMessage[], prefix?: string, depth?: number, subAgentOf?: string): TimelineMessage[];
//# sourceMappingURL=flatten-sub-agent-messages.d.ts.map