@@ -940,7 +940,7 @@ Simply call the appropriate tool with the new content. Do NOT echo back the full
940940 }
941941 }
942942
943- /// Spawn a task for code review generation
943+ /// Spawn a task for code review generation with streaming
944944 fn spawn_review_generation ( & self , from_ref : String , to_ref : String ) {
945945 use crate :: agents:: { StructuredResponse , TaskContext } ;
946946
@@ -953,6 +953,7 @@ Simply call the appropriate tool with the new content. Do NOT echo back the full
953953 } ;
954954
955955 let tx = self . iris_result_tx . clone ( ) ;
956+ let streaming_tx = tx. clone ( ) ;
956957
957958 tokio:: spawn ( async move {
958959 // Use review context with specified refs
@@ -964,9 +965,29 @@ Simply call the appropriate tool with the new content. Do NOT echo back the full
964965 }
965966 } ;
966967
967- // Execute the review capability
968- match agent. execute_task ( "review" , context) . await {
968+ // Execute with streaming - send chunks as they arrive
969+ let on_chunk = {
970+ let tx = streaming_tx. clone ( ) ;
971+ move |chunk : & str , aggregated : & str | {
972+ let _ = tx. send ( IrisTaskResult :: StreamingChunk {
973+ task_type : TaskType :: Review ,
974+ chunk : chunk. to_string ( ) ,
975+ aggregated : aggregated. to_string ( ) ,
976+ } ) ;
977+ }
978+ } ;
979+
980+ match agent
981+ . execute_task_streaming ( "review" , context, on_chunk)
982+ . await
983+ {
969984 Ok ( response) => {
985+ // Send streaming complete
986+ let _ = tx. send ( IrisTaskResult :: StreamingComplete {
987+ task_type : TaskType :: Review ,
988+ } ) ;
989+
990+ // Also send final content
970991 let review_text = match response {
971992 StructuredResponse :: MarkdownReview ( review) => review. content ,
972993 StructuredResponse :: PlainText ( text) => text,
@@ -981,7 +1002,7 @@ Simply call the appropriate tool with the new content. Do NOT echo back the full
9811002 } ) ;
9821003 }
9831004
984- /// Spawn a task for PR description generation
1005+ /// Spawn a task for PR description generation with streaming
9851006 fn spawn_pr_generation ( & self , base_branch : String , _to_ref : String ) {
9861007 use crate :: agents:: { StructuredResponse , TaskContext } ;
9871008
@@ -994,14 +1015,30 @@ Simply call the appropriate tool with the new content. Do NOT echo back the full
9941015 } ;
9951016
9961017 let tx = self . iris_result_tx . clone ( ) ;
1018+ let streaming_tx = tx. clone ( ) ;
9971019
9981020 tokio:: spawn ( async move {
9991021 // Build context for PR (comparing current branch to base)
10001022 let context = TaskContext :: for_pr ( Some ( base_branch) , None ) ;
10011023
1002- // Execute the PR capability
1003- match agent. execute_task ( "pr" , context) . await {
1024+ // Execute with streaming
1025+ let on_chunk = {
1026+ let tx = streaming_tx. clone ( ) ;
1027+ move |chunk : & str , aggregated : & str | {
1028+ let _ = tx. send ( IrisTaskResult :: StreamingChunk {
1029+ task_type : TaskType :: PR ,
1030+ chunk : chunk. to_string ( ) ,
1031+ aggregated : aggregated. to_string ( ) ,
1032+ } ) ;
1033+ }
1034+ } ;
1035+
1036+ match agent. execute_task_streaming ( "pr" , context, on_chunk) . await {
10041037 Ok ( response) => {
1038+ let _ = tx. send ( IrisTaskResult :: StreamingComplete {
1039+ task_type : TaskType :: PR ,
1040+ } ) ;
1041+
10051042 let pr_text = match response {
10061043 StructuredResponse :: PullRequest ( pr) => pr. content ,
10071044 StructuredResponse :: PlainText ( text) => text,
@@ -1016,7 +1053,7 @@ Simply call the appropriate tool with the new content. Do NOT echo back the full
10161053 } ) ;
10171054 }
10181055
1019- /// Spawn a task for changelog generation
1056+ /// Spawn a task for changelog generation with streaming
10201057 fn spawn_changelog_generation ( & self , from_ref : String , to_ref : String ) {
10211058 use crate :: agents:: { StructuredResponse , TaskContext } ;
10221059
@@ -1029,14 +1066,33 @@ Simply call the appropriate tool with the new content. Do NOT echo back the full
10291066 } ;
10301067
10311068 let tx = self . iris_result_tx . clone ( ) ;
1069+ let streaming_tx = tx. clone ( ) ;
10321070
10331071 tokio:: spawn ( async move {
10341072 // Build context for changelog (comparing two refs)
10351073 let context = TaskContext :: for_changelog ( from_ref, Some ( to_ref) ) ;
10361074
1037- // Execute the changelog capability
1038- match agent. execute_task ( "changelog" , context) . await {
1075+ // Execute with streaming
1076+ let on_chunk = {
1077+ let tx = streaming_tx. clone ( ) ;
1078+ move |chunk : & str , aggregated : & str | {
1079+ let _ = tx. send ( IrisTaskResult :: StreamingChunk {
1080+ task_type : TaskType :: Changelog ,
1081+ chunk : chunk. to_string ( ) ,
1082+ aggregated : aggregated. to_string ( ) ,
1083+ } ) ;
1084+ }
1085+ } ;
1086+
1087+ match agent
1088+ . execute_task_streaming ( "changelog" , context, on_chunk)
1089+ . await
1090+ {
10391091 Ok ( response) => {
1092+ let _ = tx. send ( IrisTaskResult :: StreamingComplete {
1093+ task_type : TaskType :: Changelog ,
1094+ } ) ;
1095+
10401096 let changelog_text = match response {
10411097 StructuredResponse :: Changelog ( cl) => cl. content ,
10421098 StructuredResponse :: PlainText ( text) => text,
@@ -1051,7 +1107,7 @@ Simply call the appropriate tool with the new content. Do NOT echo back the full
10511107 } ) ;
10521108 }
10531109
1054- /// Spawn a task for release notes generation
1110+ /// Spawn a task for release notes generation with streaming
10551111 fn spawn_release_notes_generation ( & self , from_ref : String , to_ref : String ) {
10561112 use crate :: agents:: { StructuredResponse , TaskContext } ;
10571113
@@ -1064,14 +1120,33 @@ Simply call the appropriate tool with the new content. Do NOT echo back the full
10641120 } ;
10651121
10661122 let tx = self . iris_result_tx . clone ( ) ;
1123+ let streaming_tx = tx. clone ( ) ;
10671124
10681125 tokio:: spawn ( async move {
10691126 // Build context for release notes (comparing two refs)
10701127 let context = TaskContext :: for_changelog ( from_ref, Some ( to_ref) ) ;
10711128
1072- // Execute the release_notes capability
1073- match agent. execute_task ( "release_notes" , context) . await {
1129+ // Execute with streaming
1130+ let on_chunk = {
1131+ let tx = streaming_tx. clone ( ) ;
1132+ move |chunk : & str , aggregated : & str | {
1133+ let _ = tx. send ( IrisTaskResult :: StreamingChunk {
1134+ task_type : TaskType :: ReleaseNotes ,
1135+ chunk : chunk. to_string ( ) ,
1136+ aggregated : aggregated. to_string ( ) ,
1137+ } ) ;
1138+ }
1139+ } ;
1140+
1141+ match agent
1142+ . execute_task_streaming ( "release_notes" , context, on_chunk)
1143+ . await
1144+ {
10741145 Ok ( response) => {
1146+ let _ = tx. send ( IrisTaskResult :: StreamingComplete {
1147+ task_type : TaskType :: ReleaseNotes ,
1148+ } ) ;
1149+
10751150 let release_notes_text = match response {
10761151 StructuredResponse :: ReleaseNotes ( rn) => rn. content ,
10771152 StructuredResponse :: PlainText ( text) => text,
0 commit comments