feat(core): recover truncated tool output via the Session scratchpad (#145)

Co-authored-by: Yaowei Zheng <hiyouga@buaa.edu.cn>
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Jingzhe Xu
2026-08-03 13:17:42 +08:00
committed by GitHub
parent 84949882ab
commit a798bca87f
30 changed files with 1393 additions and 47 deletions
+18
View File
@@ -80,6 +80,24 @@ describe("toWorkspaceRelative", () => {
expect(toWorkspaceRelative("C:\\Users\\me\\ws", win)).toBe(null);
});
it("Windows Workspace: forward-slash and mixed spellings of the same path also match", () => {
const win = "C:\\Users\\me\\ws";
// Core's model-visible spelling uses forward slashes on Windows; the card must still strip.
expect(toWorkspaceRelative("C:/Users/me/ws/sub/a.txt", win)).toBe("sub/a.txt");
expect(toWorkspaceRelative("C:/Users/me/ws\\sub/a.txt", win)).toBe("sub/a.txt");
// Drive letters are case-insensitive on Windows; the rest of the path is not.
expect(toWorkspaceRelative("c:/Users/me/ws/sub/a.txt", win)).toBe("sub/a.txt");
expect(toWorkspaceRelative("C:/Users/ME/ws/sub/a.txt", win)).toBe(null);
// A forward-slash Workspace value matches a backslash assistant path too.
expect(toWorkspaceRelative("C:\\Users\\me\\ws\\sub\\a.txt", "C:/Users/me/ws")).toBe(
"sub/a.txt",
);
});
it("Windows Workspace: relative backslash paths split into segments", () => {
expect(toWorkspaceRelative("dir\\name.txt", "C:\\Users\\me\\ws")).toBe("dir/name.txt");
});
it("backslashes in POSIX filenames are not globally replaced (converted only on a Windows prefix match)", () => {
expect(toWorkspaceRelative("dir\\name.txt", WS)).toBe("dir\\name.txt");
});