From 22010e81b7cb2ca86e3cb10e27e07e990830f965 Mon Sep 17 00:00:00 2001 From: Jesse_Chen Date: Sun, 23 Aug 2026 10:20:41 +0800 Subject: [PATCH] fix(web): keep rectification emit types compatible with next build The spoken/thinking splitter must accept sync or async emit, matching the runner input type. Co-authored-by: Cursor --- docs/BUG_HISTORY.md | 2 +- frontend/src/lib/rectification-agentic/v9/agent-run.ts | 2 +- frontend/tests/rectification-agentic-entry.test.ts | 2 ++ 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/docs/BUG_HISTORY.md b/docs/BUG_HISTORY.md index 1cdcfe1b..672e1dd3 100644 --- a/docs/BUG_HISTORY.md +++ b/docs/BUG_HISTORY.md @@ -5413,7 +5413,7 @@ - 触发条件:生时纠正已读取 Case 且工具成功后,模型把中文过程自述写进 `text-delta`。 - 根因:BUG-354 为保住正文预算关闭了纠正 provider thinking。`reasoning-delta` 不再出现,中文自述改走 `text-delta`。契约门只在 Case 未加载或工具失败时把正文改送到 `thinking.delta`;工具成功后全部当作回答。界面上思考折叠和正文也没有咨询页那种「思考 / 回复」分层。 - 修复:保持 `thinking: disabled` 与 16384 正文预算。对已加载 Case 的 `text-delta` 按段落拆成过程自述与口语结论:自述进 `thinking.delta`,结论进 `answer.delta` 并作为落盘正文。界面与咨询对齐:折叠「思考」(13px 次要色,有正文后默认收起)和完整「回复」。 -- 验证:`frontend/tests/rectification-spoken-answer.test.ts`、`frontend/tests/rectification-v9-stream.test.ts`、`frontend/tests/rectification-agentic-entry.test.ts`、`frontend/tests/chat-stream-layout.test.ts` +- 验证:`frontend/tests/rectification-spoken-answer.test.ts`、`frontend/tests/rectification-v9-stream.test.ts`、`frontend/tests/rectification-agentic-entry.test.ts`、`frontend/tests/chat-stream-layout.test.ts`;`tsc --noEmit` 通过。口语/思考拆分的 `emit` 类型必须与 `RunV9AgentTurnInput.emit` 同为 `Promise | void`,否则 Docker `next build` 会在 publish 阶段失败。 - 防复发:纠正组答不得在不拆开正文预算的情况下重开 provider thinking 来充当思考 UI。`answer.delta` 不得承载 skill/schema/batch 过程自述。思考与回复必须分层渲染,不得共用同一段正文样式。 - 相关记录:BUG-345、BUG-354、BUG-356 - 复发自:BUG-345(关 thinking 后自述改走正文)、BUG-354(纠正与咨询一并关闭 provider thinking) diff --git a/frontend/src/lib/rectification-agentic/v9/agent-run.ts b/frontend/src/lib/rectification-agentic/v9/agent-run.ts index 044d841c..a2f506cb 100644 --- a/frontend/src/lib/rectification-agentic/v9/agent-run.ts +++ b/frontend/src/lib/rectification-agentic/v9/agent-run.ts @@ -843,7 +843,7 @@ async function publishSplitSpokenAndThinking( publishedSpoken: string, answerText: string, publish: (event: PublicStreamEvent) => Promise, - emit: (event: PublicStreamEvent) => Promise, + emit: (event: PublicStreamEvent) => Promise | void, finalize = false, ): Promise<{ thinking: string; spoken: string; spokenDelta: string }> { const split = finalize diff --git a/frontend/tests/rectification-agentic-entry.test.ts b/frontend/tests/rectification-agentic-entry.test.ts index 4ff62b5f..69702469 100644 --- a/frontend/tests/rectification-agentic-entry.test.ts +++ b/frontend/tests/rectification-agentic-entry.test.ts @@ -237,6 +237,8 @@ test("usage completes or releases without hiding settlement failures", () => { assert.match(run, /thinking: "disabled"/); assert.match(run, /toPublicThinkingDelta/); assert.match(run, /splitRectificationSpokenAndThinking/); + assert.match(run, /emit\(event: PublicStreamEvent\): Promise \| void;/); + assert.match(run, /emit: \(event: PublicStreamEvent\) => Promise \| void,/); assert.match(route, /featureKey: "rectification"/); assert.match(route, /rectification:case:\$\{caseId\}/); });