@@ -1434,14 +1434,26 @@ export class DaemonKimiWebApi implements KimiWebApi {
14341434 const { type, seq, session_id : sessionId , payload, offset } = frame ;
14351435 const appEvents = projector . project ( type , payload , sessionId , { offset } ) ;
14361436 for ( const appEvent of appEvents ) {
1437+ const turnId = ( payload as { turnId ?: unknown } | null ) ?. turnId ;
1438+ const stream =
1439+ appEvent . type === 'assistantDelta' &&
1440+ typeof turnId === 'number' &&
1441+ typeof offset === 'number' &&
1442+ ( type === 'assistant.delta' || type === 'thinking.delta' )
1443+ ? {
1444+ turnId,
1445+ offset,
1446+ kind : type === 'assistant.delta' ? ( 'text' as const ) : ( 'thinking' as const ) ,
1447+ }
1448+ : undefined ;
14371449 // historyCompacted from the projector is either a compaction signal
14381450 // (reason auto_compact — no reload, the divider marker handles it) or
14391451 // a delta-gap recovery (reason delta_gap — a real resync, routed to
14401452 // onResync with the real frame.seq, mirroring the protocol path).
14411453 if ( appEvent . type === 'historyCompacted' && ! isCompactionReason ( appEvent . reason ) ) {
14421454 handlers . onResync ( sessionId , seq ) ;
14431455 }
1444- handlers . onEvent ( appEvent , { sessionId, seq } ) ;
1456+ handlers . onEvent ( appEvent , { sessionId, seq, stream } ) ;
14451457 }
14461458 } ,
14471459
0 commit comments