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
@@ -16,7 +16,11 @@
import fs from "node:fs/promises";
import path from "node:path";
import { randomBytes } from "node:crypto";
import { appendAttachmentLines, attachedFileLine } from "@prismshadow/penguin-core";
import {
appendAttachmentLines,
attachedFileLine,
modelVisiblePath,
} from "@prismshadow/penguin-core";
import type { OmniMessage } from "@prismshadow/penguin-core";
import { HttpError } from "../http/errors.js";
import { badRequest } from "../http/validate.js";
@@ -293,5 +297,11 @@ export async function attachFilesToInput(
await removeAttachments(written);
throw err;
}
return { input: appendAttachmentLines(messages, written.map(attachedFileLine)), written };
return {
input: appendAttachmentLines(
messages,
written.map((filePath) => attachedFileLine(modelVisiblePath(filePath))),
),
written,
};
}