@@ -509,9 +509,41 @@ class AppController {
509509 // Skip if REST fetch is in-flight (renderLogs will do a full refresh)
510510 if ( this . _logFetchInFlight ) return null ;
511511 if ( this . _empXterm ) {
512- this . _empXterm . appendLog ( p . log ) ;
512+ // Employee xterm still receives string content
513+ const xtermLog = { ...p . log } ;
514+ if ( typeof xtermLog . content === 'object' && xtermLog . content !== null ) {
515+ xtermLog . content = xtermLog . content . content || JSON . stringify ( xtermLog . content ) ;
516+ }
517+ this . _empXterm . appendLog ( xtermLog ) ;
518+ }
519+ }
520+
521+ // CEO conversation: route tool_call / tool_result events
522+ if ( p . project_id && this . _ceoTerm && this . _currentCeoProject ) {
523+ const currentBase = this . _currentCeoProject . split ( '/' ) [ 0 ] ;
524+ const eventBase = p . project_id . split ( '/' ) [ 0 ] ;
525+ if ( currentBase === eventBase ) {
526+ if ( p . log ?. type === 'tool_call' ) {
527+ const content = p . log . content ;
528+ if ( typeof content === 'object' && content !== null ) {
529+ this . _ceoTerm . appendToolCall ( {
530+ employeeId : p . employee_id ,
531+ toolName : content . tool_name || '?' ,
532+ toolArgs : content . tool_args || { } ,
533+ } ) ;
534+ }
535+ } else if ( p . log ?. type === 'tool_result' ) {
536+ const content = p . log . content ;
537+ if ( typeof content === 'object' && content !== null ) {
538+ this . _ceoTerm . updateToolCall ( p . employee_id , {
539+ toolName : content . tool_name || '?' ,
540+ toolResult : content . tool_result || '' ,
541+ } ) ;
542+ }
543+ }
513544 }
514545 }
546+
515547 return null ; // don't spam the activity log
516548 } ,
517549 } ;
0 commit comments