feat: enable stream_event forwarding for serve mode streaming

QueryEngine previously guarded stream_event yields behind includePartialMessages,
which was undefined in serve mode. Remove the guard so stream_event messages
always flow to the child process stdout. Add stream_event handling in
sessionHandle.routeMessage to emit via EventBus for downstream consumers.
This commit is contained in:
DoSun 2026-05-09 09:49:37 +08:00
parent 862a16c295
commit e37e9d3ad5
2 changed files with 11 additions and 8 deletions

View File

@ -837,14 +837,12 @@ export class QueryEngine {
)
}
if (includePartialMessages) {
yield {
type: 'stream_event' as const,
event,
session_id: getSessionId(),
parent_tool_use_id: null,
uuid: randomUUID(),
}
yield {
type: 'stream_event' as const,
event,
session_id: getSessionId(),
parent_tool_use_id: null,
uuid: randomUUID(),
}
break

View File

@ -521,6 +521,11 @@ export class SessionHandle {
this.pendingQuestions.delete(cancelRequestId)
break
}
case 'stream_event': {
this.lastActiveAt = Date.now()
this.emitEvent('stream_event', msg)
break
}
default: {
break
}