import {
  BROWSER_TOOL_DESCRIPTION
} from "./chunk-2HMEZZKK.js";
import {
  executeBrowserTask
} from "./chunk-RDMI5MI7.js";
import {
  __export
} from "./chunk-PZ5AY32C.js";

// tools/browser/vercel.ts
var vercel_exports = {};
__export(vercel_exports, {
  browserTool: () => browserTool,
  createBrowserTool: () => createBrowserTool
});
import { tool as createTool } from "ai";
import { z } from "zod";
function createBrowserTool(config) {
  const schema = z.object({
    task: z.string().describe('Natural language description of what to do (e.g., "Test checkout flow for buying a pineapple")'),
    url: z.string().optional().describe("Starting URL (e.g., https://3000-xyz.e2b.dev)"),
    maxSteps: z.number().min(1).max(50).default(10).describe("Maximum number of browser actions to take"),
    region: z.enum(["sfo", "lon"]).default("sfo").describe("Browserless region: sfo (US West) or lon (Europe)")
  });
  return createTool({
    description: BROWSER_TOOL_DESCRIPTION,
    inputSchema: schema,
    execute: async (params) => {
      const { task, url, maxSteps, region } = params;
      const result = await executeBrowserTask(
        { task, url, maxSteps, region },
        config
      );
      if (result.success) {
        return {
          success: true,
          result: result.result,
          stepsTaken: result.stepsTaken,
          executionTimeMs: result.executionTimeMs
        };
      }
      return {
        success: false,
        error: result.error
      };
    }
  });
}
var browserTool = createBrowserTool();

export {
  createBrowserTool,
  browserTool,
  vercel_exports
};
//# sourceMappingURL=chunk-W3SYYZ3X.js.map