/** * 模块: 大文件上传桥接 (v6.x) * * 作用: IM 渠道对文件传输有大小上限(企微聊天 100MB / 钉钉 20MB / 飞书 30MB), * 用户发超限文件时渠道返回纯文本错误(如企微的 "视频/文件超过100M,无法下载")。 * 本模块检测该错误 + 用户主动提大文件上传的意图, * 通过 before_prompt_build 注入上传链接引导,并提供 enhance_upload_large_file 工具。 * * 非侵入式保证: * - 纯 hook 观察 (before_prompt_build) + 按需工具 * - 只在 IM 渠道激活,不影响 terminal 等其他渠道 * - 不修改 wecom/dingtalk/feishu 插件的任何逻辑 * - 上传端点通过 dashboard HTTP route 暴露,不新增进程 * * 与 bot-share-link 的边界: * - bot-share-link: 把本地文件投递到 share 目录 → 生成下载 URL(agent 主动调用) * - large-file-bridge: 检测渠道大小错误/大文件意图 → 注入上传链接引导(自动 hook)+ 提供上传表单 */ import type { OpenClawPluginApi } from "openclaw/plugin-sdk"; export interface LargeFileBridgeConfig { enabled?: boolean; /** * 自定义上传页面 URL;不填则自动生成为 `${baseUrl}/upload`(v6.7.6 起最短 URL)。 * * 历程: * v6.7.4: 改 /lanhuo/upload 避免 LLM 把 /lanhuo 当上传链接误用 * v6.7.6: cc-media-bridge v2.18.9 已 native 支持 /upload 短 URL(_lanhuo_strip 让 /upload 直命中) * 用户原话:"能不能换成 https://keepermac.huo15.com/upload" → 改最短 URL * /lanhuo/upload 仍兼容(等价 alias) */ uploadUrl?: string; /** 上传页面基础 URL(IM 分享场景需显式填公网地址) */ baseUrl?: string; /** 检测渠道大文件错误文本(企微 100M / 钉钉 20M / 飞书 30M),默认 true。旧名 detectWecomError 仍兼容 */ detectChannelError?: boolean; /** 兼容旧配置:detectWecomError === false 等价于 detectChannelError === false */ detectWecomError?: boolean; /** 用户提大文件/上传相关关键词时主动提供上传链接,默认 true */ proactiveOffer?: boolean; } export declare function registerLargeFileBridge(api: OpenClawPluginApi, config?: LargeFileBridgeConfig): void;