import {
  GITHUB_READ_FILE_DESCRIPTION,
  GITHUB_READ_FILE_INPUT_SCHEMA,
  GITHUB_READ_FILE_TOOL_NAME,
  GITHUB_SEARCH_DESCRIPTION,
  GITHUB_SEARCH_INPUT_SCHEMA,
  GITHUB_SEARCH_TOOL_NAME,
  WARP_GREP_DESCRIPTION,
  WARP_GREP_TOOL_NAME
} from "./chunk-Q6QCHAMD.js";
import {
  WarpGrepClient,
  executeGitHubReadFile,
  executeToolCall,
  formatGitHubReadFileResult,
  formatResult
} from "./chunk-75F5XTPD.js";

// tools/warp_grep/anthropic.ts
var INPUT_SCHEMA = {
  type: "object",
  properties: {
    search_term: { type: "string", description: "Search problem statement that this subagent is supposed to research for" }
  },
  required: ["search_term"]
};
var warpGrepTool = {
  name: WARP_GREP_TOOL_NAME,
  description: WARP_GREP_DESCRIPTION,
  input_schema: INPUT_SCHEMA
};
async function execute(input, config) {
  return executeToolCall(input, config);
}
function createWarpGrepTool(config) {
  const tool = {
    name: config.name ?? WARP_GREP_TOOL_NAME,
    description: config.description ?? WARP_GREP_DESCRIPTION,
    input_schema: INPUT_SCHEMA
  };
  return Object.assign(tool, {
    execute: async (input) => {
      return executeToolCall(input, config);
    },
    formatResult: (result) => {
      return formatResult(result);
    }
  });
}
function createGitHubSearchTool(config) {
  const client = new WarpGrepClient(config);
  const tool = {
    name: GITHUB_SEARCH_TOOL_NAME,
    description: GITHUB_SEARCH_DESCRIPTION,
    input_schema: GITHUB_SEARCH_INPUT_SCHEMA
  };
  return Object.assign(tool, {
    execute: async (input) => {
      const github = input.github_url || input.owner_repo;
      if (!github) {
        throw new Error("Please provide github search url or owner/repo id");
      }
      return client.searchGitHub({ searchTerm: input.search_term, github, branch: input.branch });
    },
    formatResult: (result) => {
      return formatResult(result);
    }
  });
}
function createGitHubReadFileTool(config) {
  const tool = {
    name: GITHUB_READ_FILE_TOOL_NAME,
    description: GITHUB_READ_FILE_DESCRIPTION,
    input_schema: GITHUB_READ_FILE_INPUT_SCHEMA
  };
  return Object.assign(tool, {
    execute: async (input) => {
      return executeGitHubReadFile(input, config);
    },
    formatResult: (result) => {
      return formatGitHubReadFileResult(result);
    }
  });
}

export {
  warpGrepTool,
  execute,
  createWarpGrepTool,
  createGitHubSearchTool,
  createGitHubReadFileTool
};
//# sourceMappingURL=chunk-PGQQKNPT.js.map