Repository navigation
feat(agent): 流式增强 — 思考块计时、代码块补齐 + 光标、每帧合并、中断保留文字 - #227
Merged
Merged
Conversation
avabbbb
force-pushed
the
feat/agent-stream-polish
branch
from
November 19, 2026 07:42
2fd01c8 to
ac62e01
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What and why / 改了什么、为什么
流式输出更像「正在写」:看得到它在想、代码块不跳、长回答不卡、断了也不丢字。外观沿用 OfferU 现有 Token / 动画(思考高光复用
.ou-shimmer),紫色 = Agent。host.ts的thinking_delta不再丢弃,改为只在线推送的reasoning.delta(publish,不appendEvent,不进事件日志、不落盘);events.ts加reasoning.delta(及别名thinking.delta)的规范映射。只改了 emit switch 里这一个 case,没碰上下文窗口 / MAX_STEPS。AgentThinkingBlock:思考中展开、标题扫高光并按秒计时;正文一开始自动收起成「已思考 N 秒」,用户手动开合后不再自动改;完成后思考过程挂在这条回答上(仅本次会话)。closeOpenFences按 CommonMark 规则补齐未闭合的 ``` / ~~~ 围栏;AgentMarkdown streaming末尾一个紫色闪烁光标(CSS,跟在最后一段 / 最后一项 / 代码里;减少动效时不闪)。createFrameBatcher,正文 / 思考增量攒到下一帧一次setState;非增量事件先 flush 再处理,保证顺序。partialReplyFrom,Run 失败或被取消时已流出的文字留成本地消息assistant-partial-*,下方灰字说明「中断 / 失败前已经写出的部分」;不计入分叉条数(LOCAL_NOTICE_PREFIXES)。docs/design/components.md同步。怎么测的 / Testing
backend-ts: 新增「thinking 作为 live-only reasoning.delta 推送,不落盘」契约测试(SSE 里有、无 sequence / durable;事件日志里没有思考原文;思考在正文前);vitest✅ 207、typecheck✅。frontend: 新增agentStreaming.test.ts(围栏补齐各情况、每帧合并 / flush / cancel、计时文案、半截回答)、AgentThinkingBlock.test.tsx(计时、正文开始自动收起、用户开合后不自动收、完成态默认收起;流式 Markdown 补齐 + data-streaming);typecheck✅、vitest✅ 271、design:audit✅ 0 new、build✅。风险 / Risk
怎么撤回 / How to revert
revert 这个 PR;无数据变更(思考过程不落盘)。
Checklist