fix(web): keep composer enabled while generating and treat stop as neutral (BUG-551, BUG-552)

Enter now queues one follow-up instead of dropping it, and a rectification stop leaves the streamed reply with a grey notice instead of an error alert.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Jesse_Chen
2026-09-06 13:08:43 +08:00
parent f5566c06ef
commit 055b7adca9
18 changed files with 534 additions and 74 deletions
@@ -0,0 +1,39 @@
# PROGRESS · 生成中输入框可打字、排队发送、停止中性态(2026-09-06)
工作树:`.worktrees/composer-live-input-and-stop-20260906`
分支:`codex/composer-live-input-and-stop-20260906`
基线:任务书写 `origin/staging` @ `b8ea3112`;开工时 `origin/staging` 已到 `d2a209d3`(后续任务书文档),以当时远端为准。
`page.tsx` 收尾 2040 行(上限 2041)。未改服务端、未改 `.gitea/workflows/**`、未 bump Skill。
| 任务 | 状态 | BUG |
| --- | --- | --- |
| 5.1 输入框不再禁用 + 排队发送 | 完成 | BUG-551 |
| 5.2 停止 = 中性状态 | 完成 | BUG-552 |
| 5.3 BUG_HISTORY / CHANGELOG / DESIGN / VOICE | 完成 | — |
## 实现要点
- 共用 `queued-draft.ts` + `useQueuedMessage`。主咨询在 `useConsultationRun` 里结算排队;校正在 `busy` 下降后按 `lastRunOutcome` 发送或放回。
- `ChatComposer` 增加可选 `queued` 卡片;textarea 只接受结构性 `inputDisabled`
- 校正 `AbortError`:气泡 `stopped`,灰字 `RECTIFICATION_STOPPED_NOTICE`,不再 `setError`。选择题 / 采用 fetch 挂 `runAbort`
- 发送键在有排队时禁用。停止后不抢焦点;撤回才聚焦。
## 既有断言改动
| 文件 | 原值 | 新值 | 原因 |
| --- | --- | --- | --- |
| `rectification-surface-contract` | `if (raw.trim()) setError(RECTIFICATION_STOPPED_NOTICE)` | 气泡 `stopped` + `stoppedNotice`,无 setError | 停止不能穿报错衣服(BUG-552) |
| `rectification-agentic-entry` | `caught.name === "AbortError"` | `isAbortError(caught)` | 选择题与采用共用中止判定 |
| `chat-notice-and-scroll-contract` | 未改断言正文 | `JumpToLatestButton` 仍保持原多行 JSX | 曾误压成一行导致 `sourceBetween` 找不到 |
## 测试
| 命令 | 结果 |
| --- | --- |
| `npx tsx --test tests/chat-composer-queue.test.ts tests/composer-*.test.ts tests/chat-notice-and-scroll-contract.test.ts tests/rectification-surface-contract.test.ts tests/rectification-agentic-entry.test.ts tests/agent-voice-copy-contract.test.ts` | 81 项 pass 81 fail 0 |
| `./node_modules/.bin/tsc --noEmit` | 0 错 |
| 改动文件 eslint `--quiet` | 0 error |
| `tests/class-name-definition-contract.test.ts` | 3/3 |
| `page.tsx` | 2040 行 |
| `npm run build -- --webpack` | 编译通过;随后在既有 `dossierResponse` 路由导出类型上失败,与本次无关 |