/** * Shared User Profile Service * * Manages a single user profile stored at ~/.crewly/user-profile.json that * ALL agents can read. The orchestrator is the primary writer, but any agent * may update it. This eliminates per-agent preference fragmentation by * providing a single source of truth for user preferences. * * Features: * - Read-through cache with configurable TTL (30s default) * - Deep merge for preferences, append-only for notes and prohibitions * - Prompt-injectable context generation for agent system prompts * * @module services/memory/user-profile.service */ import type { SharedUserProfile } from '../../types/memory.types.js'; /** * Service for managing the shared user profile. * All agents read from this; orchestrator is the primary writer. * Stored at ~/.crewly/user-profile.json */ export declare class UserProfileService { private static instance; private logger; private profilePath; private cache; private cacheTime; /** Cache time-to-live in milliseconds */ static CACHE_TTL_MS: number; /** * Create a new UserProfileService instance. * * @param crewlyHome - Override for the user home directory (defaults to $HOME) */ constructor(crewlyHome?: string); /** * Get or create the singleton instance. * * @param crewlyHome - Override for the user home directory * @returns The singleton UserProfileService instance */ static getInstance(crewlyHome?: string): UserProfileService; /** * Clear the singleton instance. Used for testing. */ static clearInstance(): void; /** * Get the current user profile. Returns empty profile if none exists. * Results are cached for CACHE_TTL_MS milliseconds. * * @returns The current shared user profile, or an empty object if not yet created */ getProfile(): Promise; /** * Update the user profile with partial updates (deep merge). * * Merge strategy: * - Top-level scalar fields are overwritten * - `preferences` object is shallow-merged (existing keys preserved, new keys added) * - `notes` array is appended (duplicates filtered) * - `prohibitions` array is appended (deduplicated via Set) * - `updatedAt` and `updatedBy` are always set * * @param updates - Partial profile fields to merge * @param updatedBy - Identifier of who is updating (agentId or 'user') * @returns The merged profile after saving */ updateProfile(updates: Partial, updatedBy: string): Promise; /** * Generate a formatted markdown string for prompt injection. * Returns null if the profile is empty or contains only metadata fields. * * @returns Formatted markdown string with user profile context, or null if empty */ generateProfileContext(): Promise; } //# sourceMappingURL=user-profile.service.d.ts.map