@@ -68,7 +68,7 @@ export function extractAISummarySpanData(
6868 let messageCount : number | undefined ;
6969 if ( promptJson ) {
7070 try {
71- const parsed = JSON . parse ( promptJson ) ;
71+ const parsed = JSON . parse ( promptJson ) as Record < string , unknown > ;
7272 if ( parsed . messages && Array . isArray ( parsed . messages ) ) {
7373 messageCount = parsed . messages . length ;
7474 } else {
@@ -146,7 +146,7 @@ function parsePromptToDisplayItems(
146146 responseText ?: string
147147) : DisplayItem [ ] | undefined {
148148 try {
149- const parsed = JSON . parse ( promptJson ) ;
149+ const parsed = JSON . parse ( promptJson ) as Record < string , unknown > ;
150150 if ( ! parsed || typeof parsed !== "object" ) return undefined ;
151151
152152 const items : DisplayItem [ ] = [ ] ;
@@ -162,8 +162,9 @@ function parsePromptToDisplayItems(
162162 if ( Array . isArray ( parsed . messages ) ) {
163163 for ( const msg of parsed . messages ) {
164164 if ( ! msg || typeof msg !== "object" ) continue ;
165- const role = msg . role ;
166- const content = extractMessageContent ( msg . content ) ;
165+ const m = msg as Record < string , unknown > ;
166+ const role = m . role ;
167+ const content = extractMessageContent ( m . content ) ;
167168 if ( ! content ) continue ;
168169
169170 switch ( role ) {
@@ -196,7 +197,11 @@ function extractMessageContent(content: unknown): string | undefined {
196197 if ( Array . isArray ( content ) ) {
197198 // Extract text parts from content array [{type: "text", text: "..."}]
198199 return content
199- . filter ( ( p ) => p && typeof p === "object" && p . type === "text" && typeof p . text === "string" )
200+ . filter ( ( p ) : p is { type : string ; text : string } => {
201+ if ( ! p || typeof p !== "object" ) return false ;
202+ const o = p as Record < string , unknown > ;
203+ return o . type === "text" && typeof o . text === "string" ;
204+ } )
200205 . map ( ( p ) => p . text )
201206 . join ( "\n" ) ;
202207 }
@@ -214,7 +219,7 @@ function parseProviderMetadata(
214219 if ( ! jsonStr ) return undefined ;
215220
216221 try {
217- const parsed = JSON . parse ( jsonStr ) ;
222+ const parsed = JSON . parse ( jsonStr ) as Record < string , any > ;
218223 if ( ! parsed || typeof parsed !== "object" ) return undefined ;
219224
220225 let serviceTier : string | undefined ;
0 commit comments