/** * 模块: 蓝火 / cc-media-bridge 预查询 — 真 harness 反幻觉(v6.x) * * 痛点:用户在 wecom 群问"蓝火任务",LLM hallucinate ——不调任何工具, * 拿训练数据里的 plausible task list(cc-YYYYMMDD-XXX 假 ID + 假摘要)回。 * 哪怕 SKILL 写"必调工具" + cc_task_list 已 deprecated + 响应级 redirect, * LLM 仍偶发跳过工具直接编。 * * harness 思想:**不依赖 LLM 自觉**,在 user message 进入 LLM context 前 * 检测到"蓝火 + 任务/列表/历史"模式时**强行预填**真实数据进 prependContext。 * LLM 看到 system prompt 已有 trusted 数据 → 没有"决定要不要调工具"的余地 → * 只能 copy 真数据回答 → hallucination 不可能发生。 * * 实现: * - before_prompt_build hook(同 session-recap)拿 event.prompt 做模式检测 * - 检测命中 → 用缓存的 cc-media-bridge `/cc-sessions` 数据预渲染 markdown * - 缓存 30s 后台刷新(避免每条消息都打 HTTP) * - 拒绝命中模式但 cache stale (>2.5min) 的情况——不喂 LLM 旧数据,让它走兜底(调工具或拒答) * * 红线: * - capability detection: ~/.openclaw-media-bridge 不存在则跳过整个模块 * - 零 child_process / 零 fs 写 * - 零 cc-media-bridge 代码 import(HTTP 调用,不强 require) * - dashboard_password 用 huo15.com 默认值(如用户改了,hook 拿不到,cache 留空) */ import type { OpenClawPluginApi } from "openclaw/plugin-sdk"; export declare function registerCcBridgePreFetch(api: OpenClawPluginApi): void;