{"version":3,"file":"create-research.mjs","names":[],"sources":["../../src/actions/create-research.ts"],"sourcesContent":["import { z } from \"zod\";\n\nimport { action } from \"../action\";\n\nexport const ExaCreateResearchInput: z.ZodTypeAny = z.object({\n  model: z.enum([\"exa-research\", \"exa-research-pro\"]).default(\"exa-research\").describe(\"Research models available for Exa research tasks.\").optional(),\n  instructions: z.string().describe(\"Instructions for what research should be conducted. This is the natural language prompt describing the research question or topic to explore.\"),\n  outputSchema: z.record(z.string(), z.unknown()).describe(\"Optional JSON schema to structure the research output. If provided, the API will return structured JSON matching this schema. If omitted, the API returns a detailed markdown report.\").optional(),\n}).describe(\"Parameters for creating an asynchronous research task.\");\nconst ExaCreateResearch_ResearchEventSchema: z.ZodTypeAny = z.object({\n  type: z.string().describe(\"Type of event\").optional(),\n  message: z.string().describe(\"Event message or description\").optional(),\n  timestamp: z.number().describe(\"Unix timestamp when the event occurred\").optional(),\n}).passthrough().describe(\"Event tracking progress of a research task.\");\nconst ExaCreateResearch_ResearchOutputSchema: z.ZodTypeAny = z.object({\n  content: z.string().describe(\"Main research content or findings\").optional(),\n  citations: z.array(z.record(z.string(), z.unknown())).describe(\"List of source citations\").optional(),\n}).passthrough().describe(\"Research output containing findings and citations.\");\nconst ExaCreateResearch_CostDollarsSchema: z.ZodTypeAny = z.object({\n  total: z.number().describe(\"Total cost in USD\").optional(),\n  search: z.number().describe(\"Search cost in USD\").optional(),\n  content: z.number().describe(\"Content retrieval cost in USD\").optional(),\n}).passthrough().describe(\"Cost information for the research task.\");\nexport const ExaCreateResearchOutput: z.ZodTypeAny = z.object({\n  error: z.string().describe(\"Error message if the research task failed (only present when status is 'failed').\").optional(),\n  model: z.string().describe(\"The research model used for this task.\").optional(),\n  events: z.array(ExaCreateResearch_ResearchEventSchema).describe(\"List of events tracking the progress of the research task (if available).\").optional(),\n  output: ExaCreateResearch_ResearchOutputSchema.nullable().optional(),\n  status: z.string().describe(\"Current status of the research task (e.g., 'pending', 'running', 'completed', 'failed').\"),\n  createdAt: z.number().describe(\"Unix timestamp (in milliseconds) when the research task was created.\"),\n  researchId: z.string().describe(\"Unique identifier for the research task. Use this ID to poll for completion status and retrieve results.\"),\n  costDollars: ExaCreateResearch_CostDollarsSchema.nullable().optional(),\n  instructions: z.string().describe(\"The instructions provided for this research task.\"),\n  outputSchema: z.record(z.string(), z.unknown()).describe(\"The output schema that was provided in the request (echoed back).\").optional(),\n}).describe(\"Response schema for a newly created research task.\");\n\nexport const exaCreateResearch = action(\"EXA_CREATE_RESEARCH\", {\n  slug: \"exa-create-research\",\n  name: \"Create Research Task\",\n  description: \"Creates an asynchronous research task that explores the web, gathers sources, synthesizes findings, and returns results with citations. The API responds immediately with a researchId for polling completion status. Use this when you need to generate: 1. Structured JSON matching an outputSchema you provide 2. A detailed markdown report when no schema is provided After creation, poll the research task status using the researchId to retrieve the final results when completed.\",\n  input: ExaCreateResearchInput,\n  output: ExaCreateResearchOutput,\n});\n"],"mappings":";;;AAIA,MAAa,yBAAuC,EAAE,OAAO;CAC3D,OAAO,EAAE,KAAK,CAAC,gBAAgB,kBAAkB,CAAC,EAAE,QAAQ,cAAc,EAAE,SAAS,mDAAmD,EAAE,SAAS;CACnJ,cAAc,EAAE,OAAO,EAAE,SAAS,+IAA+I;CACjL,cAAc,EAAE,OAAO,EAAE,OAAO,GAAG,EAAE,QAAQ,CAAC,EAAE,SAAS,uLAAuL,EAAE,SAAS;AAC7P,CAAC,EAAE,SAAS,wDAAwD;AACpE,MAAM,wCAAsD,EAAE,OAAO;CACnE,MAAM,EAAE,OAAO,EAAE,SAAS,eAAe,EAAE,SAAS;CACpD,SAAS,EAAE,OAAO,EAAE,SAAS,8BAA8B,EAAE,SAAS;CACtE,WAAW,EAAE,OAAO,EAAE,SAAS,wCAAwC,EAAE,SAAS;AACpF,CAAC,EAAE,YAAY,EAAE,SAAS,6CAA6C;AACvE,MAAM,yCAAuD,EAAE,OAAO;CACpE,SAAS,EAAE,OAAO,EAAE,SAAS,mCAAmC,EAAE,S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