/** * Leaper Agent - Core Types * * Type definitions for the 6-layer Evolution Engine */ export interface ChatMessage { role: 'system' | 'user' | 'assistant' | 'tool'; content: string; name?: string; tool_call_id?: string; tool_calls?: ToolCall[]; } export interface ToolCall { id: string; type: 'function'; function: { name: string; arguments: string; }; } export interface ChatCompletionOptions { model: string; messages: ChatMessage[]; tools?: ToolDefinition[]; temperature?: number; max_tokens?: number; stream?: boolean; } export interface ToolDefinition { type: 'function'; function: { name: string; description: string; parameters: Record; }; } export interface ChatCompletionResult { content: string; tool_calls?: ToolCall[]; usage?: { prompt_tokens: number; completion_tokens: number; total_tokens: number; }; model?: string; } export interface LLMProvider { chat(options: ChatCompletionOptions): Promise; chatStream?(options: ChatCompletionOptions): AsyncIterable; } export interface ProviderConfig { provider: 'openai' | 'anthropic' | 'openrouter' | 'ollama' | 'custom'; model: string; apiKey?: string; baseUrl?: string; extraHeaders?: Record; } export interface BrainEntry { id: string; content: string; keywords: string[]; layer: 'l0' | 'l1' | 'l2' | 'seed'; maturityScore: number; embedding?: number[]; createdAt: string; updatedAt: string; } export interface BrainBackend { init(): void; upsert(entry: BrainEntry): void; get(id: string): BrainEntry | null; getAll(): BrainEntry[]; ftsSearch(query: string, limit: number): Array<{ entry: BrainEntry; rank: number; }>; delete(id: string): void; close(): void; } export interface L1Output { keywords: string[]; summary: string; taskSuccess: boolean; userSatisfaction: 'positive' | 'neutral' | 'negative' | 'unknown'; reasoningPattern: string | null; complexity: 'trivial' | 'moderate' | 'complex'; toolsUsed: string[]; } export interface GeneratedSkill { name: string; description: string; triggers: string[]; procedure: string; examples: Array<{ input: string; output: string; date: string; }>; confidence: number; useCount: number; lastUsed: string; source: 'auto-generated' | 'manual'; version: number; parentSkills: string[]; status: 'active' | 'unverified' | 'deprecated'; } export interface SkillConflict { skillA: string; skillB: string; description: string; resolution: 'keep-a' | 'keep-b' | 'merge' | 'unresolved'; } export interface EvolutionResult { merged: string[]; deprecated: string[]; conflicts: SkillConflict[]; promoted: string[]; } export interface UserModel { basics: { name: string | null; role: string | null; company: string | null; industry: string | null; }; patterns: { decisionStyle: 'analytical' | 'intuitive' | 'consultative' | 'unknown'; communicationPreference: 'direct' | 'detailed' | 'brief' | 'unknown'; topicFrequency: Record; activeHours: number[]; avgSessionLength: number; }; preferences: { responseLength: 'short' | 'medium' | 'long' | 'unknown'; language: string; explicitDislikes: string[]; explicitLikes: string[]; }; decisions: Array<{ date: string; topic: string; choice: string; context: string; outcome: string | null; }>; lastUpdated: string; } export interface ValidationResult { consistency: boolean; regression: boolean; counterfactual: boolean; pass: boolean; details: string; } export interface LeaperConfig { name: string; version: string; provider: ProviderConfig; embedding?: { provider: 'openai' | 'ollama' | 'auto'; model?: string; apiKey?: string; baseUrl?: string; }; systemPrompt?: string; workspaceDir: string; skillsDir?: string; evolution?: { autoSkillGeneration: boolean; evolutionInterval: number; minComplexityForSkill: 'trivial' | 'moderate' | 'complex'; confidenceThreshold: number; maxSkills: number; }; } //# sourceMappingURL=types.d.ts.map