import {
  WARP_GREP_DESCRIPTION
} from "./chunk-KW7OEGZK.js";
import {
  executeToolCall
} from "./chunk-ELZ7YZDN.js";

// tools/warp_grep/vercel.ts
import { tool } from "ai";
import { z } from "zod";
var warpGrepJsonSchema = {
  type: "object",
  properties: {
    query: {
      type: "string",
      description: "Free-form repository question"
    }
  },
  required: ["query"],
  additionalProperties: false
};
async function execute(input, config) {
  return executeToolCall(input, config);
}
function createWarpGrepTool(config) {
  const schema = config.inputSchema ?? z.object({
    query: z.string().describe("Free-form repository question")
  });
  return tool({
    description: config.description ?? WARP_GREP_DESCRIPTION,
    inputSchema: schema,
    execute: async (params) => {
      const result = await executeToolCall(params, config);
      if (!result.success) {
        throw new Error(`Failed to search codebase: ${result.error}`);
      }
      return {
        success: true,
        contexts: result.contexts,
        summary: result.summary
      };
    }
  });
}
var vercel_default = createWarpGrepTool;

export {
  warpGrepJsonSchema,
  execute,
  createWarpGrepTool,
  vercel_default
};
//# sourceMappingURL=chunk-JOJDIQKG.js.map