/** * XG-IM 群聊历史记录工具(供 AI 按需调用) * * 通过 OpenClaw 的 api.registerTool() 注入,让 AI 在感知到需要上下文时 * 主动拉取群聊最近 N 条历史消息,而不是每次收到 @ 都强行拉取。 */ import type { AnyAgentTool } from "openclaw/plugin-sdk"; import type { XgImConfig } from "./types.js"; /** 由 OpenClaw 在每回合注入的信任上下文节选(工厂模式下传入 execute 闭包) */ export type XgImToolSessionHints = { /** 对应 channels.xg_cwork_im.accounts 的 key */ channelAccountId?: string; /** 当前 IM 发消息用户 userId */ requesterSenderId?: string; }; /** 从 OpenClaw 配置中提取 xg_cwork_im 顶层配置(保留 accounts 以便多账户路由) */ export declare function extractXgCworkImConfig(cfg: unknown): XgImConfig | null; /** * 根据 accountId 解析具体账号配置。 * * - 若传入 accountId 且能解析为有效下标,则优先使用对应 accounts[accountId]。 * - 否则:有 accounts 时默认使用 accounts[0];无 accounts 时使用顶层配置。 */ export declare function resolveAccountConfig(base: XgImConfig, accountId?: string | null): XgImConfig; /** * 构建群聊历史工具对象。 * 应通过 `api.registerTool((ctx) => buildGroupHistoryTool(...))` 工厂注册,以便每回合合并 * `runtimeConfig` 与 `agentAccountId` / `requesterSenderId`(静态 `(_ctx) => tool` 会丢弃上述上下文)。 */ export declare function buildGroupHistoryTool(config: XgImConfig, hints?: XgImToolSessionHints): AnyAgentTool; //# sourceMappingURL=group-history-tool.d.ts.map