@@ -27,7 +27,7 @@ export function stripProviderTimingContent(
2727 ...segment
2828 } ) => ( {
2929 ...segment ,
30- ...( toolCalls ? { toolCalls : stripModelToolCallArguments ( toolCalls ) } : { } ) ,
30+ ...( Array . isArray ( toolCalls ) ? { toolCalls : stripModelToolCallArguments ( toolCalls ) } : { } ) ,
3131 } )
3232 ) ,
3333 }
@@ -37,7 +37,9 @@ export function stripProviderTimingContent(
3737 * A trace span tree with every span's content removed: inputs, outputs,
3838 * thinking, error text, tool-call arguments, and provider content. Keeps the
3939 * tree's shape, names, timing, status, and cost, including a nested child
40- * workflow's spans carried on `output.childTraceSpans`.
40+ * workflow's spans carried on `output.childTraceSpans`. A field that is not in
41+ * its expected shape (for example one spilled to a large-value reference) is
42+ * dropped rather than read.
4143 */
4244export function summarizeTraceSpansWithoutIo ( traceSpans ?: TraceSpan [ ] ) : TraceSpan [ ] | undefined {
4345 if ( ! traceSpans ) {
@@ -62,10 +64,16 @@ export function summarizeTraceSpansWithoutIo(traceSpans?: TraceSpan[]): TraceSpa
6264 ...( Array . isArray ( nestedSpans ) && nestedSpans . length
6365 ? { output : { childTraceSpans : summarizeTraceSpansWithoutIo ( nestedSpans ) } }
6466 : { } ) ,
65- ...( modelToolCalls ? { modelToolCalls : stripModelToolCallArguments ( modelToolCalls ) } : { } ) ,
66- ...( toolCalls ? { toolCalls : stripLegacyToolCallContent ( toolCalls ) } : { } ) ,
67- ...( providerTiming ? { providerTiming : stripProviderTimingContent ( providerTiming ) } : { } ) ,
68- ...( children ?. length ? { children : summarizeTraceSpansWithoutIo ( children ) } : { } ) ,
67+ ...( Array . isArray ( modelToolCalls )
68+ ? { modelToolCalls : stripModelToolCallArguments ( modelToolCalls ) }
69+ : { } ) ,
70+ ...( Array . isArray ( toolCalls ) ? { toolCalls : stripLegacyToolCallContent ( toolCalls ) } : { } ) ,
71+ ...( Array . isArray ( providerTiming ?. segments )
72+ ? { providerTiming : stripProviderTimingContent ( providerTiming ) }
73+ : { } ) ,
74+ ...( Array . isArray ( children ) && children . length
75+ ? { children : summarizeTraceSpansWithoutIo ( children ) }
76+ : { } ) ,
6977 }
7078 } )
7179}
0 commit comments