/** * Multi-Model Architecture Types * * Defines types for the two-tier agentic architecture: * - Tier 1 (Planner): High-level reasoning and task decomposition * - Tier 2 (Executor): Concrete implementation following planner specs */ import { z } from 'zod'; export type ModelProvider = 'anthropic' | 'deepseek' | 'openai' | 'zhipu' | 'ollama' | 'custom'; export type ModelRole = 'planner' | 'executor' | 'reviewer' | 'fallback'; export type TaskComplexity = 'low' | 'medium' | 'high' | 'critical'; /** * Model configuration for a specific provider/model combination */ export declare const ModelConfigSchemaModels: z.ZodObject<{ id: z.ZodString; name: z.ZodString; provider: z.ZodEnum<["anthropic", "deepseek", "openai", "zhipu", "ollama", "custom"]>; apiModel: z.ZodString; endpoint: z.ZodOptional; apiKeyEnvVar: z.ZodOptional; maxContextTokens: z.ZodDefault; costPer1MInput: z.ZodOptional; costPer1MOutput: z.ZodOptional; capabilities: z.ZodDefault>; }, "strip", z.ZodTypeAny, { provider: "custom" | "anthropic" | "deepseek" | "openai" | "zhipu" | "ollama"; name: string; maxContextTokens: number; id: string; apiModel: string; capabilities: string[]; endpoint?: string | undefined; apiKeyEnvVar?: string | undefined; costPer1MInput?: number | undefined; costPer1MOutput?: number | undefined; }, { provider: "custom" | "anthropic" | "deepseek" | "openai" | "zhipu" | "ollama"; name: string; id: string; apiModel: string; endpoint?: string | undefined; maxContextTokens?: number | undefined; apiKeyEnvVar?: string | undefined; costPer1MInput?: number | undefined; costPer1MOutput?: number | undefined; capabilities?: string[] | undefined; }>; export type ModelConfig = z.infer; /** * Pre-defined model presets for common configurations */ export declare const ModelPresets: Record; export type ModelPresetId = keyof typeof ModelPresets; /** * Role assignment configuration - maps roles to models */ export declare const RoleAssignmentSchema: z.ZodObject<{ role: z.ZodEnum<["planner", "executor", "reviewer", "fallback"]>; modelId: z.ZodString; maxTokensPerRequest: z.ZodOptional; timeout: z.ZodDefault; }, "strip", z.ZodTypeAny, { role: "planner" | "executor" | "reviewer" | "fallback"; modelId: string; timeout: number; maxTokensPerRequest?: number | undefined; }, { role: "planner" | "executor" | "reviewer" | "fallback"; modelId: string; maxTokensPerRequest?: number | undefined; timeout?: number | undefined; }>; export type RoleAssignment = z.infer; /** * Routing rule for task-to-model mapping */ export declare const RoutingRuleSchema: z.ZodObject<{ complexity: z.ZodOptional>; keywords: z.ZodOptional>; taskType: z.ZodOptional>; targetRole: z.ZodEnum<["planner", "executor", "reviewer", "fallback"]>; priority: z.ZodDefault; }, "strip", z.ZodTypeAny, { targetRole: "planner" | "executor" | "reviewer" | "fallback"; priority: number; complexity?: "low" | "medium" | "high" | "critical" | undefined; keywords?: string[] | undefined; taskType?: "planning" | "coding" | "refactoring" | "bug-fix" | "review" | "documentation" | undefined; }, { targetRole: "planner" | "executor" | "reviewer" | "fallback"; complexity?: "low" | "medium" | "high" | "critical" | undefined; keywords?: string[] | undefined; taskType?: "planning" | "coding" | "refactoring" | "bug-fix" | "review" | "documentation" | undefined; priority?: number | undefined; }>; export type RoutingRule = z.infer; /** * Multi-Model Architecture configuration schema for .uam.json */ export declare const MultiModelConfigSchema: z.ZodObject<{ enabled: z.ZodDefault; models: z.ZodDefault; apiModel: z.ZodString; endpoint: z.ZodOptional; apiKeyEnvVar: z.ZodOptional; maxContextTokens: z.ZodDefault; costPer1MInput: z.ZodOptional; costPer1MOutput: z.ZodOptional; capabilities: z.ZodDefault>; }, "strip", z.ZodTypeAny, { provider: "custom" | "anthropic" | "deepseek" | "openai" | "zhipu" | "ollama"; name: string; maxContextTokens: number; id: string; apiModel: string; capabilities: string[]; endpoint?: string | undefined; apiKeyEnvVar?: string | undefined; costPer1MInput?: number | undefined; costPer1MOutput?: number | undefined; }, { provider: "custom" | "anthropic" | "deepseek" | "openai" | "zhipu" | "ollama"; name: string; id: string; apiModel: string; endpoint?: string | undefined; maxContextTokens?: number | undefined; apiKeyEnvVar?: string | undefined; costPer1MInput?: number | undefined; costPer1MOutput?: number | undefined; capabilities?: string[] | undefined; }>]>, "many">>; roles: z.ZodOptional; executor: z.ZodDefault; reviewer: z.ZodOptional; fallback: z.ZodDefault; }, "strip", z.ZodTypeAny, { planner: string; executor: string; fallback: string; reviewer?: string | undefined; }, { planner?: string | undefined; executor?: string | undefined; reviewer?: string | undefined; fallback?: string | undefined; }>>; routing: z.ZodOptional>; keywords: z.ZodOptional>; taskType: z.ZodOptional>; targetRole: z.ZodEnum<["planner", "executor", "reviewer", "fallback"]>; priority: z.ZodDefault; }, "strip", z.ZodTypeAny, { targetRole: "planner" | "executor" | "reviewer" | "fallback"; priority: number; complexity?: "low" | "medium" | "high" | "critical" | undefined; keywords?: string[] | undefined; taskType?: "planning" | "coding" | "refactoring" | "bug-fix" | "review" | "documentation" | undefined; }, { targetRole: "planner" | "executor" | "reviewer" | "fallback"; complexity?: "low" | "medium" | "high" | "critical" | undefined; keywords?: string[] | undefined; taskType?: "planning" | "coding" | "refactoring" | "bug-fix" | "review" | "documentation" | undefined; priority?: number | undefined; }>, "many">>; costOptimization: z.ZodOptional; targetReduction: z.ZodDefault; maxPerformanceDegradation: z.ZodDefault; fallbackThreshold: z.ZodDefault; }, "strip", z.ZodTypeAny, { enabled: boolean; targetReduction: number; maxPerformanceDegradation: number; fallbackThreshold: number; }, { enabled?: boolean | undefined; targetReduction?: number | undefined; maxPerformanceDegradation?: number | undefined; fallbackThreshold?: number | undefined; }>>; routingStrategy: z.ZodDefault>; plannerSettings: z.ZodOptional>; maxPlanningTokens: z.ZodDefault; enableDecomposition: z.ZodDefault; }, "strip", z.ZodTypeAny, { complexityThreshold: "low" | "medium" | "high"; maxPlanningTokens: number; enableDecomposition: boolean; }, { complexityThreshold?: "low" | "medium" | "high" | undefined; maxPlanningTokens?: number | undefined; enableDecomposition?: boolean | undefined; }>>; executorSettings: z.ZodOptional; maxRetries: z.ZodDefault; stepTimeout: z.ZodDefault; }, "strip", z.ZodTypeAny, { retryWithFallback: boolean; maxRetries: number; stepTimeout: number; }, { retryWithFallback?: boolean | undefined; maxRetries?: number | undefined; stepTimeout?: number | undefined; }>>; }, "strip", z.ZodTypeAny, { enabled: boolean; models: (string | { provider: "custom" | "anthropic" | "deepseek" | "openai" | "zhipu" | "ollama"; name: string; maxContextTokens: number; id: string; apiModel: string; capabilities: string[]; endpoint?: string | undefined; apiKeyEnvVar?: string | undefined; costPer1MInput?: number | undefined; costPer1MOutput?: number | undefined; })[]; routingStrategy: "cost-optimized" | "performance-first" | "balanced" | "adaptive"; roles?: { planner: string; executor: string; fallback: string; reviewer?: string | undefined; } | undefined; routing?: { targetRole: "planner" | "executor" | "reviewer" | "fallback"; priority: number; complexity?: "low" | "medium" | "high" | "critical" | undefined; keywords?: string[] | undefined; taskType?: "planning" | "coding" | "refactoring" | "bug-fix" | "review" | "documentation" | undefined; }[] | undefined; costOptimization?: { enabled: boolean; targetReduction: number; maxPerformanceDegradation: number; fallbackThreshold: number; } | undefined; plannerSettings?: { complexityThreshold: "low" | "medium" | "high"; maxPlanningTokens: number; enableDecomposition: boolean; } | undefined; executorSettings?: { retryWithFallback: boolean; maxRetries: number; stepTimeout: number; } | undefined; }, { enabled?: boolean | undefined; models?: (string | { provider: "custom" | "anthropic" | "deepseek" | "openai" | "zhipu" | "ollama"; name: string; id: string; apiModel: string; endpoint?: string | undefined; maxContextTokens?: number | undefined; apiKeyEnvVar?: string | undefined; costPer1MInput?: number | undefined; costPer1MOutput?: number | undefined; capabilities?: string[] | undefined; })[] | undefined; roles?: { planner?: string | undefined; executor?: string | undefined; reviewer?: string | undefined; fallback?: string | undefined; } | undefined; routing?: { targetRole: "planner" | "executor" | "reviewer" | "fallback"; complexity?: "low" | "medium" | "high" | "critical" | undefined; keywords?: string[] | undefined; taskType?: "planning" | "coding" | "refactoring" | "bug-fix" | "review" | "documentation" | undefined; priority?: number | undefined; }[] | undefined; routingStrategy?: "cost-optimized" | "performance-first" | "balanced" | "adaptive" | undefined; costOptimization?: { enabled?: boolean | undefined; targetReduction?: number | undefined; maxPerformanceDegradation?: number | undefined; fallbackThreshold?: number | undefined; } | undefined; plannerSettings?: { complexityThreshold?: "low" | "medium" | "high" | undefined; maxPlanningTokens?: number | undefined; enableDecomposition?: boolean | undefined; } | undefined; executorSettings?: { retryWithFallback?: boolean | undefined; maxRetries?: number | undefined; stepTimeout?: number | undefined; } | undefined; }>; export type MultiModelConfig = z.infer; /** * Task classification result from the router */ export interface TaskClassificationResult { complexity: TaskComplexity; taskType: 'planning' | 'coding' | 'refactoring' | 'bug-fix' | 'review' | 'documentation'; keywords: string[]; estimatedTokens: number; requiresPlanning: boolean; suggestedModel: string; fallbackModel: string; reasoning: string; } /** * Execution plan from the planner */ export interface ExecutionPlan { id: string; originalTask: string; subtasks: Subtask[]; dependencies: Map; modelAssignments: Map; estimatedCost: number; estimatedDuration: number; created: Date; } export interface Subtask { id: string; title: string; description: string; type: 'planning' | 'coding' | 'refactoring' | 'bug-fix' | 'review' | 'documentation'; complexity: TaskComplexity; inputs: string[]; outputs: string[]; constraints: string[]; } /** * Execution result for tracking */ export interface ExecutionResult { planId: string; subtaskId: string; modelUsed: string; success: boolean; output: string; error?: string; tokensUsed: { input: number; output: number; }; cost: number; duration: number; retryCount: number; } /** * Model selection result from the router */ export interface ModelSelection { model: ModelConfig; fallback?: ModelConfig; role: ModelRole; reasoning: string; estimatedCost: number; } export declare const DEFAULT_ROUTING_RULES: RoutingRule[]; //# sourceMappingURL=types.d.ts.map