import type { LivingMemoryExtractor } from './extractor'; import type { LivingMemoryMessageFormatter } from '../../transcript/message_formatter'; import { type QueueExtractionOptions } from '../../memory/helpers'; import type { ExtractionMemoryWriter, JobRepository, LivingMemoryConfig } from '../../../contracts/workflows'; import type { MemoryScope, PresetPersonaResolver } from '../../../contracts/memory'; import { type LivingMemoryLogger } from '../../logging/logger'; import type { MessageLogRegistry } from '../../transcript/message_log/message_log_registry'; import type { ConversationLogMessage } from '../../transcript/message_log/types'; type LivingMemoryExtractionConfig = Pick; type ExtractionFormatter = Pick; type ExtractionModel = Pick; /** 提取排干所需的消息日志读取面。 */ export type ExtractionMessageLog = Pick; export type ExtractionJobRepository = Pick; /** * 段锚定切块:以连续 assistant 段的末条闭合交流段,旁听模式同时接收 * 末尾用户消息段。两种模式共用 packChunksFromLatest * 从尾向旧模糊装包;锚定模式先经 selectAnchoredUnits 丢弃核心窗口之外 * 的闲聊,旁听模式先经 splitOverheardUnits 把超预算段切成预算内子块。 */ export declare const planExtractionChunks: (entries: readonly ConversationLogMessage[], window: number, includeOverheard: boolean) => ConversationLogMessage[][]; export declare class LivingMemoryExtractionCoordinator { private readonly config; private readonly messageLog; private readonly jobRepository; private readonly memoryWriter; private readonly formatter; private readonly extractor; private readonly presetPersona; private readonly logger; private readonly onExtracted; private readonly stateByScope; private readonly runningScopeKeys; constructor(config: LivingMemoryExtractionConfig, messageLog: ExtractionMessageLog, jobRepository: ExtractionJobRepository, memoryWriter: ExtractionMemoryWriter, formatter: ExtractionFormatter, extractor: ExtractionModel, presetPersona: PresetPersonaResolver, logger: LivingMemoryLogger, onExtracted: (presetId: string, memoryIds: string[], speakerKeys: string[]) => void); queue(scope: MemoryScope, options: QueueExtractionOptions, initialCursor?: () => number): Promise; private schedule; clearAll(): void; clearByConversation(conversationId: string): void; /** 白名单以用户可直接填写的平台 id 为准:群聊比对群号,私聊比对用户 id。 */ private resolveWhitelistId; /** * 白名单门禁:未开启时全部放行;开启时仅放行 id 命中白名单的会话, * 未命中记跳过诊断。白名单只约束自动提取,不影响日志采集与召回。 */ private isExtractionWhitelisted; private drain; /** * 排干下一块:无待处理块返回 false(本次排干结束);成功提取、或连续 * 失败达上限放弃并推进游标,返回 true(继续排后续块);连续失败未达 * 上限返回 false(中断本次,连同新消息下次重试)。 */ private drainNextChunk; /** * 单块失败处理:连续失败未达上限时中断本次排干(返回 false),连同新 * 消息下次重试;达到上限时记 failed job、推进游标放弃该块(返回 true) * 以续排后续块,防止游标永久卡死。 */ private handleChunkFailure; private run; private recordFailedExtraction; } export {};