@@ -49,15 +49,15 @@ export function update<Result>(adapter: Adapter<Result>, event: SessionEvent.Eve
4949
5050 const latestTool = ( assistant : DraftAssistant | undefined , callID ?: string ) =>
5151 assistant ?. content . findLast (
52- ( item ) : item is DraftTool => item . type === "tool" && ( callID === undefined || item . callID === callID ) ,
52+ ( item ) : item is DraftTool => item . type === "tool" && ( callID === undefined || item . id === callID ) ,
5353 )
5454
5555 const latestText = ( assistant : DraftAssistant | undefined ) =>
5656 assistant ?. content . findLast ( ( item ) : item is DraftText => item . type === "text" )
5757
5858 const latestReasoning = ( assistant : DraftAssistant | undefined , reasoningID : string ) =>
5959 assistant ?. content . findLast (
60- ( item ) : item is DraftReasoning => item . type === "reasoning" && item . reasoningID === reasoningID ,
60+ ( item ) : item is DraftReasoning => item . type === "reasoning" && item . id === reasoningID ,
6161 )
6262
6363 SessionEvent . All . match ( event , {
@@ -128,7 +128,7 @@ export function update<Result>(adapter: Adapter<Result>, event: SessionEvent.Eve
128128 produce ( currentAssistant , ( draft ) => {
129129 draft . content . push ( {
130130 type : "tool" ,
131- callID : event . data . callID ,
131+ id : event . data . callID ,
132132 name : event . data . name ,
133133 time : {
134134 created : event . data . timestamp ,
@@ -160,6 +160,7 @@ export function update<Result>(adapter: Adapter<Result>, event: SessionEvent.Eve
160160 produce ( currentAssistant , ( draft ) => {
161161 const match = latestTool ( draft , event . data . callID )
162162 if ( match ) {
163+ match . provider = event . data . provider
163164 match . time . ran = event . data . timestamp
164165 match . state = {
165166 status : "running" ,
@@ -191,6 +192,8 @@ export function update<Result>(adapter: Adapter<Result>, event: SessionEvent.Eve
191192 produce ( currentAssistant , ( draft ) => {
192193 const match = latestTool ( draft , event . data . callID )
193194 if ( match && match . state . status === "running" ) {
195+ match . provider = event . data . provider
196+ match . time . completed = event . data . timestamp
194197 match . state = {
195198 status : "completed" ,
196199 input : match . state . input ,
@@ -208,6 +211,8 @@ export function update<Result>(adapter: Adapter<Result>, event: SessionEvent.Eve
208211 produce ( currentAssistant , ( draft ) => {
209212 const match = latestTool ( draft , event . data . callID )
210213 if ( match && match . state . status === "running" ) {
214+ match . provider = event . data . provider
215+ match . time . completed = event . data . timestamp
211216 match . state = {
212217 status : "error" ,
213218 error : event . data . error ,
@@ -226,7 +231,7 @@ export function update<Result>(adapter: Adapter<Result>, event: SessionEvent.Eve
226231 produce ( currentAssistant , ( draft ) => {
227232 draft . content . push ( {
228233 type : "reasoning" ,
229- reasoningID : event . data . reasoningID ,
234+ id : event . data . reasoningID ,
230235 text : "" ,
231236 } )
232237 } ) ,
0 commit comments