File tree Expand file tree Collapse file tree 2 files changed +19
-11
lines changed
apps/sim/lib/copilot/orchestrator Expand file tree Collapse file tree 2 files changed +19
-11
lines changed Original file line number Diff line number Diff line change @@ -113,7 +113,7 @@ function inferToolSuccess(data: Record<string, unknown> | undefined): {
113113 const explicitSuccess = data ?. success ?? resultObj . success
114114 const hasResultData = data ?. result !== undefined || data ?. data !== undefined
115115 const hasError = ! ! data ?. error || ! ! resultObj . error
116- const success = hasExplicitSuccess ? ! ! explicitSuccess : hasResultData && ! hasError
116+ const success = hasExplicitSuccess ? ! ! explicitSuccess : ! hasError
117117 return { success, hasResultData, hasError }
118118}
119119
Original file line number Diff line number Diff line change @@ -180,14 +180,22 @@ export async function runStreamLoop(
180180 * Build a ToolCallSummary array from the streaming context.
181181 */
182182export function buildToolCallSummaries ( context : StreamingContext ) : ToolCallSummary [ ] {
183- return Array . from ( context . toolCalls . values ( ) ) . map ( ( toolCall ) => ( {
184- id : toolCall . id ,
185- name : toolCall . name ,
186- status : toolCall . status ,
187- params : toolCall . params ,
188- result : toolCall . result ?. output ,
189- error : toolCall . error ,
190- durationMs :
191- toolCall . endTime && toolCall . startTime ? toolCall . endTime - toolCall . startTime : undefined ,
192- } ) )
183+ return Array . from ( context . toolCalls . values ( ) ) . map ( ( toolCall ) => {
184+ let status = toolCall . status
185+ if ( toolCall . result && toolCall . result . success !== undefined ) {
186+ status = toolCall . result . success ? 'success' : 'error'
187+ } else if ( status === 'pending' || status === 'executing' ) {
188+ status = toolCall . error ? 'error' : 'success'
189+ }
190+ return {
191+ id : toolCall . id ,
192+ name : toolCall . name ,
193+ status,
194+ params : toolCall . params ,
195+ result : toolCall . result ?. output ,
196+ error : toolCall . error ,
197+ durationMs :
198+ toolCall . endTime && toolCall . startTime ? toolCall . endTime - toolCall . startTime : undefined ,
199+ }
200+ } )
193201}
You can’t perform that action at this time.
0 commit comments