acp: forward attachments into ACP runtime sessions (#41427)

Merged via squash.

Prepared head SHA: f2ac51df2c
Co-authored-by: mbelinky <132747814+mbelinky@users.noreply.github.com>
Co-authored-by: mbelinky <132747814+mbelinky@users.noreply.github.com>
Reviewed-by: @mbelinky
This commit is contained in:
Mariano
2026-03-09 22:32:32 +01:00
committed by GitHub
parent 8e3f3bc3cf
commit 4aebff78bc
7 changed files with 100 additions and 2 deletions

View File

@@ -310,7 +310,20 @@ export class AcpxRuntime implements AcpRuntime {
// Ignore EPIPE when the child exits before stdin flush completes.
});
child.stdin.end(input.text);
if (input.attachments && input.attachments.length > 0) {
const blocks: unknown[] = [];
if (input.text) {
blocks.push({ type: "text", text: input.text });
}
for (const attachment of input.attachments) {
if (attachment.mediaType.startsWith("image/")) {
blocks.push({ type: "image", mimeType: attachment.mediaType, data: attachment.data });
}
}
child.stdin.end(blocks.length > 0 ? JSON.stringify(blocks) : input.text);
} else {
child.stdin.end(input.text);
}
let stderr = "";
child.stderr.on("data", (chunk) => {