fix: ensure images read by agent dont count against quota (#22168)

This commit is contained in:
Aiden Cline
2026-04-12 12:02:39 -05:00
committed by GitHub
parent 3729fd5706
commit 8b9b9ad31e
2 changed files with 22 additions and 4 deletions

View File

@@ -25,6 +25,8 @@ interface FetchDecompressionError extends Error {
}
export namespace MessageV2 {
export const SYNTHETIC_ATTACHMENT_PROMPT = "Attached image(s) from tool result:"
export function isMedia(mime: string) {
return mime.startsWith("image/") || mime === "application/pdf"
}
@@ -808,7 +810,7 @@ export namespace MessageV2 {
parts: [
{
type: "text" as const,
text: "Attached image(s) from tool result:",
text: SYNTHETIC_ATTACHMENT_PROMPT,
},
...media.map((attachment) => ({
type: "file" as const,