@@ -777,16 +777,6 @@ export function useChat(
777777 }
778778
779779 logger . debug ( 'SSE event received' , parsed )
780- if ( parsed . type === 'tool' ) {
781- const _p = getPayloadData ( parsed )
782- if ( _p . phase === 'args_delta' && _p . toolName === 'workspace_file' ) {
783- console . warn ( '[FILE-STREAM-BROWSER] workspace_file args_delta arrived' , {
784- seq : parsed . seq ,
785- deltaLen :
786- typeof _p . argumentsDelta === 'string' ? ( _p . argumentsDelta as string ) . length : 0 ,
787- } )
788- }
789- }
790780 switch ( parsed . type ) {
791781 case MothershipStreamV1EventType . session : {
792782 const payload = getPayloadData ( parsed )
@@ -891,26 +881,6 @@ export function useChat(
891881 : ( blocks [ toolMap . get ( id ) ?? - 1 ] ?. toolCall ?. name ?? '' )
892882 const streamWorkspaceFile = toolName === WorkspaceFile . id
893883
894- // #region agent log
895- fetch ( 'http://127.0.0.1:7774/ingest/b056eec6-a1ee-457f-8556-85f94314ca06' , {
896- method : 'POST' ,
897- headers : { 'Content-Type' : 'application/json' , 'X-Debug-Session-Id' : '6f10b0' } ,
898- body : JSON . stringify ( {
899- sessionId : '6f10b0' ,
900- location : 'use-chat.ts:args_delta' ,
901- message : 'args_delta entry' ,
902- data : {
903- toolName,
904- streamWorkspaceFile,
905- deltaLen : delta . length ,
906- seq : parsed . seq ,
907- } ,
908- timestamp : Date . now ( ) ,
909- hypothesisId : 'H1' ,
910- } ) ,
911- } ) . catch ( ( ) => { } )
912- // #endregion
913-
914884 if ( streamWorkspaceFile ) {
915885 let prev = streamingFileRef . current
916886 if ( ! prev || ( ! prev . fileName && ! prev . fileId ) ) {
@@ -943,32 +913,6 @@ export function useChat(
943913 ( resource ) => resource . type === 'file' && resource . id === matchedResourceId
944914 )
945915
946- // #region agent log
947- const hasContent = raw . indexOf ( '"content":' ) >= 0
948- fetch ( 'http://127.0.0.1:7774/ingest/b056eec6-a1ee-457f-8556-85f94314ca06' , {
949- method : 'POST' ,
950- headers : { 'Content-Type' : 'application/json' , 'X-Debug-Session-Id' : '6f10b0' } ,
951- body : JSON . stringify ( {
952- sessionId : '6f10b0' ,
953- location : 'use-chat.ts:resource-decision' ,
954- message : 'resource routing' ,
955- data : {
956- fileName,
957- matchedResourceId,
958- existingFileMatch : ! ! existingFileMatch ,
959- hasContent,
960- rawLen : raw . length ,
961- activeResourceId : activeResourceIdRef . current ,
962- resourceIds : resourcesRef . current . map ( ( r : { id : string } ) => r . id ) ,
963- activeFileCtx : activeFileContextRef . current ,
964- seq : parsed . seq ,
965- } ,
966- timestamp : Date . now ( ) ,
967- hypothesisId : 'H4' ,
968- } ) ,
969- } ) . catch ( ( ) => { } )
970- // #endregion
971-
972916 if ( existingFileMatch ) {
973917 setActiveResourceId ( matchedResourceId )
974918 setResources ( ( rs ) => rs . filter ( ( resource ) => resource . id !== 'streaming-file' ) )
@@ -1132,26 +1076,6 @@ export function useChat(
11321076 if ( fileId || fileName ) {
11331077 activeFileContextRef . current = { fileId, fileName }
11341078 }
1135- // #region agent log
1136- fetch ( 'http://127.0.0.1:7774/ingest/b056eec6-a1ee-457f-8556-85f94314ca06' , {
1137- method : 'POST' ,
1138- headers : { 'Content-Type' : 'application/json' , 'X-Debug-Session-Id' : '6f10b0' } ,
1139- body : JSON . stringify ( {
1140- sessionId : '6f10b0' ,
1141- location : 'use-chat.ts:create_file_result' ,
1142- message : 'create_file result processed' ,
1143- data : {
1144- toolName : tc . name ,
1145- fileId,
1146- fileName,
1147- status : tc . status ,
1148- activeFileCtx : activeFileContextRef . current ,
1149- } ,
1150- timestamp : Date . now ( ) ,
1151- hypothesisId : 'H5' ,
1152- } ) ,
1153- } ) . catch ( ( ) => { } )
1154- // #endregion
11551079 }
11561080
11571081 if ( isWorkflowToolName ( tc . name ) ) {
@@ -1160,27 +1084,6 @@ export function useChat(
11601084
11611085 if ( tc . name === WorkspaceFile . id ) {
11621086 const fileResource = extractedResources . find ( ( r ) => r . type === 'file' )
1163- // #region agent log
1164- fetch ( 'http://127.0.0.1:7774/ingest/b056eec6-a1ee-457f-8556-85f94314ca06' , {
1165- method : 'POST' ,
1166- headers : { 'Content-Type' : 'application/json' , 'X-Debug-Session-Id' : '6f10b0' } ,
1167- body : JSON . stringify ( {
1168- sessionId : '6f10b0' ,
1169- location : 'use-chat.ts:workspace_file_result_cleanup' ,
1170- message : 'workspace_file result cleanup' ,
1171- data : {
1172- toolCallId : id ,
1173- activeResourceIdBefore : activeResourceIdRef . current ,
1174- streamingFileExists : ! ! streamingFileRef . current ,
1175- fileResourceId : fileResource ?. id ,
1176- fileResourceTitle : fileResource ?. title ,
1177- resourceIds : resourcesRef . current . map ( ( r : { id : string } ) => r . id ) ,
1178- } ,
1179- timestamp : Date . now ( ) ,
1180- hypothesisId : 'H6' ,
1181- } ) ,
1182- } ) . catch ( ( ) => { } )
1183- // #endregion
11841087 if ( fileResource ) {
11851088 setResources ( ( rs ) => {
11861089 const without = rs . filter ( ( r ) => r . id !== 'streaming-file' )
@@ -1221,6 +1124,8 @@ export function useChat(
12211124 const chunkTitle = innerArgs ?. title as string | undefined
12221125 if ( chunkTitle ) {
12231126 displayTitle = `Writing ${ chunkTitle } `
1127+ } else if ( activeFileContextRef . current ?. fileName ) {
1128+ displayTitle = `Writing ${ activeFileContextRef . current . fileName } `
12241129 }
12251130 }
12261131
@@ -1385,26 +1290,6 @@ export function useChat(
13851290 blocks . push ( { type : 'subagent' , content : name } )
13861291 }
13871292 if ( name === FileWrite . id ) {
1388- // #region agent log
1389- fetch ( 'http://127.0.0.1:7774/ingest/b056eec6-a1ee-457f-8556-85f94314ca06' , {
1390- method : 'POST' ,
1391- headers : { 'Content-Type' : 'application/json' , 'X-Debug-Session-Id' : '6f10b0' } ,
1392- body : JSON . stringify ( {
1393- sessionId : '6f10b0' ,
1394- location : 'use-chat.ts:file_write_span_start' ,
1395- message : 'file_write span start' ,
1396- data : {
1397- parentToolCallId,
1398- activeResourceIdBefore : activeResourceIdRef . current ,
1399- existingStreamingFile : streamingFileRef . current ,
1400- activeFileCtx : activeFileContextRef . current ,
1401- resourceIds : resourcesRef . current . map ( ( r : { id : string } ) => r . id ) ,
1402- } ,
1403- timestamp : Date . now ( ) ,
1404- hypothesisId : 'H7' ,
1405- } ) ,
1406- } ) . catch ( ( ) => { } )
1407- // #endregion
14081293 const emptyFile = { fileName : '' , content : '' }
14091294 streamingFileRef . current = emptyFile
14101295 setStreamingFile ( emptyFile )
@@ -1415,28 +1300,6 @@ export function useChat(
14151300 break
14161301 }
14171302 if ( streamingFileRef . current ) {
1418- // #region agent log
1419- fetch ( 'http://127.0.0.1:7774/ingest/b056eec6-a1ee-457f-8556-85f94314ca06' , {
1420- method : 'POST' ,
1421- headers : { 'Content-Type' : 'application/json' , 'X-Debug-Session-Id' : '6f10b0' } ,
1422- body : JSON . stringify ( {
1423- sessionId : '6f10b0' ,
1424- location : 'use-chat.ts:file_write_span_end' ,
1425- message : 'file_write span end clear' ,
1426- data : {
1427- activeResourceIdBefore : activeResourceIdRef . current ,
1428- streamingFileBefore : streamingFileRef . current ,
1429- lastRealFileId : resourcesRef . current . find (
1430- ( r : { type : string ; id : string } ) =>
1431- r . type === 'file' && r . id !== 'streaming-file'
1432- ) ?. id ,
1433- resourceIds : resourcesRef . current . map ( ( r : { id : string } ) => r . id ) ,
1434- } ,
1435- timestamp : Date . now ( ) ,
1436- hypothesisId : 'H8' ,
1437- } ) ,
1438- } ) . catch ( ( ) => { } )
1439- // #endregion
14401303 setStreamingFile ( null )
14411304 streamingFileRef . current = null
14421305 const lastFileResource = resourcesRef . current . find (
0 commit comments