import type { ArvoSemanticVersion } from 'arvo-core'; import z from 'zod'; import type { AgentInternalTool } from '../AgentTool/types.js'; import type { PromiseAble } from '../types.js'; import type { AgentContextBuilder, AgentOutputBuilder, AgentServiceContract, AnyArvoOrchestratorContract } from './types.js'; /** * Creates a Zod schema validator for base64-encoded data URLs with MIME type restrictions. * * Validates that strings match the data URL format (data:mime/type;base64,encodedContent) * and optionally restricts to specific MIME types. * * @example * ```typescript * const imageSchema = dataUrlString(['image/jpeg', 'image/png']); * imageSchema.parse('data:image/jpeg;base64,/9j/4AAQ...'); // Valid * imageSchema.parse('data:application/pdf;base64,...'); // Throws - wrong MIME type * ``` */ export declare const dataUrlString: (allowedMimeTypes: string[]) => z.ZodEffects; /** * Default schemas and builders for common agent patterns. * * Provides ready-to-use implementations for typical agent configurations, * reducing boilerplate while remaining customizable. Use these defaults * to get started quickly, then customize as needed for specific use cases. */ export declare const AgentDefaults: { /** * Default initialization schema accepting a simple text message. * * Use for basic conversational agents that only need text input. */ readonly INIT_SCHEMA: z.ZodObject<{ message: z.ZodString; }, "strip", z.ZodTypeAny, { message: string; }, { message: string; }>; /** * Multimodal initialization schema supporting text, images, and PDFs. * * Accepts base64-encoded images (JPEG, PNG, GIF, WebP) and PDF documents * alongside the text message. Media content is visible to the LLM only once * and should be extracted into conversation history via internal tools * if needed for later reference. * * @remarks * The media masking optimization automatically replaces viewed media with * placeholder text in subsequent LLM calls to reduce token consumption. */ readonly INIT_MULTIMODAL_SCHEMA: z.ZodObject<{ message: z.ZodString; imageBase64: z.ZodOptional, "many">>; pdfBase64: z.ZodOptional, "many">>; }, "strip", z.ZodTypeAny, { message: string; imageBase64?: string[] | undefined; pdfBase64?: string[] | undefined; }, { message: string; imageBase64?: string[] | undefined; pdfBase64?: string[] | undefined; }>; /** * Default completion schema outputting a simple text response. * * Use when agents produce conversational text rather than structured data. */ readonly COMPLETE_SCHEMA: z.ZodObject<{ response: z.ZodString; }, "strip", z.ZodTypeAny, { response: string; }, { response: string; }>; /** * Default context builder transforming initialization events into LLM context. * * Converts the message field into a user message and processes any attached * media (images, PDFs) into the conversation history (Assumes the media * content to be base64 - ArvoAgent always assumes this internally). Accepts an optional * system prompt builder function that receives initialization parameters * and available tools for dynamic prompt construction. * * @param systemPromptBuilder - Optional function returning the system prompt. * Receives input event, tools catalog, and contract reference. * * @returns Context builder function compatible with agent handler configuration * * @example * ```typescript * context: AgentDefaults.CONTEXT_BUILDER(({ tools, input }) => * `You are a helpful agent. Use ${tools.tools.dateTool.name} for dates.` * ) * ``` */ readonly CONTEXT_BUILDER: , TTools extends Record>(systemPromptBuilder?: (param: Parameters>[0]) => PromiseAble; }>) => AgentContextBuilder; /** * Default output builder validating agent responses against contract schemas. * * Handles both text and JSON output modes: * - **Text mode:** wraps the LLM's raw response string in the default complete schema structure. * - **JSON mode:** attempts to recover a valid JSON object from the LLM's output using a * two-stage strategy: * 1. Use `parsedContent` if the LLM integration already parsed it successfully. * 2. If `parsedContent` is null (parse failed), run `jsonrepair` on the raw `content` to * recover from common LLM output issues: markdown code fences, prose mixed with JSON, * and structurally malformed JSON. Non-object results (arrays, primitives) are rejected. * 3. If recovery fails, return a natural language error that feeds into the self-correction * loop so the LLM can retry with explicit formatting instructions. * * @remarks * Returns `{ data }` on success or `{ error }` on failure. Errors trigger the agent's * self-correction loop, allowing the LLM to fix its output before the cycle limit is hit. */ readonly OUTPUT_BUILDER: AgentOutputBuilder; }; //# sourceMappingURL=AgentDefaults.d.ts.map