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

// tools/browser/anthropic.ts
var anthropic_exports = {};
__export(anthropic_exports, {
  browserTool: () => browserTool,
  createBrowserTool: () => createBrowserTool
});
var browserTool = {
  name: "browser_task",
  description: BROWSER_TOOL_DESCRIPTION,
  input_schema: {
    type: "object",
    properties: {
      task: {
        type: "string",
        description: 'Natural language description of what to do (e.g., "Test checkout flow for buying a pineapple")'
      },
      url: {
        type: "string",
        description: "Starting URL (e.g., https://3000-xyz.e2b.dev). Required if navigating to a specific page."
      },
      maxSteps: {
        type: "number",
        description: "Maximum number of browser actions to take (1-50). Default: 10. Use 15-30 for complex flows.",
        default: 10
      },
      region: {
        type: "string",
        enum: ["sfo", "lon"],
        description: "Browserless region: sfo (US West Coast) or lon (Europe). Default: sfo.",
        default: "sfo"
      }
    },
    required: ["task"]
  }
};
function formatResult(result) {
  if (result.success) {
    const parts = [
      "\u2705 Browser task completed successfully",
      `Steps taken: ${result.stepsTaken ?? 0}`,
      result.executionTimeMs ? `Execution time: ${result.executionTimeMs}ms` : null,
      "",
      "Result:",
      result.result || "Task completed"
    ];
    return parts.filter(Boolean).join("\n");
  }
  return `\u274C Browser task failed: ${result.error || "Unknown error"}`;
}
function createBrowserTool(config) {
  return Object.assign({}, browserTool, {
    execute: async (input) => {
      return executeBrowserTask(input, config);
    },
    formatResult: (result) => {
      return formatResult(result);
    },
    getSystemPrompt: () => {
      return BROWSER_SYSTEM_PROMPT;
    }
  });
}

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