@@ -113,6 +113,7 @@ export function buildTraceSpans(result: ExecutionResult): {
113113 if ( ! log . blockId || ! log . blockType ) return
114114
115115 const spanId = `${ log . blockId } -${ new Date ( log . startedAt ) . getTime ( ) } `
116+ const isCondition = isConditionBlockType ( log . blockType )
116117
117118 const duration = log . durationMs || 0
118119
@@ -168,7 +169,7 @@ export function buildTraceSpans(result: ExecutionResult): {
168169 ...( log . parentIterations ?. length && { parentIterations : log . parentIterations } ) ,
169170 }
170171
171- if ( ! isConditionBlockType ( log . blockType ) && log . output ?. providerTiming ) {
172+ if ( ! isCondition && log . output ?. providerTiming ) {
172173 const providerTiming = log . output . providerTiming as {
173174 duration : number
174175 startTime : string
@@ -190,15 +191,15 @@ export function buildTraceSpans(result: ExecutionResult): {
190191 }
191192 }
192193
193- if ( ! isConditionBlockType ( log . blockType ) && log . output ?. cost ) {
194+ if ( ! isCondition && log . output ?. cost ) {
194195 span . cost = log . output . cost as {
195196 input ?: number
196197 output ?: number
197198 total ?: number
198199 }
199200 }
200201
201- if ( ! isConditionBlockType ( log . blockType ) && log . output ?. tokens ) {
202+ if ( ! isCondition && log . output ?. tokens ) {
202203 const t = log . output . tokens as
203204 | number
204205 | {
@@ -228,13 +229,13 @@ export function buildTraceSpans(result: ExecutionResult): {
228229 }
229230 }
230231
231- if ( ! isConditionBlockType ( log . blockType ) && log . output ?. model ) {
232+ if ( ! isCondition && log . output ?. model ) {
232233 span . model = log . output . model as string
233234 }
234235
235236 if (
236237 ! isWorkflowBlockType ( log . blockType ) &&
237- ! isConditionBlockType ( log . blockType ) &&
238+ ! isCondition &&
238239 log . output ?. providerTiming ?. timeSegments &&
239240 Array . isArray ( log . output . providerTiming . timeSegments )
240241 ) {
@@ -322,7 +323,7 @@ export function buildTraceSpans(result: ExecutionResult): {
322323 }
323324 }
324325 )
325- } else if ( ! isConditionBlockType ( log . blockType ) ) {
326+ } else if ( ! isCondition ) {
326327 let toolCallsList = null
327328
328329 try {
0 commit comments