const require_chunk = require('./chunk-DWy1uDak.cjs');
const require_errors = require('./errors-BtJEw2Z-.cjs');
const require_callEmbeddedAgent = require('./callEmbeddedAgent-KKTSTD7W.cjs');
const require_whoami = require('./whoami-DBSqcCGl.cjs');
const require_dataset_fields = require('./dataset-fields-C0m-vwNH.cjs');
const require_config = require('./config-DbQP60oo.cjs');
const zod = require_chunk.__toESM(require("zod"));

//#region src/tools/search-issues/agent.ts
const outputSchema = zod.z.object({
	query: zod.z.string().default("").nullish().describe("The Sentry issue search query"),
	sort: zod.z.enum([
		"date",
		"freq",
		"new",
		"user"
	]).default("date").nullish().describe("How to sort the results"),
	explanation: zod.z.string().describe("Brief explanation of how you translated this query.")
});
/**
* Search issues agent - single entry point for translating natural language queries to Sentry issue search syntax
* This returns both the translated query result AND the tool calls made by the agent
*/
async function searchIssuesAgent(options) {
	if (!process.env.OPENAI_API_KEY) throw new require_errors.ConfigurationError("OPENAI_API_KEY environment variable is required for semantic search");
	return await require_callEmbeddedAgent.callEmbeddedAgent({
		system: require_config.systemPrompt,
		prompt: options.query,
		tools: {
			issueFields: require_dataset_fields.createDatasetFieldsTool({
				apiService: options.apiService,
				organizationSlug: options.organizationSlug,
				dataset: "search_issues",
				projectId: options.projectId
			}),
			whoami: require_whoami.createWhoamiTool({ apiService: options.apiService })
		},
		schema: outputSchema
	});
}

//#endregion
Object.defineProperty(exports, 'searchIssuesAgent', {
  enumerable: true,
  get: function () {
    return searchIssuesAgent;
  }
});
//# sourceMappingURL=agent-BMCJjVaJ.cjs.map