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-OTOVGCG6.js";
import {
  WarpGrepClient,
  executeGitHubReadFile,
  executeToolCall,
  formatGitHubReadFileResult,
  formatResult
} from "./chunk-S4RLT56A.js";
import {
  getSystemPrompt
} from "./chunk-FMLHRJDF.js";

// tools/warp_grep/openai.ts
var TOOL_PARAMETERS = {
  type: "object",
  properties: {
    query: { type: "string", description: "Free-form repository question" }
  },
  required: ["query"]
};
var warpGrepTool = {
  type: "function",
  function: {
    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 tool = {
    type: "function",
    function: {
      name: config.name ?? WARP_GREP_TOOL_NAME,
      description: config.description ?? WARP_GREP_DESCRIPTION,
      parameters: TOOL_PARAMETERS
    }
  };
  return Object.assign(tool, {
    execute: async (input) => {
      return executeToolCall(input, config);
    },
    formatResult: (result) => {
      return formatResult(result);
    },
    getSystemPrompt: () => {
      return getSystemPrompt();
    }
  });
}
function createGitHubSearchTool(config) {
  const client = new WarpGrepClient(config);
  const tool = {
    type: "function",
    function: {
      name: GITHUB_SEARCH_TOOL_NAME,
      description: GITHUB_SEARCH_DESCRIPTION,
      parameters: GITHUB_SEARCH_INPUT_SCHEMA
    }
  };
  return Object.assign(tool, {
    execute: async (input) => {
      return client.searchGitHub(input);
    },
    formatResult: (result) => {
      return formatResult(result);
    },
    getSystemPrompt: () => {
      return getSystemPrompt();
    }
  });
}
function createGitHubReadFileTool(config) {
  const tool = {
    type: "function",
    function: {
      name: GITHUB_READ_FILE_TOOL_NAME,
      description: GITHUB_READ_FILE_DESCRIPTION,
      parameters: GITHUB_READ_FILE_INPUT_SCHEMA
    }
  };
  return Object.assign(tool, {
    execute: async (input) => {
      return executeGitHubReadFile(input, config);
    },
    formatResult: (result) => {
      return formatGitHubReadFileResult(result);
    }
  });
}
var openai_default = warpGrepTool;

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