@@ -15,6 +15,7 @@ import type {
1515 UIMessageChunk ,
1616} from "ai" ;
1717import type {
18+ TriggerChatOnTriggeredRun ,
1819 TriggerChatPayloadMapper ,
1920 TriggerChatRunState ,
2021 TriggerChatRunStore ,
@@ -75,7 +76,7 @@ type TriggerChatTransportCommonOptions<
7576 | TriggerOptions
7677 | TriggerChatTriggerOptionsResolver < UI_MESSAGE > ;
7778 runStore ?: TriggerChatRunStore ;
78- onTriggeredRun ?: ( state : TriggerChatRunState ) => void ;
79+ onTriggeredRun ?: TriggerChatOnTriggeredRun ;
7980} ;
8081
8182type TriggerChatTransportMapperRequirement <
@@ -129,7 +130,7 @@ export class TriggerChatTransport<
129130 private readonly baseURL : string ;
130131 private readonly previewBranch : string | undefined ;
131132 private readonly requestOptions : ApiRequestOptions | undefined ;
132- private readonly onTriggeredRun : ( ( state : TriggerChatRunState ) => void ) | undefined ;
133+ private readonly onTriggeredRun : TriggerChatOnTriggeredRun | undefined ;
133134
134135 constructor ( options : TriggerChatTransportOptions < UI_MESSAGE , PAYLOAD > ) {
135136 this . task = options . task ;
@@ -179,7 +180,7 @@ export class TriggerChatTransport<
179180 await this . runStore . set ( runState ) ;
180181
181182 if ( this . onTriggeredRun ) {
182- this . onTriggeredRun ( runState ) ;
183+ await this . onTriggeredRun ( runState ) ;
183184 }
184185
185186 const stream = await this . fetchRunStream ( runState , options . abortSignal ) ;
0 commit comments