import type { ChatLunaChatModel } from 'koishi-plugin-chatluna/llm-core/platform/model'; import type { LivingMemoryTranscriptMessage, PresetPersonaResolver } from '../contracts/memory'; import type { LivingMemoryConfig, UserProfileMemoryRepository, UserProfileRepository } from '../contracts/workflows'; import { type LivingMemoryLogger } from './logging/logger'; export declare const normalizeManualUserProfileContent: (content: string) => string; type LivingMemoryUserProfileConfig = Pick; export interface UserProfileGenerationResult { generated: number; detail: string; } export declare const collectUserProfileSpeakerKeys: (messages: LivingMemoryTranscriptMessage[]) => string[]; export declare class LivingMemoryUserProfileService { private readonly config; private readonly repository; private readonly logger; private readonly presetPersona; private readonly createModel; private readonly queue; private readonly controller; private readonly tasks; constructor(config: LivingMemoryUserProfileConfig, repository: UserProfileRepository & UserProfileMemoryRepository, logger: LivingMemoryLogger, presetPersona: PresetPersonaResolver, createModel: () => Promise); regenerate(presetId: string, speakerKeys?: string[], options?: { force?: boolean; }): Promise; queueGeneration(presetId: string, speakerKeys?: string[]): void; stop(): Promise; private generate; /** * 取出达到最低记忆数量的用户及其活跃记忆。门槛只按实际读取到的活跃记忆数 * 判定:关联索引与记忆读取是两次查询,索引行可能指向期间已归档或已删除的 * 记忆,索引行数不能代表送入模型的记忆条数。 */ private loadEligibleMemoryGroups; private latestTimestamp; /** 按上次审阅的记忆集合与更新时间跳过相同输入;WebUI 重新生成直接略过此判断。 */ private isProfileUpToDate; /** * 生成并写入单个说话者的画像。返回结果区分:generated 表示已改写画像, * kept 表示模型判断已有画像无需变更、只记下本次审阅的输入,failed 表示 * 模型调用或结构化校验失败时记录该用户的失败原因。 */ private generateProfileForGroup; renderForSpeakers(presetId: string, speakerKeys: string[]): Promise; } export {};