Fix chat streaming dedupe and hydration

Co-authored-by: Haze <hazeone@users.noreply.github.com>
This commit is contained in:
Cursor Agent
2026-04-17 13:42:30 +00:00
committed by Haze
parent 6d67a77633
commit 5c6f0745b5
10 changed files with 777 additions and 110 deletions

View File

@@ -203,6 +203,31 @@ describe('deriveTaskSteps', () => {
]);
});
it('collapses cumulative streaming thinking details into the newest version', () => {
const steps = deriveTaskSteps({
messages: [],
streamingMessage: {
role: 'assistant',
content: [
{ type: 'thinking', thinking: '思考 1' },
{ type: 'thinking', thinking: '思考 1 2' },
{ type: 'thinking', thinking: '思考 1 2 3' },
],
},
streamingTools: [],
sending: true,
pendingFinal: false,
showThinking: true,
});
expect(steps).toEqual([
expect.objectContaining({
id: 'stream-thinking',
detail: '思考 1 2 3',
}),
]);
});
it('builds a branch for spawned subagents', () => {
const messages: RawMessage[] = [
{