/** * @fileoverview File viewer rendering utilities (Task #2952). * * The right-hand tool-call detail panel on the task page renders * differently depending on the tool name: * * - **write_file / write / create_file** → render the FULL content * of the file as the user just wrote it (line-numbered, no * truncation). Previously the panel mounted a Monaco placeholder * that fetched the file from disk via /api/file-content — which * could be truncated for large files and never reflected the * content the tool call actually wrote. * * - **edit_file / edit / edit_file_v2 / multi_edit_file / multi_edit * / apply_patch** → render a git-style diff between * `old_string` and `new_string` (LCS-based +/- lines). For these * tools we want to highlight what changed, not show the entire * resulting file again. * * Both renderers produce XSS-safe HTML — every user-controlled string * passes through {@link escapeHtml} before being injected. */ export type DiffOpType = "context" | "add" | "remove"; export interface DiffOp { type: DiffOpType; line: string; /** 1-indexed line number for display in the gutter. */ lineNum: number; } /** * Render a write_file tool call's full content as line-numbered HTML. * * Returns a `
` with every line (no truncation)
*
* The renderer escapes HTML; long lines are preserved verbatim.
*/
export declare function renderWriteFileFull(opts: {
path: string;
content: string;
}): string;
/**
* Render an edit_file tool call as a git-style unified diff.
*
* Returns a `` containing:
* - a header with the file path + line counts
* - a `` with LCS-derived +/- / context lines
* (legacy contract — pre-v2.5.12 callers look for `class="diff-body"`
* and `diff-line-(added|removed|context)` markers).
*
* If `old_string` and `new_string` are identical the result is just
* the context lines (no +/- markers).
*
* The wrapper also carries `data-diff=""` so the client
* hydrator can rebuild the diff on click without re-parsing the DOM.
*/
export declare function renderEditFileDiff(opts: {
path: string;
old_string: string;
new_string: string;
}): string;
/**
* Compute a line-level diff using LCS (Longest Common Subsequence).
*
* Algorithm: classic O(N*M) DP table, then a single backtrack to
* emit the ops in order. For inputs up to a few thousand lines this
* is well within budget; for pathological inputs we accept the cost
* (Task #2952 callers are user-authored file edits, not bulk
* transforms).
*
* Output: ordered array of `{type, line, lineNum}` matching how an
* editor would display them.
*/
export declare function computeLineDiff(oldLines: string[], newLines: string[]): DiffOp[];
//# sourceMappingURL=file-viewer-utils.d.ts.map