import {
  GITHUB_READ_FILE_DESCRIPTION,
  GITHUB_READ_FILE_TOOL_NAME,
  GITHUB_SEARCH_DESCRIPTION,
  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";
import "../../chunk-63VHBANJ.js";
import "../../chunk-TURYLQJ3.js";
import "../../chunk-GVGJIXV2.js";
import "../../chunk-B3AKP3RA.js";
import "../../chunk-VNAGVCSP.js";
import "../../chunk-FBRNUWEB.js";
import "../../chunk-I3J46TSB.js";
import "../../chunk-GLQWEINZ.js";
import "../../chunk-SCVWDNQP.js";
import "../../chunk-F3NCFNUX.js";
import "../../chunk-S4Y6O7CT.js";
import "../../chunk-PZ5AY32C.js";

// tools/warp_grep/gemini.ts
var TOOL_PARAMETERS = {
  type: "OBJECT",
  properties: {
    search_term: {
      type: "STRING",
      description: "Search problem statement that this subagent is supposed to research for"
    }
  },
  required: ["search_term"]
};
var warpGrepFunctionDeclaration = {
  name: WARP_GREP_TOOL_NAME,
  description: WARP_GREP_DESCRIPTION,
  parameters: TOOL_PARAMETERS
};
async function execute(input, config) {
  return executeToolCall(input, config);
}
function createWarpGrepTool(config) {
  const declaration = {
    name: config.name ?? WARP_GREP_TOOL_NAME,
    description: config.description ?? WARP_GREP_DESCRIPTION,
    parameters: TOOL_PARAMETERS
  };
  return Object.assign(declaration, {
    execute: async (input) => {
      return executeToolCall(input, config);
    },
    formatResult: (result) => {
      return formatResult(result);
    }
  });
}
var createMorphWarpGrepTool = createWarpGrepTool;
var GITHUB_SEARCH_PARAMETERS = {
  type: "OBJECT",
  properties: {
    search_term: { type: "STRING", description: "Search problem statement that this subagent is supposed to research for" },
    github_url: { type: "STRING", description: 'GitHub repository URL to search (e.g. "https://github.com/vercel/next.js"). You must provide either github_url or owner_repo.' },
    owner_repo: { type: "STRING", description: 'Repository owner/repo shorthand (e.g. "vercel/next.js"). You must provide either github_url or owner_repo.' },
    branch: { type: "STRING", description: "Branch to search (defaults to repo default branch)" }
  },
  required: ["search_term"]
};
function createGitHubSearchTool(config) {
  const client = new WarpGrepClient(config);
  const declaration = {
    name: GITHUB_SEARCH_TOOL_NAME,
    description: GITHUB_SEARCH_DESCRIPTION,
    parameters: GITHUB_SEARCH_PARAMETERS
  };
  return Object.assign(declaration, {
    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);
    }
  });
}
var GITHUB_READ_FILE_PARAMETERS = {
  type: "OBJECT",
  properties: {
    github: { type: "STRING", description: 'owner/repo shorthand (e.g., "vercel/next.js")' },
    path: { type: "STRING", description: "File path within the repository" },
    startLine: { type: "NUMBER", description: "Start line number (1-based)" },
    endLine: { type: "NUMBER", description: "End line number (1-based, inclusive)" },
    branch: { type: "STRING", description: "Branch to read from (defaults to repo default branch)" }
  },
  required: ["github", "path"]
};
function createGitHubReadFileTool(config) {
  const declaration = {
    name: GITHUB_READ_FILE_TOOL_NAME,
    description: GITHUB_READ_FILE_DESCRIPTION,
    parameters: GITHUB_READ_FILE_PARAMETERS
  };
  return Object.assign(declaration, {
    execute: async (input) => {
      return executeGitHubReadFile(input, config);
    },
    formatResult: (result) => {
      return formatGitHubReadFileResult(result);
    }
  });
}
var gemini_default = warpGrepFunctionDeclaration;
export {
  createGitHubReadFileTool,
  createGitHubSearchTool,
  createMorphWarpGrepTool,
  createWarpGrepTool,
  gemini_default as default,
  execute,
  formatResult,
  warpGrepFunctionDeclaration
};
//# sourceMappingURL=gemini.js.map