Skip to content

Commit 041a19e

Browse files
committed
refactor(canvas): return pathless snapshot details
1 parent eeb0fa3 commit 041a19e

1 file changed

Lines changed: 3 additions & 5 deletions

File tree

‎extensions/canvas/src/tool.ts‎

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -277,18 +277,16 @@ export function createCanvasTool(options?: CanvasToolOptions): AnyAgentTool {
277277
"canvas",
278278
CANVAS_SNAPSHOT_MAX_BYTES,
279279
);
280+
const details = { node, format: payload.format, media: { outbound: false } };
280281
try {
281282
const result = await imageResultFromFile({
282283
label: "canvas:snapshot",
283284
path: saved.path,
284285
// Rendered pages are model observations, never automatic outbound attachments.
285-
details: { node, format: payload.format, media: { outbound: false } },
286+
details,
286287
imageSanitization,
287288
});
288-
const details = result.details as { path?: string; media: { mediaUrl?: string } };
289-
delete details.path;
290-
delete details.media.mediaUrl;
291-
return result;
289+
return { ...result, details };
292290
} finally {
293291
// The model-visible image is hydrated above; the staging path is not returned.
294292
await removeCanvasSnapshotFile(saved.path);

0 commit comments

Comments
 (0)