/** * tool-group — Consecutive same-tool entries grouped under a single header. * * Instead of rendering N separate tool cards for N consecutive `read` (or * `bash`, `grep`, …) calls, this module collapses them into one visual group: * * ╭─ ◆ read ×5 · 0.5s * │ [1] path/to/a.ts … * │ [2] path/to/b.tsx … * │ … * ╰────────────────────────────────────────── * * The group header carries a count badge and aggregated stats; each sub-entry * keeps its own arg preview, output, diff, and timing. Non-tool entries and * isolated tool entries pass through unchanged. */ import type React from 'react'; import type { HistoryEntry } from './types.js'; export interface ToolGroupData { /** Shared tool name (e.g. "read", "bash", "grep"). */ name: string; /** Consecutive tool entries with the same name. */ entries: HistoryEntry[]; /** Aggregate duration across the group. */ totalDurationMs: number; /** Count of successful calls. */ okCount: number; /** Count of failed calls. */ failCount: number; } export type RenderGroup = { type: 'single'; entry: HistoryEntry; } | { type: 'tool-group'; data: ToolGroupData; }; /** * Hard ceiling for one rendered tool group. A group is a virtualization unit, * so allowing an arbitrarily long same-tool run (for example 400 consecutive * reads) would mount the whole run on every streaming redraw and defeat the * bounded history window. */ export declare const MAX_TOOL_GROUP_ENTRIES = 12; /** Stable id used by the height cache and React keys for a render group. */ export declare function renderGroupId(group: RenderGroup): number; /** Conservative, bounded row estimate used before a group is measured. */ export declare function estimateRenderGroupRows(group: RenderGroup, contentWidth: number, showSageMemoryInject?: boolean): number; /** * Walk entries and merge consecutive same-tool entries into bounded groups. * Non-tool entries and isolated tool entries (no consecutive sibling) * remain as individual items. */ export declare function groupEntries(entries: readonly HistoryEntry[]): RenderGroup[]; /** * Render a group of consecutive same-tool entries. * * Layout: * ╭─ ◆ read ×5 · 0.5s * │ [1] path/to/a.ts · 12ms * │ (output preview…) * │ [2] path/to/b.tsx · 8ms * │ (output preview…) * ╰────────────────────────────────────── * * Each sub-entry is rendered as a compact list item with its index, * arg summary, timing, and a single-line output preview. */ declare function ToolGroupImpl({ data, termWidth, }: { data: ToolGroupData; termWidth: number; }): React.ReactElement; /** * One render group of compacted tool calls. * * Memoized: `data` comes from the `useMemo`d `groupEntries` result in * ScrollableHistory and `termWidth` is memoized beside it, so every group * except the one actually changing bails out of each streaming frame. */ export declare const ToolGroup: React.MemoExoticComponent; export {}; //# sourceMappingURL=tool-group.d.ts.map