fix(acp): clean read tool display content (#30569)

This commit is contained in:
Shoubhit Dash
2026-06-03 19:36:27 +05:30
committed by GitHub
parent e707e416ed
commit 8851e4de2b
5 changed files with 179 additions and 7 deletions

View File

@@ -428,6 +428,15 @@ describe("tool.read truncation", () => {
const result = yield* run({ filePath: path.join(test.directory, "small.txt") })
expect(result.metadata.truncated).toBe(false)
expect(result.output).toContain("End of file")
expect(result.metadata.display).toMatchObject({
type: "file",
path: path.join(test.directory, "small.txt"),
text: "hello world",
lineStart: 1,
lineEnd: 1,
totalLines: 1,
truncated: false,
})
}),
)
@@ -495,6 +504,14 @@ describe("tool.read truncation", () => {
const result = yield* exec(dir, { filePath: path.join(dir, "dir"), offset: 6, limit: 5 })
expect(result.metadata.truncated).toBe(false)
expect(result.output).not.toContain("Showing 5 of 10 entries")
expect(result.metadata.display).toMatchObject({
type: "directory",
path: path.join(dir, "dir"),
entries: ["file-5.txt", "file-6.txt", "file-7.txt", "file-8.txt", "file-9.txt"],
offset: 6,
totalEntries: 10,
truncated: false,
})
}),
)