From 9b327436064eb85fa6fed3f88f968e0578024fb7 Mon Sep 17 00:00:00 2001 From: Yaojia Wang Date: Wed, 8 Jul 2026 11:52:11 +0200 Subject: [PATCH] =?UTF-8?q?chore(frontend):=20gen:api=20=E7=BA=B3=E5=85=A5?= =?UTF-8?q?=20rewrite/clarify=20=E7=AB=AF=E7=82=B9=EF=BC=88WFW-9=20M2?= =?UTF-8?q?=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/web/lib/api/schema.d.ts | 99 ++++++++++++++++++++++++++++++++++++ 1 file changed, 99 insertions(+) diff --git a/apps/web/lib/api/schema.d.ts b/apps/web/lib/api/schema.d.ts index 7a46c0c..da869d7 100644 --- a/apps/web/lib/api/schema.d.ts +++ b/apps/web/lib/api/schema.d.ts @@ -180,6 +180,35 @@ export interface paths { patch?: never; trace?: never; }; + "/projects/{project_id}/chapters/{chapter_no}/rewrite/clarify": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** + * Clarify Rewrite + * @description 整章重写预检澄清(WFW-9 M2 路线A 两阶段之「问题」阶段):非流式 JSON,只判不改。 + * + * 镜像 refine 侧 clarify——只判「作者这条整章重写意见清不清楚」,含糊则反问 1 问 + 给选项, + * 清楚则给确认语放行;**绝不改正文**(整章重写仍走既有 rewrite SSE 端点)。analyst 档 + * (不变量 #2)。只取 `prior_draft` 有界摘录喂预检(不整章入 LLM)。 + * + * 项目不存在 → 404(触网关前 fail-fast,同 rewrite/draft);无凭据 → 503(dep 解析阶段拦下)。 + * **只读不写业务表**(不变量 #3);末尾 `commit()` 让网关 usage_ledger 落库(add-only,否则 + * 记账静默丢失,同 rewrite 纪律)。判别/校验失败在 `run_clarify` 内确定性回退 + * `need_clarification=false`(不阻塞整章重写主链路)。 + */ + post: operations["clarify_rewrite_projects__project_id__chapters__chapter_no__rewrite_clarify_post"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; "/projects/{project_id}/chapters/{chapter_no}/review": { parameters: { query?: never; @@ -2010,6 +2039,22 @@ export interface components { /** Draft */ draft?: string | null; }; + /** + * RewriteClarifyRequest + * @description 整章重写预检澄清:章级意见 + 可选当前草稿(WFW-9 M2 路线A 两阶段之「问题」阶段)。 + * + * 与 `RewriteStreamRequest` 独立——预检只判「作者这条章级意见清不清楚」,**不改正文** + * (整章重写仍走既有 rewrite SSE 端点)。`feedback` = 作者对整章的修改意见(触发反问的场景, + * 可极短/含糊);`prior_draft` = 当前整章草稿(可选,仅供锚定;端点只取有界摘录喂 analyst 预检, + * 不整章入 LLM)。带长度上界防超长入参。响应=`ClarifyDecision`(在 ww_agents,端点直接返回, + * 供前端 gen:api 生成强类型客户端)。 + */ + RewriteClarifyRequest: { + /** Feedback */ + feedback: string; + /** Prior Draft */ + prior_draft?: string | null; + }; /** * RewriteStreamRequest * @description POST /projects/:id/chapters/:no/rewrite:整章再沟通/重写。 @@ -2919,6 +2964,60 @@ export interface operations { }; }; }; + clarify_rewrite_projects__project_id__chapters__chapter_no__rewrite_clarify_post: { + parameters: { + query?: never; + header?: never; + path: { + project_id: string; + chapter_no: number; + }; + cookie?: never; + }; + requestBody: { + content: { + "application/json": components["schemas"]["RewriteClarifyRequest"]; + }; + }; + responses: { + /** @description Successful Response */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["ClarifyDecision"]; + }; + }; + /** @description 项目不存在 */ + 404: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["ErrorEnvelope"]; + }; + }; + /** @description Validation Error */ + 422: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["HTTPValidationError"]; + }; + }; + /** @description LLM 不可用 */ + 503: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["ErrorEnvelope"]; + }; + }; + }; + }; review_chapter_projects__project_id__chapters__chapter_no__review_post: { parameters: { query?: never;