π€― LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.
TypeScript agentagent-collaborationagent-harnessloop-engineeringmcppersonal-assistantproactive-agentskillssuper-agenttask-management
π fix(cc-adapter): emit reasoning chunk before text in batch mode (#15289)
LiJian1024ee961bcc
diff --git a/packages/heterogeneous-agents/src/adapters/claudeCode.ts b/packages/heterogeneous-agents/src/adapters/claudeCode.tsindex 9732099e2e7..249a31ff1d2 100644--- a/packages/heterogeneous-agents/src/adapters/claudeCode.ts+++ b/packages/heterogeneous-agents/src/adapters/claudeCode.ts@@ -741,12 +741,17 @@ export class ClaudeCodeAdapter implements AgentEventAdapter {reasoningParts.join(''),this.streamedThinkingByMessageId,);- if (textCompletion) {- events.push(this.makeChunkEvent({ chunkType: 'text', content: textCompletion }));- }+ // Emit reasoning before text so the gateway event handler starts the+ // reasoning operation first β matching Claude's natural output order+ // (thinking β response). Without this, batch-mode runs (CLI / sandbox+ // without --include-partial-messages) emit text first, causing the+ // brain icon to appear below the already-rendered text content.if (thinkingCompletion) {events.push(this.makeChunkEvent({ chunkType: 'reasoning', reasoning: thinkingCompletion }));}+ if (textCompletion) {+ events.push(this.makeChunkEvent({ chunkType: 'text', content: textCompletion }));+ }if (messageId) {this.clearStreamedBuffers(messageId, {thinking: reasoningParts.length > 0,@@ -838,20 +843,21 @@ export class ClaudeCodeAdapter implements AgentEventAdapter {// `messagesWithStreamedText` (unlike the main-agent path) because// subagent events don't arrive via `stream_event` partial-messages// deltas; the full block IS the only emission.- if (textParts.length > 0) {+ // Reasoning before text β same ordering fix as the main-agent batch path.+ if (reasoningParts.length > 0) {events.push(this.makeChunkEvent({- chunkType: 'text',- content: textParts.join(''),+ chunkType: 'reasoning',+ reasoning: reasoningParts.join(''),subagent: subagentCtx,}),);}- if (reasoningParts.length > 0) {+ if (textParts.length > 0) {events.push(this.makeChunkEvent({- chunkType: 'reasoning',- reasoning: reasoningParts.join(''),+ chunkType: 'text',+ content: textParts.join(''),subagent: subagentCtx,}),);