From c69e613c97f63985dcc2ce9feedbff0ee0274df1 Mon Sep 17 00:00:00 2001 From: Yaojia Wang Date: Wed, 8 Jul 2026 08:49:58 +0200 Subject: [PATCH] =?UTF-8?q?docs:=20=E7=99=BB=E8=AE=B0=20WFW-9=20M1=20AI=20?= =?UTF-8?q?=E5=8F=8D=E9=97=AE=E6=BE=84=E6=B8=85=E2=80=94=E2=80=94=E5=A5=91?= =?UTF-8?q?=E7=BA=A6=20C-Clarify=20+=20PROGRESS=20=E5=8F=B0=E8=B4=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit memory/contracts.md 立 C-Clarify(POST .../refine/clarify + ClarifyDecision,非流式结构化, analyst,只读,既有 refine 未改,无迁移);PROGRESS 加 WFW-9 M1 行(✅),标注 M2/M3 待办。 --- PROGRESS.md | 1 + memory/contracts.md | 2 ++ 2 files changed, 3 insertions(+) diff --git a/PROGRESS.md b/PROGRESS.md index daf76f4..d6216ca 100644 --- a/PROGRESS.md +++ b/PROGRESS.md @@ -60,6 +60,7 @@ | WFW-6 侧栏 IA 收敛(ContextDrawer) | ✅ | @frontend | — | #7 | `3dd7d28` 加法式 ContextDrawer 右侧速查抽屉 + 底栏「速查」按钮;设定库/大纲**完整只读速查**,伏笔/规则/文风**摘要+跳全宽页**(后续可补真实数据)。`CONTEXT_DRAWER_ENABLED` 一键回滚、旧侧栏/全宽页路由全保留 | | WFW-7 首次 AI 写作前极轻 genre 采集 + 无大纲降级 | ✅ | @frontend | WFW-0 | — | `3dd7d28` 无题材首次写章前弹 GenrePicker(临时并入本次 directive 不落库) + chapters 空时「尚无大纲,将按设定自由生成」提示,杜绝无题材 slop | | WFW-8 整章级「再沟通/重写」(对话式迭代) | ✅ | @backend·@llm·@frontend | — | 新#1 | `6ed9c89`(后端)+`542c2ab`(前端)。后端 SSE `POST .../rewrite`(`rewrite.md` 教条 + `rewrite_node` + `RewriteStreamRequest`,复用 assemble 记忆注入,只读不写库、工具非写节点、守 #3/#7/#9);前端 `useChapterRewrite`(版本栈)+`ChapterRewritePanel`+底栏「整章重写」:给意见→流式重写整章→多轮迭代→接受某版才替换正文(HITL)。契约 C-Rewrite。用户反馈「整章不满意要跟 AI 交流」 | +| WFW-9 M1 AI 反问澄清(refine 侧,路线A 两阶段) | ✅ | @backend·@llm·@frontend | — | 新#2 | `1652ad9`(后端)+`e30c933`(前端)。多agent并行(后端整片‖ChoiceChips)+主线集成。非流式预检 `POST .../refine/clarify`→`ClarifyDecision`(结构化,analyst,只读,失败回退放行)+clarify_refine spec/教条(SPECS#24);既有 refine 未改。前端 `useClarify`+`ChoiceChips`+`clarify.ts`(foldClarifications/门控)+RefinePanel 门控接线:意见<10字或点「帮我理清方向」→AI反问选项→折答案进instruction→走既有refine。契约 C-Clarify。**M2 rewrite 侧两阶段 + M3 UX/E2E 待办**。调研计划见 scratchpad/clarify-dialogue-DEVPLAN.md(ephemeral) | --- diff --git a/memory/contracts.md b/memory/contracts.md index bd6a36e..d4372b3 100644 --- a/memory/contracts.md +++ b/memory/contracts.md @@ -369,3 +369,5 @@ - [2026-07-06] @frontend 前端依赖新增(灵感⑥ 关系图谱缩减版 / D4,**无后端契约变更、无 gen:api、无迁移**):`apps/web/package.json` 加 `@xyflow/react@^12.11.2`(React Flow,MIT,peer react>=17 兼容 R19)+ `@dagrejs/dagre@^3.0.0`(一次性初始布局,自带 TS 类型)。`pnpm install` 后 `pnpm-workspace.yaml` 被 pnpm 自动追加 `minimumReleaseAgeExclude`(@xyflow/react/@xyflow/system 供应链豁免)+ `pnpm-lock.yaml` 更新。新增 `lib/characters/graphLayout.ts`(纯逻辑:角色+relations→节点/边+dagre 布局,仅用现有 `CharacterCardView.relations={name,kind,note}`——**边按 name-join、kind 作中文标签、节点按 role 上色,无 closeness/阵营**,悬空边跳过并计数)+ `components/characters/RelationshipGraph.tsx`(`'use client'`,经 CodexPage `dynamic(ssr:false)` 加载,显式容器高度 + import RF CSS + prefers-reduced-motion 关 fitView 动画 + 纸感配色)。消费方:无(叶子特性,挂在设定库人物 tab)。 - [2026-07-07] @backend/@llm/@frontend 立 C-Rewrite(WFW-8 整章再沟通/重写):新增 **`POST /projects/{project_id}/chapters/{chapter_no}/rewrite`**(SSE,text/event-stream,复用 token/done/error 帧契约)← `RewriteStreamRequest{feedback:str(1..4000), prior_draft:str(1..200000)}` → 流式重写整章一版。实现:`prompts/rewrite.md` 教条(非 SPEC,仿 write_craft 经 `load_prompt` 读盘,`test_prompt_loader` doctrine 排除集加 `rewrite`)+ `orchestrator/rewrite_node.py`(`build_rewrite_request` 纯函数 system=[rewrite教条,stable_core] cache 前缀 / input=近况+当前草稿+作者意见 断点后,守不变量 #9;`stream_chapter_rewrite`)+ 端点复用 `assemble()` 记忆注入 + `normalize_deltas`。**只读不写库**(HITL:新版停前端,接受才落,不变量 #3)、**工具非写节点**(不破坏 章=f(outline,state) 纯函数,不变量 #7)、项目不存在触网关前 404。**无 DDL/无迁移**。门禁绿:ruff/mypy(224)/pytest(+test_rewrite_node 5 例)/alembic 无漂移。→ 影响 @frontend(已 `pnpm gen:api`;`useChapterRewrite` SSE hook + `ChapterRewritePanel` 版本栈 + Workbench「整章重写」入口)。 + +- [2026-07-08] @backend/@llm/@frontend 立 C-Clarify(WFW-9 M1 refine 侧 AI 反问澄清,路线A 两阶段):新增 **`POST /projects/{project_id}/chapters/{chapter_no}/refine/clarify`**(**非流式** JSON 预检)← `RefineClarifyRequest{segment:str(1..20000), instruction:str(默认"",0..2000)}` → **`ClarifyDecision`**{need_clarification:bool, questions:[ClarifyQuestion{question, options:[ClarifyOption{label,value}](0..4), allow_free_text:bool}](0或1,v1硬上限1问), verification:str|null}。tier=**analyst**,结构化输出(instructor),**只读不写库**(末尾 commit 仅记 usage_ledger,不变量 #3);判别/校验失败**确定性回退 need_clarification=false**(放行)。`ClarifyDecision` 定义在 `ww_agents`(供 producer+端点共用),注册 `clarify_refine_spec`(SPECS #24)+SCHEMA_CATALOG+金标准。**既有 `POST .../refine`(RefineRequest/RefineResponse)完全未改**。→ 影响 @frontend(已 gen:api;`useClarify` 映射 snake→VM + `ChoiceChips` 选项芯片 + `RefinePanel` 门控预检:意见<10字或点按钮→预检→needClarification 则渲染选项→答案 foldClarifications 折进 instruction→走既有 refine)。**无 DDL/无迁移**。门禁绿:后端 ruff/mypy227/pytest900/alembic;前端 tsc/lint/vitest654/build/cov95.36%。M2(rewrite 侧两阶段)/M3(UX+E2E) 待办。