Fix screenshot: formato immagine corretto {type:image, data: base64, mimeType} (il framework usa block.data, non source.data)

This commit is contained in:
Matteo Benedetto
2026-08-13 15:59:22 +02:00
parent 3a3d55a411
commit 91aba6b660
+3 -1
View File
@@ -26,6 +26,7 @@
import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
import { Type } from "typebox";
import { spawn, execFile } from "node:child_process";
import { readFileSync } from "node:fs";
import { promisify } from "node:util";
const execFileAsync = promisify(execFile);
@@ -367,10 +368,11 @@ export default function (pi: ExtensionAPI) {
),
"screenshot",
);
const pngB64 = readFileSync(r.path).toString("base64");
return {
content: [
{ type: "text", text: `Screenshot salvato in ${r.path} (${r.bytes} bytes)` },
{ type: "image", image: r.path, mediaType: "image/png" },
{ type: "image", data: pngB64, mimeType: "image/png" },
],
details: r,
};