refactor: minor code formatting improvements and add artifacts tool

- Clean up whitespace and formatting in browserContextFactory.ts
- Improve code style in files.ts and screenshot.ts
- Add new artifacts.ts tool for artifact path management
- Enhance screenshot validation with dimension safety checks

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Ryan Malloy 2025-09-09 04:19:30 -06:00
parent 671b0a3668
commit efe1627c3f
4 changed files with 130 additions and 11 deletions

View file

@ -160,21 +160,21 @@ const screenshot = defineTabTool({
}
response.addResult(resultMessage);
// Only add image to response if dimensions are safe or explicitly allowed
let addImageToResponse = true;
if (!params.allowLargeImages) {
try {
const { width, height } = getImageDimensions(buffer);
const maxDimension = 8000;
if (width > maxDimension || height > maxDimension) {
if (width > maxDimension || height > maxDimension)
addImageToResponse = false;
}
} catch (dimensionError) {
// If we can't parse dimensions, continue and add the image
}
}
if (addImageToResponse) {
response.addImage({
contentType: fileType === 'png' ? 'image/png' : 'image/jpeg',