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:
authored and GitHub committed 2026-08-03 13:17:42 +08:00
1 parent 84949882ab
commit a798bca87f
30 files changed
+1393 -47

No files matched your search

+2 -1
View File
@@ -11,6 +11,7 @@ import { afterEach, beforeEach, describe, expect, it } from "vitest";
import { mkdtemp, readFile, readdir, rm, writeFile } from "node:fs/promises";
import { tmpdir } from "node:os";
import path from "node:path";
import { modelVisiblePath } from "../src/internal/model-visible-path.js";
import { appendAttachmentLines, imagesToScratchpadPaths } from "../src/internal/session-support.js";
import { Session } from "../src/index.js";
import type {
@@ -69,7 +70,7 @@ describe("imagesToScratchpadPaths", () => {
const files = await readdir(dir);
expect(files).toHaveLength(2);
for (const f of paths) {
expect(path.dirname(f)).toBe(dir);
expect(path.dirname(f)).toBe(modelVisiblePath(dir));
expect(path.basename(f)).toMatch(/^upload-[0-9a-f]{8}\.png$/);
expect(await readFile(f)).toEqual(PNG_1X1);
}