Repository navigation
feat(files): 支持机器人单聊收文件及原会话回传文件和图片 - #26
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
用户影响
机器人单聊收到文件时,过去会提示不支持;现在会下载到当前会话工作区,并将文件名称、大小和可读取的本地路径交给模型。模型可以通过会话专属
send_file/send_image工具,将生成或修改的文件、图片回传原单聊或群聊。Fixes #18
实现
file消息,保留去重和授权检查;只接受平台支持的机器人单聊文件。授权通过后才下载,缺失下载码不会伪造附件。robot/messageFiles/download获取临时链接,下载不携带应用 Token 或额外 Content-Type;按响应头和实际流限制 20 MB,下载码、签名链接和原始接口错误不进入新增日志。/cd选定的会话工作区下按账号、会话和随机接收目录隔离附件。规范化文件名、拒绝 inbox 符号链接、独占创建文件,保留同名附件而不覆盖。sampleFile;图片使用官方sampleImageMsg的photoURL参数。单聊走robot/oToMessages/batchSend,群聊走robot/groupMessages/send,不引入工作通知或 AgentId。accepted和processQueryKey表示接口接受请求,不宣称客户端送达;业务错误或超时不自动重发。凭据请求也接受取消信号。/stop打断前一任务。验证
基线:
ada4d0ffcf6b7b94ce86805af59522de1f5d8c33。最终提交:7ae8216b43ec7c7939499ab30d4ee91707e486ab。本地 macOS,Node26.4.0/ pnpm11.7.0。corepack pnpm install --frozen-lockfileTMPDIR=<受控短路径> corepack pnpm run ci/cd后落盘、模型引用、原会话回传、失败提示、排队与问答保护DSH_SMOKE_NODE_MODULES=<隔离安装树>/node_modules node scripts/smoke-agent-setup.mjs0.2.0-rc.2,创建、恢复、已加载补装、重复安装、setup 回滚重试;包含新增文件工具DSH_SMOKE_NODE_MODULES=<隔离安装树>/node_modules node scripts/smoke-workspace.mjsgit diff --check7ae8216b43ec7c7939499ab30d4ee91707e486ab的 CI #37903828237 全部 8 项成功,含 Linux/macOS/Windows 完整套件及 3 个 DSH 安装/宿主检查本地首次完整套件使用工作区内较长的 TMPDIR,出现 29 项失败。相同环境下干净 main 为 274/303、同样 29 项失败,失败集合完全一致:包括 Unix socket 路径过长和临时 CLI fixture 继承
type: module。改用预先创建的受控短路径、显式 CommonJS fixture 根目录后,首次为 314/315,既有“多个 waiter 回收死进程锁”用例失败;未修改该文件锁实现或用例,后续完整套件 315/315 通过。补齐取消/问答保护后最终套件 318/318 通过。早期失败保留,不计作通过。首轮 GitHub CI 的 macOS 套件为 316/318:两个新增断言未对
/var与/private/var做规范路径比较,附件实际已正确落盘。已修正断言,同时让发送工具接受当前工作区的所选绝对路径及规范路径,并增加目录别名/junction 回归;最终提交本地完整套件 318/318 和真实宿主 smoke 均通过。首轮云端失败记录保留,最终云端结果以上表为准。平台限制与风险
官方依据:接收文件下载、机器人消息类型、上传媒体文件。