chore: generalize status & action as code (#188)

This commit is contained in:
Pavel Feldman 2025-04-15 12:54:45 -07:00 committed by GitHub
parent 4a19e18999
commit 795a9d578a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
12 changed files with 187 additions and 88 deletions

View file

@ -78,13 +78,16 @@ const resize: ToolFactory = captureSnapshot => ({
const validatedParams = resizeSchema.parse(params);
const tab = context.currentTab();
return await tab.run(
tab => tab.page.setViewportSize({ width: validatedParams.width, height: validatedParams.height }),
{
status: `Resized browser window`,
captureSnapshot,
}
);
return await tab.run(async tab => {
await tab.page.setViewportSize({ width: validatedParams.width, height: validatedParams.height });
const code = [
`// Resize browser window to ${validatedParams.width}x${validatedParams.height}`,
`await page.setViewportSize({ width: ${validatedParams.width}, height: ${validatedParams.height} });`
];
return { code };
}, {
captureSnapshot,
});
},
});