import { z } from 'zod'; import { ConfigManager } from './config-manager.js'; /** * Model configuration schema for individual AI models. * Defines the structure for model specifications including limits, * capabilities, cost, and optional features. */ export declare const ModelConfigSchema: z.ZodObject<{ id: z.ZodString; name: z.ZodString; limit: z.ZodObject<{ context: z.ZodNumber; output: z.ZodNumber; }, z.core.$strip>; temperature: z.ZodOptional; tool_call: z.ZodOptional; reasoning: z.ZodOptional; interleaved: z.ZodOptional>; modalities: z.ZodOptional; output: z.ZodArray; }, z.core.$strip>>; cost: z.ZodOptional>; release_date: z.ZodOptional; }, z.core.$strip>; /** * Nanogpt provider schema. * Defines the structure for the nanogpt provider configuration including * npm package, name, API options, and available models. */ export declare const NanogptProviderSchema: z.ZodObject<{ npm: z.ZodString; name: z.ZodString; options: z.ZodObject<{ baseURL: z.ZodString; }, z.core.$strip>; models: z.ZodObject<{}, z.core.$catchall; temperature: z.ZodOptional; tool_call: z.ZodOptional; reasoning: z.ZodOptional; interleaved: z.ZodOptional>; modalities: z.ZodOptional; output: z.ZodArray; }, z.core.$strip>>; cost: z.ZodOptional>; release_date: z.ZodOptional; }, z.core.$strip>>>; }, z.core.$strip>; /** * MCP server schema. * Defines the structure for MCP (Model Context Protocol) server configuration. * Currently supports only local type servers. */ export declare const McpServerSchema: z.ZodObject<{ type: z.ZodLiteral<"local">; command: z.ZodArray; environment: z.ZodObject<{}, z.core.$catchall>; enabled: z.ZodBoolean; }, z.core.$strip>; /** * OpenCode config schema. * Top-level schema for the entire OpenCode configuration file. * Uses passthrough to allow additional properties that aren't strictly defined. */ export declare const OpenCodeConfigSchema: z.ZodObject<{ $schema: z.ZodOptional; model: z.ZodOptional; small_model: z.ZodOptional; disabled_providers: z.ZodOptional>; provider: z.ZodObject<{ nanogpt: z.ZodOptional; models: z.ZodObject<{}, z.core.$catchall; temperature: z.ZodOptional; tool_call: z.ZodOptional; reasoning: z.ZodOptional; interleaved: z.ZodOptional>; modalities: z.ZodOptional; output: z.ZodArray; }, z.core.$strip>>; cost: z.ZodOptional>; release_date: z.ZodOptional; }, z.core.$strip>>>; }, z.core.$strip>>; }, z.core.$loose>; mcp: z.ZodOptional; command: z.ZodArray; environment: z.ZodObject<{}, z.core.$catchall>; enabled: z.ZodBoolean; }, z.core.$strip>>>>; }, z.core.$loose>; /** * Inferred TypeScript types from Zod schemas. */ export type OpenCodeConfig = z.infer; export type NanogptProvider = z.infer; export type ModelConfig = z.infer; export type McpServerConfig = z.infer; /** * Validates a configuration object against the OpenCodeConfigSchema. * * @param config - The configuration object to validate * @returns The parsed and typed configuration object * @throws {z.ZodError} If validation fails with descriptive error messages * * @example * ```typescript * const config = { provider: { nanogpt: { ... } } }; * const validated = validateConfig(config); * ``` */ export declare function validateConfig(config: any): OpenCodeConfig; /** * Validates a configuration file before writing to it. * Reads the file and validates its contents against the schema. * * @param configManager - ConfigManager instance for reading files * @param filePath - Path to the configuration file to validate * @throws {Error} If file cannot be read or contains invalid JSON/JSONC * @throws {z.ZodError} If validation fails * * @example * ```typescript * await validateBeforeWrite(configManager, '/path/to/config.json'); * ``` */ export declare function validateBeforeWrite(configManager: ConfigManager, filePath: string): Promise; /** * Validates a configuration file after writing to confirm success. * Reads the file and validates its contents against the schema. * * @param configManager - ConfigManager instance for reading files * @param filePath - Path to the configuration file to validate * @throws {Error} If file cannot be read or contains invalid JSON/JSONC * @throws {z.ZodError} If validation fails * * @example * ```typescript * // After modifying config * await validateAfterWrite(configManager, '/path/to/config.json'); * ``` */ export declare function validateAfterWrite(configManager: ConfigManager, filePath: string): Promise; /** * Safely validates a configuration object without throwing. * Returns an object with success status and either the parsed data or error. * * @param config - The configuration object to validate * @returns Object containing success status and either data or error * * @example * ```typescript * const result = safeValidateConfig(possiblyInvalidConfig); * if (result.success) { * console.log('Valid config:', result.data); * } else { * console.error('Validation errors:', result.error); * } * ``` */ export declare function safeValidateConfig(config: any): { success: true; data: OpenCodeConfig; } | { success: false; error: z.ZodError; }; //# sourceMappingURL=validation.d.ts.map