Author SHA1 Message Date
weichen cdb6ba0d9d Record the PR links in the task card
ci / test (pull_request) Failing after 31s
2026-09-30 18:11:39 +00:00
weichen e85cf1498b Record the combined acceptance evidence
ci / test (pull_request) Failing after 1m6s
2026-09-30 18:10:08 +00:00
weichen e37690be0c Record the sync checkpoint 2026-09-30 18:08:49 +00:00
weichen 75b34699d8 Merge remote-tracking branch 'origin/main' into feature/docx-generation 2026-09-30 18:08:49 +00:00
weichen 78d521165d Fill in docx-generation task card results 2026-09-30 18:08:48 +00:00
weichen d5c6da29ba Pin the docx-generation module combination
Why: track 1 of the fake-docx remediation — generation-side root cause:
real OOXML serialization for Word deliverables plus guards against
pseudo-binary writes.

Evidence: modules/backend e2efe12; go vet clean, go test ./... 18 packages
pass (magic sniff, ingest roundtrip, write_artifact format dispatch,
pseudo-binary guards, fs guard, schema exposure).

Impact: parent pin advances to the backend branch; no other module touched.

Refs: .task/feature-docx-generation.md
2026-09-30 18:08:19 +00:00
weichen 067138bd41 Record the task card for feature-docx-generation 2026-09-30 17:53:52 +00:00
2 changed files with 30 additions and 1 deletions
+29
View File
@@ -0,0 +1,29 @@
# feature/docx-generation 任务卡
任务主记录:Dev PR #99 https://git-home.u1680832.nyat.app:30319/weichen/Agent-System-Dev/pulls/99(子仓:Backend PR #27);状态:进行中;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-docx-generation(worktree);分支:feature/docx-generation
- 授权与交付终点:用户已批准「会议纪要.docx 解析失败」整改方案的生成侧根治轨道(兄弟任务 feature/preview-sniff-fallback 已先行建 PR)。允许:modules/backend 代码与测试、父仓 gitlink 推进、推送分支并建 PR。终点=PR 建立;合入权在所有者。
## 目标与非目标
- 根因:write_artifact/fs_write_file 只收字符串参数,模型物理上无法经 JSON 字符串产出 ZIP 容器;系统却把 docx 当一等交付格式宣传(mock HITL 选项),产出的 ".docx" 全是文本冒充,前端 mammoth/JSZip 预览必炸。
- 改动:① 新增 internal/tools/docx.go 最小 OOXML 序列化器 MarkdownToDocx(标题/段落/列表/**加粗**/XML 转义,产出可被 ingest.parseDocx 往返解析);② write_artifact 增加 format 参数(md 默认/docx),name 以 .docx 结尾自动序列化,MIME 用 extMIME 口径;③ 写侧护栏:xlsx/pptx/doc/xls 等无序列化路径的二进制 Office 扩展在 write_artifact 与 fs_write_file 双双拒绝(明示引导 docx 或 .md);④ runmgr.WriteArtifact 知识索引改走 indexTextOf:二进制内容先经 ingest 抽文本,抽不出则跳过索引(不再把二进制垃圾灌知识库);⑤ mock #doc 演示在用户点名 docx/word 时走真实序列化路径,HITL 选项文案与真实能力对齐。
- 非目标:不做 md 表格→docx 表格(ingest.parseMarkdown 尚不解析 md 表格,序列化端不做走不到的分支,随 ingest 表格解析一并补);不支持 xlsx/pptx 生成;不动前端(兄弟任务已兜底)。
## 同步记录
| 节点 | sync_base_sha | tested_head_sha | checked_at |
|---|---|---|---|
| 启动 | d64742c71c1ebb8c1c88aef4c55194510f1cdf34 | d64742c71c1ebb8c1c88aef4c55194510f1cdf34 | 2026-09-30T17:53:52Z |
## 结果与验证(完成后填写)
- 结果:五项改动全部落地(backend internal/tools/docx.go 新增,registry.go/fs.go/runmgr.go/mock.go 修改)。从此系统能产出真实 docx:PK 魔数 ZIP 容器、word/document.xml、pStyle HeadingN(与 ingest 解析约定一致)。
- 验证:go vet(tools/runmgr/runtime)通过;go test ./... 18 包全过零失败,其中新增 docx_test.go 覆盖:ZIP 魔数、ingest 往返(标题层级/转义字符还原/**不泄漏/列表前缀)、write_artifact format 分派与三拒绝路径(伪二进制/data+docx 冲突/未知 format)、fs_write_file 护栏、schema 暴露 format。负向复现依据(排查阶段):JSZip.loadAsync 对文本字节抛出与用户截图逐字一致的报错。
- 验收(make test @ 75b34699d8,含 f65d89e 同步):core 1 包 + backend 18 包 + frontend vitest 33/33 + ui tsc+vitest 49/49 + agent-command 2 包,exit=0(2026-09-30T18:09Z)。
- 影响与剩余项:write_artifact 工具契约新增可选 format 参数(向后兼容,省略即旧行为+docx 名自动升级);fs_write_file 对二进制 Office 扩展由"静默产出伪文件"变为"显式拒绝"(行为变化,属修复)。剩余:md 表格支持(记录于非目标);存量伪 docx 工件由渲染侧 PR(UI#21/Frontend#22)兜底可读。
| 同步前验收 | f65d89e59b6974c7a5db63be0677d192bfaa7e9c | 75b34699d8e85b563e667c6c7d175151aec86150 | 2026-09-30T18:08:49Z |