import { ReactNode } from 'react'; /** What a single rendered row represents within a hunk. */ export type DiffLineKind = 'add' | 'remove' | 'context'; export interface DiffLine { kind: DiffLineKind; /** Line body WITHOUT the leading +/-/space marker. */ content: string; /** Line number in the original file (absent on added lines). */ oldLineNumber?: number | null; /** Line number in the new file (absent on removed lines). */ newLineNumber?: number | null; /** True for a `\ No newline at end of file` marker attached to this line. */ noNewline?: boolean; } export interface DiffHunk { /** The raw `@@ -a,b +c,d @@` header, rendered as a meta row when present. */ header?: string; lines: DiffLine[]; } export interface DiffFile { /** Path shown in the file header (the new path for renames). */ path: string; /** Previous path — when set the header renders `old → new`. */ previousPath?: string; hunks: DiffHunk[]; /** Added-line count. Derived from `hunks` when omitted. */ additions?: number; /** Removed-line count. Derived from `hunks` when omitted. */ deletions?: number; /** The producer already truncated this file's diff — shown as a notice. */ truncated?: boolean; /** Binary file: no textual diff is renderable. */ binary?: boolean; } /** How many line-number gutters to render. */ export type DiffLineNumberMode = 'dual' | 'single' | 'none'; export interface DiffViewProps { /** Structured diff. Takes precedence over `patch` when both are supplied. */ files?: DiffFile[]; /** Raw unified diff text (`diff --git` / `---` / `+++` / `@@` / +-space). */ patch?: string; /** Render the shared loading state instead of the diff. */ loading?: boolean; /** Render the shared error state instead of the diff. */ error?: string | null; /** Retry handler forwarded to the shared error state. */ onRetry?: () => void; /** * Unchanged lines kept on each side of a change before the rest of the run * collapses behind an expander. `false` disables collapsing entirely. * @default 3 */ collapseContext?: number | false; /** * Row budget before the large-diff affordance kicks in. Rows beyond it are * withheld until the viewer asks for the full diff. * @default 400 */ maxLines?: number; /** Which line-number gutters to render. @default 'dual' */ lineNumbers?: DiffLineNumberMode; /** Start with every file body collapsed to just its header. */ defaultCollapsed?: boolean; /** Hide the per-file copy button. */ hideCopy?: boolean; /** Slot rendered at the right edge of every file header (overflow menu…). */ fileActions?: (file: DiffFile) => ReactNode; /** Override the empty-diff copy. */ emptyTitle?: string; emptyDescription?: string; className?: string; } /** * Parse a unified diff into files/hunks/lines. * * Tolerant by design — agent output is frequently a bare hunk with no * `diff --git` preamble, or a fenced block that lost its headers. Anything * unrecognised before the first `@@` is treated as file metadata rather than * discarded content. */ export declare function parseUnifiedDiff(patch: string): DiffFile[]; export declare function DiffView({ files, patch, loading, error, onRetry, collapseContext, maxLines, lineNumbers, defaultCollapsed, hideCopy, fileActions, emptyTitle, emptyDescription, className, }: DiffViewProps): import('react').JSX.Element;