/** * Line diffs for the file a tool just changed. * * The agent saying `write_file ยท src/policy.ts` tells you a file moved but not what moved in it. * A diff is the difference between trusting a change and seeing it, and seeing it is what makes * an unwanted edit obvious while it is still one `/revert` away. * * Nothing here reads the disk. It takes the two versions and returns the shape of the change, * which keeps it pure and makes every case โ€” creation, deletion, truncation, binary โ€” testable * without a filesystem. */ export type DiffLineKind = 'add' | 'del' | 'ctx'; export interface DiffLine { kind: DiffLineKind; text: string; /** 1-based line number in the old file; absent on added lines. */ before?: number; /** 1-based line number in the new file; absent on removed lines. */ after?: number; } export interface DiffHunk { lines: DiffLine[]; } export interface FileDiff { path: string; added: number; removed: number; hunks: DiffHunk[]; /** The file did not exist before. */ created: boolean; /** The file no longer exists. */ deleted: boolean; /** Contents are not text, so no line diff is meaningful. */ binary: boolean; /** Hunks were dropped to keep the render bounded; this is how many lines went unshown. */ hiddenLines: number; /** Nothing changed. */ unchanged: boolean; } /** A NUL byte is the conventional and reliable marker that content is not text. */ export declare function looksBinary(s: string): boolean; /** * The diff for one file. `null` means the file did not exist on that side, which is how * creation and deletion are expressed rather than as separate flags the caller must set. */ export declare function fileDiff(filePath: string, before: string | null, after: string | null, opts?: { context?: number; maxLines?: number; }): FileDiff; /** "+12 โˆ’3", the one-line shape of a change, for a header beside the file name. */ export declare function diffSummary(d: FileDiff): string; //# sourceMappingURL=diff-view.d.ts.map