/** * User Profile Learning — periodic AI analysis of user preferences. * * Pattern sourced from tickernelz/opencode-mem. * Analyzes user messages in batches to identify preferences, patterns, and workflows. * Uses the connected OpenCode provider — no extra API keys or data storage. * * Privacy: opt-in only (enabled: false by default). * No raw messages stored permanently — only analyzed summaries persist. */ import type { OpenCodeProviderService } from './opencode-provider.js'; export interface UserProfileConfig { enabled?: boolean; analysisInterval?: number; maxPreferences?: number; confidenceDecayDays?: number; } export interface UserPreference { key: string; value: string; confidence: number; category: 'code-style' | 'communication' | 'tool' | 'workflow' | 'preference'; firstSeen: string; lastUpdated: string; } export interface UserProfileData { preferences: UserPreference[]; detectedPatterns: string[]; lastAnalysis: string | null; version: number; } /** * Service that periodically analyzes user messages to build a preference profile. * Uses the existing OpenCodeProviderService for LLM calls — no extra API keys. */ export declare class UserProfileService { private messageCount; private profile; private profilePath; private config; private opencodeProvider; private recentMessages; constructor(config: UserProfileConfig, opencodeProvider: OpenCodeProviderService, profileDir: string); /** * Called on each user message. Tracks message count and triggers * periodic analysis when analysisInterval is reached. * 0-risk: never throws. */ onUserMessage(text: string): Promise; /** * Run profile analysis and merge results. */ private analyzeAndUpdate; /** * Apply confidence decay based on time since last update. * Older preferences lose confidence. */ private applyConfidenceDecay; /** * Get profile context for system prompt injection. * Returns empty string if no profile exists or disabled. */ getProfileInjection(): string; /** * Load profile from disk. */ private loadProfile; /** * Save profile to disk. */ private saveProfile; /** * Reset message counter (for testing). */ resetMessageCount(): void; private isEnabled; }