Deliver file previews, dual-dock placement, and reserved delete/fs capabilities #94

Merged
weichen merged 6 commits from feature/file-preview-caps into main 2026-09-30 17:21:30 +00:00
Owner

What(预览能力实施:方案 2026-09-30-file-preview-and-reserved-capabilities,裁定 D1–D5 全落)

  1. FilePreview 能力组件(ui PR#20):md/图片/pdf/代码行号/数据等宽/二进制卡无依赖渲染;docx(mammoth)/xlsx(SheetJS 双 sheet+200 行上限)/pptx(pptx-preview 全保真) 宿主动态注入;URL 预览 OG 卡+可选内嵌;插件 registerFilePreview。
  2. /api/url-preview(backend PR#26):OG 解析 + 5s/256KB/text-html 限制 + TTL 缓存;SSRF 拨号时点逐跳校验(环回/私网/链路本地/保留段/CGNAT,防 DNS 重绑定),默认 fail-closed,错误净化不回显内网地址。
  3. fs 工具族——实现不提供(backend PR#26 + core PR#10):ToolDesc.Hidden;runtime.fsTools 未开时模型不可见、/api/tools 不列、registry.Execute fail-closed;沙箱 //,穿越/绝对路径/反斜杠/软链逃逸全拒,1MB/2MB 上限;写文件同步登记工件。
  4. 双落位(frontend PR#21):右栏"预览"页签(railPreview,边聊边看)+ DocViewer 收敛为 FilePreview 容器(弹窗深预览);chip 与工件面板行均有右栏预览动作。
  5. 删除入口回退:面板删除按钮移除;DELETE /api/artifacts/{id} 与 api.deleteArtifact 保留(插件可用)。

子仓 PR 链:core#10 / ui#20 / backend#26 / frontend#21(均已合入);本 PR 钉入组合指针(90b5747/b6be6e8/028a0ac/c5e9356/documents cb700cf)。

Evidence

  • make test 组合全绿(core 18 包/backend/frontend 33+ui 49 vitest/agentcmd);期间与 cardflow-r1、安全依赖修复、x/crypto bump 三波并行任务互斥变基并全套重验;contracts 镜像再生同步 Part.card.cardId。
  • 头链 Playwright 15/15:7 格式样例(csv/go 行号/png/pdf iframe/docx 正文/xlsx 双 sheet/pptx stage)+ 面板无删除按钮 + 7 行右栏预览动作 + 右栏页签激活与渲染 + 关弹层保留 + chip 双动作。
  • SSRF 负例(严格实例):127.0.0.1/10.0.0.1/192.168.1.1 → "安全策略拒绝";javascript: → "仅支持 http/https";/api/tools 无 fs_ 工具。
  • 主入口 +12KB;xlsx 430KB/pptx 1.2MB/jszip 98KB 均为首次预览懒加载 chunk。

Task card: .task/feature-file-preview-caps.md

## What(预览能力实施:方案 2026-09-30-file-preview-and-reserved-capabilities,裁定 D1–D5 全落) 1. **FilePreview 能力组件**(ui PR#20):md/图片/pdf/代码行号/数据等宽/二进制卡无依赖渲染;docx(mammoth)/xlsx(SheetJS 双 sheet+200 行上限)/pptx(pptx-preview 全保真) 宿主动态注入;URL 预览 OG 卡+可选内嵌;插件 registerFilePreview。 2. **/api/url-preview**(backend PR#26):OG 解析 + 5s/256KB/text-html 限制 + TTL 缓存;SSRF 拨号时点逐跳校验(环回/私网/链路本地/保留段/CGNAT,防 DNS 重绑定),默认 fail-closed,错误净化不回显内网地址。 3. **fs 工具族——实现不提供**(backend PR#26 + core PR#10):ToolDesc.Hidden;runtime.fsTools 未开时模型不可见、/api/tools 不列、registry.Execute fail-closed;沙箱 <root>/<owner>/<conversation>,穿越/绝对路径/反斜杠/软链逃逸全拒,1MB/2MB 上限;写文件同步登记工件。 4. **双落位**(frontend PR#21):右栏"预览"页签(railPreview,边聊边看)+ DocViewer 收敛为 FilePreview 容器(弹窗深预览);chip 与工件面板行均有右栏预览动作。 5. **删除入口回退**:面板删除按钮移除;DELETE /api/artifacts/{id} 与 api.deleteArtifact 保留(插件可用)。 子仓 PR 链:core#10 / ui#20 / backend#26 / frontend#21(均已合入);本 PR 钉入组合指针(90b5747/b6be6e8/028a0ac/c5e9356/documents cb700cf)。 ## Evidence - make test 组合全绿(core 18 包/backend/frontend 33+ui 49 vitest/agentcmd);期间与 cardflow-r1、安全依赖修复、x/crypto bump 三波并行任务互斥变基并全套重验;contracts 镜像再生同步 Part.card.cardId。 - 头链 Playwright 15/15:7 格式样例(csv/go 行号/png/pdf iframe/docx 正文/xlsx 双 sheet/pptx stage)+ 面板无删除按钮 + 7 行右栏预览动作 + 右栏页签激活与渲染 + 关弹层保留 + chip 双动作。 - SSRF 负例(严格实例):127.0.0.1/10.0.0.1/192.168.1.1 → "安全策略拒绝";javascript: → "仅支持 http/https";/api/tools 无 fs_ 工具。 - 主入口 +12KB;xlsx 430KB/pptx 1.2MB/jszip 98KB 均为首次预览懒加载 chunk。 Task card: .task/feature-file-preview-caps.md
weichen added 6 commits 2026-09-30 17:21:24 +00:00
weichen added 1 commit 2026-09-30 17:21:26 +00:00
Pin the preview-capability module combination
ci / test (pull_request) Failing after 1m35s
f958bfb326
weichen merged commit 2c8e1b8d57 into main 2026-09-30 17:21:30 +00:00
Sign in to join this conversation.
No Reviewers
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: weichen/Agent-System-Dev#94