diff options
| author | joshualitt <[email protected]> | 2025-07-31 09:31:14 -0700 |
|---|---|---|
| committer | GitHub <[email protected]> | 2025-07-31 16:31:14 +0000 |
| commit | ae86c7ba05567264ca2d115a7f96d887bc576457 (patch) | |
| tree | 6fcf94c6530790810726b066c39fe56602b5d759 /packages/core/src/utils/fileUtils.ts | |
| parent | 65be9cab478bbccd7a7f3937c11edd88dac1feb9 (diff) | |
bug(core): UI reporting for truncated read_file. (#5155)
Co-authored-by: Jacob Richman <[email protected]>
Diffstat (limited to 'packages/core/src/utils/fileUtils.ts')
| -rw-r--r-- | packages/core/src/utils/fileUtils.ts | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/packages/core/src/utils/fileUtils.ts b/packages/core/src/utils/fileUtils.ts index 6b5ce42c..c016cd4a 100644 --- a/packages/core/src/utils/fileUtils.ts +++ b/packages/core/src/utils/fileUtils.ts @@ -310,9 +310,22 @@ export async function processSingleFileContent( } llmTextContent += formattedLines.join('\n'); + // By default, return nothing to streamline the common case of a successful read_file. + let returnDisplay = ''; + if (contentRangeTruncated) { + returnDisplay = `Read lines ${ + actualStartLine + 1 + }-${endLine} of ${originalLineCount} from ${relativePathForDisplay}`; + if (linesWereTruncatedInLength) { + returnDisplay += ' (some lines were shortened)'; + } + } else if (linesWereTruncatedInLength) { + returnDisplay = `Read all ${originalLineCount} lines from ${relativePathForDisplay} (some lines were shortened)`; + } + return { llmContent: llmTextContent, - returnDisplay: isTruncated ? '(truncated)' : '', + returnDisplay, isTruncated, originalLineCount, linesShown: [actualStartLine + 1, endLine], |
