From 15296bf9d889de3178f98669cc695f1e476efe93 Mon Sep 17 00:00:00 2001 From: weichen Date: Wed, 30 Sep 2026 17:46:06 +0000 Subject: [PATCH 1/8] Record the task card for feature-preview-sniff-fallback --- .task/feature-preview-sniff-fallback.md | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 .task/feature-preview-sniff-fallback.md diff --git a/.task/feature-preview-sniff-fallback.md b/.task/feature-preview-sniff-fallback.md new file mode 100644 index 00000000..196da3a7 --- /dev/null +++ b/.task/feature-preview-sniff-fallback.md @@ -0,0 +1,25 @@ +# feature/preview-sniff-fallback 任务卡 + +任务主记录:;状态:进行中;owner:weichen + +## 基线与授权 + +- 权威仓:ssh://git@git-ssh.u1680832.nyat.app:31411/weichen/Agent-System-Dev.git;目标分支:main;R0(initial_base_sha)= d64742c71c1ebb8c1c88aef4c55194510f1cdf34 +- 工作区:/home/weichen/projects/Agent-System-Dev-wt-feature-preview-sniff-fallback(worktree);分支:feature/preview-sniff-fallback +- 授权与交付终点:<本次允许的动作与终点;未授权事项写明> + +## 目标与非目标 + +<预期结果、受影响入口/模块/契约;明确不做什么。> + +## 同步记录 + +| 节点 | sync_base_sha | tested_head_sha | checked_at | +|---|---|---|---| +| 启动 | d64742c71c1ebb8c1c88aef4c55194510f1cdf34 | d64742c71c1ebb8c1c88aef4c55194510f1cdf34 | 2026-09-30T17:46:06Z | + +## 结果与验证(完成后填写) + +- 结果: +- 验证: +- 影响与剩余项: From 0b883469a2ad9f3b6b7cdb23c0ce0fb94d2d36b3 Mon Sep 17 00:00:00 2001 From: weichen Date: Wed, 30 Sep 2026 17:51:53 +0000 Subject: [PATCH 2/8] Pin preview-sniff-fallback module combination MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Why: track 2 of the fake-docx remediation — read-only preview fallback for stock text-masquerading docx artifacts; also ignore the Mimosa plugin's per-session .mimosa state dir that kept dirtying the tree and blocking precheck. Evidence: modules/ui 83367f7 (doc->binary dispatch + readable Office error), modules/frontend cd77340 (PK magic sniff + markdown fallback); make test-ui 49/49, make test-frontend 33/33, frontend tsc --noEmit clean. Impact: parent pins move to the two submodule branches; .gitignore gains .mimosa/; no code outside those modules. Refs: .task/feature-preview-sniff-fallback.md --- .gitignore | 3 +++ .task/feature-preview-sniff-fallback.md | 12 +++++++----- modules/frontend | 2 +- modules/ui | 2 +- 4 files changed, 12 insertions(+), 7 deletions(-) diff --git a/.gitignore b/.gitignore index 9904bfc5..e43709b1 100644 --- a/.gitignore +++ b/.gitignore @@ -11,3 +11,6 @@ runtime/ # ZCode CLI 会话生成的工具忽略文件(内容镜像 .gitignore,工具自动维护,不入库) .zcodeignore + +# Mimosa 安全扫描插件的逐会话状态(hook-status/reports/ledger,机器自动重建) +.mimosa/ diff --git a/.task/feature-preview-sniff-fallback.md b/.task/feature-preview-sniff-fallback.md index 196da3a7..0e6b6fb4 100644 --- a/.task/feature-preview-sniff-fallback.md +++ b/.task/feature-preview-sniff-fallback.md @@ -6,11 +6,13 @@ - 权威仓:ssh://git@git-ssh.u1680832.nyat.app:31411/weichen/Agent-System-Dev.git;目标分支:main;R0(initial_base_sha)= d64742c71c1ebb8c1c88aef4c55194510f1cdf34 - 工作区:/home/weichen/projects/Agent-System-Dev-wt-feature-preview-sniff-fallback(worktree);分支:feature/preview-sniff-fallback -- 授权与交付终点:<本次允许的动作与终点;未授权事项写明> +- 授权与交付终点:用户已批准「研发智能体文档处理与自举方案评审会议纪要.docx 解析失败」整改方案中的渲染侧兜底轨道。允许:modules/ui、modules/frontend 代码与测试、父仓 .gitignore 与 gitlink 推进、推送分支并建 PR。终点=PR 建立;合入权在所有者(不自行代签合入)。 ## 目标与非目标 -<预期结果、受影响入口/模块/契约;明确不做什么。> +- 根因:智能体经 write_artifact/fs_write_file 写出的 ".docx" 实为纯文本字节(生成侧无 OOXML 序列化),前端按扩展名派给 mammoth/JSZip 抛 "Can't find end of central directory"。本轨道只做渲染侧兜底,让存量坏文件可读、错误可解释。 +- 改动:① previewKindOf 将 `.doc`(老版二进制 Word,非 OOXML)归 binary,不再派给 mammoth;② OfficePreview 失败态文案收敛为用户可读提示(原始错误进 console);③ docxLoader 喂 mammoth 前嗅探 ZIP 魔数(PK\x03\x04),非 ZIP 按文本/markdown 回退渲染并提示;④ 父仓 .gitignore 收编 `.mimosa/`(Mimosa 插件逐会话状态目录反复弄脏树、阻塞 precheck)。 +- 非目标:不实现真正的 docx 生成(另轨道 feature/docx-generation);不动后端;不做 xlsx/pptx 的同类嗅探(它们由不同解析器路径处理,后续如出现同类报错再扩展)。 ## 同步记录 @@ -20,6 +22,6 @@ ## 结果与验证(完成后填写) -- 结果: -- 验证: -- 影响与剩余项: +- 结果:已实现四项——@ui previewKindOf 将 `.doc` 归 binary(ui 83367f7);OfficePreview 失败态收敛为可读提示、原始错误进 console(同提交);frontend docxLoader 喂 mammoth 前嗅探 ZIP 魔数,非 ZIP 按文本/markdown 回退渲染(frontend cd77340);父仓 .gitignore 收编 `.mimosa/`。存量伪 docx(如「研发智能体文档处理与自举方案评审会议纪要.docx」)预览即恢复可读。 +- 验证:make test-ui(tsc --noEmit 通过 + vitest 49/49,含新增 `.doc→binary` 与错误提示两条断言);make test-frontend(vitest 33/33);frontend npx tsc --noEmit 单独复核通过。真值复现依据:JSZip.loadAsync 对纯文本字节抛出与用户截图逐字一致的报错(排查阶段已复现)。 +- 影响与剩余项:渲染层兜底不改契约;根因(生成侧无 OOXML 序列化)由兄弟任务 feature/docx-generation 处理,其合入前新产出的 .docx 仍为文本(但预览已可读不报错)。 diff --git a/modules/frontend b/modules/frontend index c5e93568..cd77340d 160000 --- a/modules/frontend +++ b/modules/frontend @@ -1 +1 @@ -Subproject commit c5e93568a5475ef4817d2ca5f3dbe3202d1a796c +Subproject commit cd77340d92bb6f89c5ed74e598129b683c0abff8 diff --git a/modules/ui b/modules/ui index b6be6e89..83367f7c 160000 --- a/modules/ui +++ b/modules/ui @@ -1 +1 @@ -Subproject commit b6be6e89ef97e6688f6dcf234e3e9102ad90ca67 +Subproject commit 83367f7c8171bc177c4cecc0913c237bf83019d6 From af13fbadf8e8cac8f826e69434750723fc3e547a Mon Sep 17 00:00:00 2001 From: weichen Date: Wed, 30 Sep 2026 17:51:59 +0000 Subject: [PATCH 3/8] Record the sync checkpoint --- .task/feature-duplication-lesson-records.md | 1 + 1 file changed, 1 insertion(+) diff --git a/.task/feature-duplication-lesson-records.md b/.task/feature-duplication-lesson-records.md index a664f94f..d031e14e 100644 --- a/.task/feature-duplication-lesson-records.md +++ b/.task/feature-duplication-lesson-records.md @@ -52,3 +52,4 @@ | 同步前验收 | 9f2a7fb4b806bb63f43c3ee759bdbb1ab1f97720 | 21a92441dce7787b8c3eaeaf731aad9a58215836 | 2026-09-30T16:49:57Z | | 同步前验收 | bb7f541d42dc6bd2609e59fed6760f22ed5c213e | dcb5bc0f727b5ceaf95b73b5ea514e63d9a89ae0 | 2026-09-30T17:17:46Z | | 同步前验收 | 978dc80817e7240f0a45a390ed2a6334041e84dd | 4eec51a954c1271729a3659544eb891f0181d8c2 | 2026-09-30T17:19:17Z | +| 同步前验收 | d64742c71c1ebb8c1c88aef4c55194510f1cdf34 | 0b883469a2ad9f3b6b7cdb23c0ce0fb94d2d36b3 | 2026-09-30T17:51:59Z | From c6b243b766f9a051f99066d9c92d6fcccc901995 Mon Sep 17 00:00:00 2001 From: weichen Date: Wed, 30 Sep 2026 18:10:55 +0000 Subject: [PATCH 4/8] Record the sync checkpoint --- .task/feature-duplication-lesson-records.md | 1 + 1 file changed, 1 insertion(+) diff --git a/.task/feature-duplication-lesson-records.md b/.task/feature-duplication-lesson-records.md index d031e14e..d79a1e96 100644 --- a/.task/feature-duplication-lesson-records.md +++ b/.task/feature-duplication-lesson-records.md @@ -53,3 +53,4 @@ | 同步前验收 | bb7f541d42dc6bd2609e59fed6760f22ed5c213e | dcb5bc0f727b5ceaf95b73b5ea514e63d9a89ae0 | 2026-09-30T17:17:46Z | | 同步前验收 | 978dc80817e7240f0a45a390ed2a6334041e84dd | 4eec51a954c1271729a3659544eb891f0181d8c2 | 2026-09-30T17:19:17Z | | 同步前验收 | d64742c71c1ebb8c1c88aef4c55194510f1cdf34 | 0b883469a2ad9f3b6b7cdb23c0ce0fb94d2d36b3 | 2026-09-30T17:51:59Z | +| 同步前验收 | f65d89e59b6974c7a5db63be0677d192bfaa7e9c | 7ababf2a5420ab6047212ca86403314ee619fb99 | 2026-09-30T18:10:55Z | From 244eea93c9595cd05a8b92d81fbea669dbcbad4a Mon Sep 17 00:00:00 2001 From: weichen Date: Wed, 30 Sep 2026 18:11:21 +0000 Subject: [PATCH 5/8] Record the PR links in the task card --- .task/feature-preview-sniff-fallback.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.task/feature-preview-sniff-fallback.md b/.task/feature-preview-sniff-fallback.md index 0e6b6fb4..0082a3e5 100644 --- a/.task/feature-preview-sniff-fallback.md +++ b/.task/feature-preview-sniff-fallback.md @@ -1,6 +1,6 @@ # feature/preview-sniff-fallback 任务卡 -任务主记录:;状态:进行中;owner:weichen +任务主记录:Dev PR #96 https://git-home.u1680832.nyat.app:30319/weichen/Agent-System-Dev/pulls/96(子仓:UI PR #21、Frontend PR #22);状态:进行中;owner:weichen ## 基线与授权 From 89481a6ee3c9bf9dcdba4edede12f9163d738ad5 Mon Sep 17 00:00:00 2001 From: weichen Date: Thu, 1 Oct 2026 04:07:21 +0000 Subject: [PATCH 6/8] Advance preview sniff gitlinks onto current module mains Why: the open preview-sniff PRs were cut before the shell redesign, so they could not merge. UI and Frontend now contain origin/main plus the ZIP sniff, including xlsx and pptx text fallback. Evidence: UI vitest 68 and tsc clean; Frontend vitest 40 and tsc clean. UI pulls/21 and Frontend pulls/22 updated. Impact: gitlinks only. Dev still needs to merge origin/main before the parent PR can land. Refs: task feature/preview-sniff-fallback Co-authored-by: Cursor --- modules/frontend | 2 +- modules/ui | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/frontend b/modules/frontend index cd77340d..bfa634d2 160000 --- a/modules/frontend +++ b/modules/frontend @@ -1 +1 @@ -Subproject commit cd77340d92bb6f89c5ed74e598129b683c0abff8 +Subproject commit bfa634d2a991523376302eb4f9479b0fa1df1c1c diff --git a/modules/ui b/modules/ui index 83367f7c..e0828892 160000 --- a/modules/ui +++ b/modules/ui @@ -1 +1 @@ -Subproject commit 83367f7c8171bc177c4cecc0913c237bf83019d6 +Subproject commit e0828892000406da4211c0a9e37a7c8b89a048d9 From 5f9b33ae22d78eba37e9c314dc31777e8c2033bb Mon Sep 17 00:00:00 2001 From: weichen Date: Thu, 1 Oct 2026 04:08:34 +0000 Subject: [PATCH 7/8] Record the preview sniff sync and xlsx fallback Why: the task card still described xlsx/pptx sniff as out of scope, and the combo test had not been written down after the merge. Evidence: make test passed on a11fed4 (frontend 40, ui 68). Impact: task card only. Refs: Dev PR #96 Co-authored-by: Cursor --- .task/feature-preview-sniff-fallback.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.task/feature-preview-sniff-fallback.md b/.task/feature-preview-sniff-fallback.md index 0082a3e5..a28abf6c 100644 --- a/.task/feature-preview-sniff-fallback.md +++ b/.task/feature-preview-sniff-fallback.md @@ -12,7 +12,7 @@ - 根因:智能体经 write_artifact/fs_write_file 写出的 ".docx" 实为纯文本字节(生成侧无 OOXML 序列化),前端按扩展名派给 mammoth/JSZip 抛 "Can't find end of central directory"。本轨道只做渲染侧兜底,让存量坏文件可读、错误可解释。 - 改动:① previewKindOf 将 `.doc`(老版二进制 Word,非 OOXML)归 binary,不再派给 mammoth;② OfficePreview 失败态文案收敛为用户可读提示(原始错误进 console);③ docxLoader 喂 mammoth 前嗅探 ZIP 魔数(PK\x03\x04),非 ZIP 按文本/markdown 回退渲染并提示;④ 父仓 .gitignore 收编 `.mimosa/`(Mimosa 插件逐会话状态目录反复弄脏树、阻塞 precheck)。 -- 非目标:不实现真正的 docx 生成(另轨道 feature/docx-generation);不动后端;不做 xlsx/pptx 的同类嗅探(它们由不同解析器路径处理,后续如出现同类报错再扩展)。 +- 非目标:不实现真正的 docx 生成;不动后端。xlsx/pptx 的 ZIP 嗅探已在本分支补上(2026-10-01);老版 .xls/.ppt 仍走原解析器。 ## 同步记录 @@ -22,6 +22,6 @@ ## 结果与验证(完成后填写) -- 结果:已实现四项——@ui previewKindOf 将 `.doc` 归 binary(ui 83367f7);OfficePreview 失败态收敛为可读提示、原始错误进 console(同提交);frontend docxLoader 喂 mammoth 前嗅探 ZIP 魔数,非 ZIP 按文本/markdown 回退渲染(frontend cd77340);父仓 .gitignore 收编 `.mimosa/`。存量伪 docx(如「研发智能体文档处理与自举方案评审会议纪要.docx」)预览即恢复可读。 -- 验证:make test-ui(tsc --noEmit 通过 + vitest 49/49,含新增 `.doc→binary` 与错误提示两条断言);make test-frontend(vitest 33/33);frontend npx tsc --noEmit 单独复核通过。真值复现依据:JSZip.loadAsync 对纯文本字节抛出与用户截图逐字一致的报错(排查阶段已复现)。 -- 影响与剩余项:渲染层兜底不改契约;根因(生成侧无 OOXML 序列化)由兄弟任务 feature/docx-generation 处理,其合入前新产出的 .docx 仍为文本(但预览已可读不报错)。 +- 结果:UI e082889(含 origin/main 与 `.doc`→binary、Office 错误文案收敛);Frontend bfa634d(docx/xlsx/pptx 非 ZIP 按文本回退,.xls/.ppt 除外);父仓 .gitignore 含 `.mimosa/`。分支已并入 origin/main(a11fed4)。 +- 验证:合并后 UI vitest 68、Frontend vitest 40,两边 tsc 通过。Dev `make test` 通过(core、backend、frontend 40、ui 68、agent-command,2026-10-01)。 +- 影响与剩余项:伪 Office 文件预览可读。生成侧执行器在 feature/exec-interpreters,不在本 PR。合入顺序:UI #21 → Frontend #22 → Dev #96。 From 6b5da25f89e7c1d6315d14f270fced2cc8ca2179 Mon Sep 17 00:00:00 2001 From: weichen Date: Thu, 1 Oct 2026 05:20:28 +0000 Subject: [PATCH 8/8] Record the sync checkpoint --- .task/feature-duplication-lesson-records.md | 1 + 1 file changed, 1 insertion(+) diff --git a/.task/feature-duplication-lesson-records.md b/.task/feature-duplication-lesson-records.md index ede628f4..21dcb903 100644 --- a/.task/feature-duplication-lesson-records.md +++ b/.task/feature-duplication-lesson-records.md @@ -58,3 +58,4 @@ | 同步前验收 | 3108a27be8195bffbf3f647a996a952dba73a142 | 6b78db5977508c819e29cddf66768c08fd93a97a | 2026-09-30T19:31:01Z | | 同步前验收 | 4c4071e5d8e256dd8f82ba9c74efa1effd1e9df3 | d62f6806d2ac19d8f069340c0dc8158e5f38983c | 2026-10-01T04:04:49Z | | 同步前验收 | 4c4071e5d8e256dd8f82ba9c74efa1effd1e9df3 | eb33d7b76ad9f0c9f62918b9c4ea24dab1534441 | 2026-10-01T04:59:18Z | +| 同步前验收 | 76b2fb35a99e0847fff832b4e14e5766ea474c4e | 62d39037afafc98a6bbad3689cf479a299bc4ad8 | 2026-10-01T05:20:28Z |