"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.screenshotTool = void 0;
const ai_1 = require("ai");
const zod_1 = require("zod");
const screenshotTool = (v3) => (0, ai_1.tool)({
    description: "Takes a screenshot (PNG) of the current page. Use this to quickly verify page state.",
    inputSchema: zod_1.z.object({}),
    execute: async () => {
        v3.logger({
            category: "agent",
            message: `Agent calling tool: screenshot`,
            level: 1,
        });
        const page = await v3.context.awaitActivePage();
        const buffer = await page.screenshot({ fullPage: false });
        const pageUrl = page.url();
        return {
            base64: buffer.toString("base64"),
            timestamp: Date.now(),
            pageUrl,
        };
    },
    toModelOutput: (result) => ({
        type: "content",
        value: [{ type: "media", mediaType: "image/png", data: result.base64 }],
    }),
});
exports.screenshotTool = screenshotTool;
//# sourceMappingURL=screenshot.js.map