/** * Parse and present tool.batch output as nested sub-tool sections * (classic TUI parity). * * Batch runners emit labeled sections (streamed as each child finishes, and * again as the final body): * ── #1 dns.lookup [ok exit=0] * … * ── #2 web.fetch [fail exit=1] * … * * Live progress also includes `[batch] …` ticks. While the parent is still * running we merge settled sections with running placeholders so nested cards * appear expanded from the first start — same shape as single tool cards. */ export type BatchSectionStatus = "ok" | "fail" | "cancelled" | "running"; export interface BatchSection { readonly index: number; readonly name: string; /** True only when status is ok (back-compat for callers). */ readonly ok: boolean; readonly status: BatchSectionStatus; readonly exitCode: number | undefined; readonly body: string; } /** * Split a completed tool.batch output into per-sub-tool sections. * Returns [] when the body is not in the labeled batch format. * If the same index appears twice (live re-stream), the last header wins. */ export declare function parseBatchSections(output: string): BatchSection[]; export interface BatchSectionPresentation { readonly glyph: string; readonly statusLabel: string; readonly name: string; readonly lines: readonly string[]; readonly hiddenAboveCount: number; readonly hasBody: boolean; } /** Present one nested sub-tool for the card (collapsed head/tail or full). */ export declare function presentBatchSection(section: BatchSection, expanded: boolean): BatchSectionPresentation; /** Human summary line under the parent batch header. */ export declare function batchSummaryLine(sections: readonly BatchSection[]): string; /** True when this tool item should use nested batch UI. */ export declare function isBatchToolName(name: string): boolean; export interface BatchLiveLine { readonly text: string; readonly tone: "info" | "ok" | "fail" | "running"; } /** * Parse live `[batch] …` progress ticks (kept for tests / summary). * Prefer {@link buildBatchCardsFromSpool} for the live nested-card UI. */ export declare function parseBatchLiveProgress(raw: string): { readonly lines: readonly BatchLiveLine[]; readonly summary: string; }; /** * Merge streamed `── #N` sections with `[batch]` start/running ticks into an * ordered list of nested cards for live (and final) batch UI. */ export declare function buildBatchCardsFromSpool(raw: string): BatchSection[]; /** * Rebuild a single section as a labeled block for the pager (matches * runner formatting so the full-batch view stays familiar). */ export declare function formatBatchSectionForPager(section: BatchSection): string; /** Full batch body for the parent pager — prefer original spool order. */ export declare function formatBatchForPager(sections: readonly BatchSection[], raw: string): string; /** Preview helper used by tests — clean lines without expand sampling. */ export declare function cleanBatchBodyLines(body: string): string[];