import type { Context } from 'koishi'; import type { MemoryScope } from '../../contracts/memory'; import type { MemoryTranscriptOrigin } from '../transcript/origin_context'; export interface QueueExtractionOptions { includeOverheard: boolean; resolveTranscriptOrigin: () => Promise; } export interface CharacterPresetPromptSource { system: { rawString: string; }; } export interface CharacterPresetProvider { preset: { getAllPreset?: () => Promise; getPreset: (presetName: string, loadForDisk?: boolean, throwError?: boolean) => Promise; }; } export declare const characterPresetSuffix = "\uFF08Character\uFF09"; export interface CharacterMemoryScopeSession { isDirect?: boolean; userId?: string; guildId?: string; } /** * Character 集成约定的会话键规则:私聊为 private:{userId},群聊为 group:{guildId}。 * 与 chatluna_character 事件 payload 中的 sessionKey 同格式;推导规则唯一实现于此, * character 中间件与工具 runtime 共用,避免多处拷贝漂移。 */ export declare const toCharacterMemoryConversationId: (session: CharacterMemoryScopeSession) => string | undefined; /** * Character 集成约定的预设命名规则:在原始 presetName 上追加 characterPresetSuffix。 */ export declare const toCharacterMemoryPresetId: (presetName: string) => string; /** * ChatLuna AgentRunContext 中本插件消费的字段。agentContext 自 * 1.4.0-alpha.37 起随工具调用与提示渲染 configurable 下发;扁平的 * conversationId 字段已在 alpha.44 的 run context 统一重构中移除, * agentContext 是会话 id 的唯一可靠来源。 */ export interface AgentRunContextFields { kind?: unknown; source?: unknown; conversationId?: unknown; } export declare const toAgentRunContextFields: (value: unknown) => AgentRunContextFields | null; /** * 子代理运行的会话 id 为合成值(subagent:${uuid}),不对应真实用户会话; * 记忆工作流(注入、提取、主动创建)均不处理子代理运行。 */ export declare const isSubagentRunContext: (value: unknown) => boolean; /** * 取主链路运行的会话 id:子代理运行与缺失/空白会话 id 均返回 undefined。 */ export declare const resolveMainRunConversationId: (value: unknown) => string | undefined; export declare const normalizeText: (value: string) => string; /** * 作用域唯一键:presetId 与 conversationId 以换行符拼接。 * 提取缓冲、召回锁与说话人标签缓存均以该键隔离数据。 */ export declare const scopeKey: (scope: Pick) => string; export declare const toPresetIdList: (value: unknown) => string[]; export declare const mergePresetIds: (...groups: string[][]) => string[]; /** * 从 presetId 解析角色名标签:Character 预设去掉后缀,ChatLuna 预设直接使用 presetId。 */ export declare const resolveAssistantLabel: (presetId: string) => string; /** * 解析面向 LLM 的助手标签:优先使用 preset 展示名(presetLabel), * 缺省或为空白时回退 presetId。 */ export declare const resolveScopeAssistantLabel: (scope: Pick) => string; /** * 取预设 system 部分的未渲染原文,作为人设卡片的删减来源。不经模板渲染器、 * 不取任何变量值:system 部分应为固定人设,写入其中的占位符原样保留。 * Character 预设通过 chatluna_character 获取,ChatLuna 预设通过 chatluna.preset 获取。 */ export declare const resolvePresetPrompt: (ctx: Context, presetId: string) => Promise;