@@ -44,91 +44,91 @@ export interface RunAgentSubscriber {
44
44
// Request lifecycle
45
45
onRunInitialized ?(
46
46
params : RunAgentSubscriberParams ,
47
- ) : MaybePromise < Omit < AgentStateMutation , "stopPropagation" > | undefined > ;
47
+ ) : MaybePromise < Omit < AgentStateMutation , "stopPropagation" > | void > ;
48
48
onRunFailed ?(
49
49
params : { error : Error } & RunAgentSubscriberParams ,
50
- ) : MaybePromise < Omit < AgentStateMutation , "stopPropagation" > | undefined > ;
50
+ ) : MaybePromise < Omit < AgentStateMutation , "stopPropagation" > | void > ;
51
51
onRunFinalized ?(
52
52
params : RunAgentSubscriberParams ,
53
- ) : MaybePromise < Omit < AgentStateMutation , "stopPropagation" > | undefined > ;
53
+ ) : MaybePromise < Omit < AgentStateMutation , "stopPropagation" > | void > ;
54
54
55
55
// Events
56
56
onEvent ?(
57
57
params : { event : BaseEvent } & RunAgentSubscriberParams ,
58
- ) : MaybePromise < AgentStateMutation | undefined > ;
58
+ ) : MaybePromise < AgentStateMutation | void > ;
59
59
60
60
onRunStartedEvent ?(
61
61
params : { event : RunStartedEvent } & RunAgentSubscriberParams ,
62
- ) : MaybePromise < AgentStateMutation | undefined > ;
62
+ ) : MaybePromise < AgentStateMutation | void > ;
63
63
onRunFinishedEvent ?(
64
- params : { event : RunFinishedEvent } & RunAgentSubscriberParams ,
65
- ) : MaybePromise < AgentStateMutation | undefined > ;
64
+ params : { event : RunFinishedEvent ; result ?: any } & RunAgentSubscriberParams ,
65
+ ) : MaybePromise < AgentStateMutation | void > ;
66
66
onRunErrorEvent ?(
67
67
params : { event : RunErrorEvent } & RunAgentSubscriberParams ,
68
- ) : MaybePromise < AgentStateMutation | undefined > ;
68
+ ) : MaybePromise < AgentStateMutation | void > ;
69
69
70
70
onStepStartedEvent ?(
71
71
params : { event : StepStartedEvent } & RunAgentSubscriberParams ,
72
- ) : MaybePromise < AgentStateMutation | undefined > ;
72
+ ) : MaybePromise < AgentStateMutation | void > ;
73
73
onStepFinishedEvent ?(
74
74
params : { event : StepFinishedEvent } & RunAgentSubscriberParams ,
75
- ) : MaybePromise < AgentStateMutation | undefined > ;
75
+ ) : MaybePromise < AgentStateMutation | void > ;
76
76
77
77
onTextMessageStartEvent ?(
78
78
params : { event : TextMessageStartEvent } & RunAgentSubscriberParams ,
79
- ) : MaybePromise < AgentStateMutation | undefined > ;
79
+ ) : MaybePromise < AgentStateMutation | void > ;
80
80
onTextMessageContentEvent ?(
81
81
params : {
82
82
event : TextMessageContentEvent ;
83
83
textMessageBuffer : string ;
84
84
} & RunAgentSubscriberParams ,
85
- ) : MaybePromise < AgentStateMutation | undefined > ;
85
+ ) : MaybePromise < AgentStateMutation | void > ;
86
86
onTextMessageEndEvent ?(
87
87
params : { event : TextMessageEndEvent ; textMessageBuffer : string } & RunAgentSubscriberParams ,
88
- ) : MaybePromise < AgentStateMutation | undefined > ;
88
+ ) : MaybePromise < AgentStateMutation | void > ;
89
89
90
90
onToolCallStartEvent ?(
91
91
params : { event : ToolCallStartEvent } & RunAgentSubscriberParams ,
92
- ) : MaybePromise < AgentStateMutation | undefined > ;
92
+ ) : MaybePromise < AgentStateMutation | void > ;
93
93
onToolCallArgsEvent ?(
94
94
params : {
95
95
event : ToolCallArgsEvent ;
96
96
toolCallBuffer : string ;
97
97
toolCallName : string ;
98
98
partialToolCallArgs : Record < string , any > ;
99
99
} & RunAgentSubscriberParams ,
100
- ) : MaybePromise < AgentStateMutation | undefined > ;
100
+ ) : MaybePromise < AgentStateMutation | void > ;
101
101
onToolCallEndEvent ?(
102
102
params : {
103
103
event : ToolCallEndEvent ;
104
104
toolCallName : string ;
105
105
toolCallArgs : Record < string , any > ;
106
106
} & RunAgentSubscriberParams ,
107
- ) : MaybePromise < AgentStateMutation | undefined > ;
107
+ ) : MaybePromise < AgentStateMutation | void > ;
108
108
109
109
onToolCallResultEvent ?(
110
110
params : { event : ToolCallResultEvent } & RunAgentSubscriberParams ,
111
- ) : MaybePromise < AgentStateMutation | undefined > ;
111
+ ) : MaybePromise < AgentStateMutation | void > ;
112
112
113
113
onStateSnapshotEvent ?(
114
114
params : { event : StateSnapshotEvent } & RunAgentSubscriberParams ,
115
- ) : MaybePromise < AgentStateMutation | undefined > ;
115
+ ) : MaybePromise < AgentStateMutation | void > ;
116
116
117
117
onStateDeltaEvent ?(
118
118
params : { event : StateDeltaEvent } & RunAgentSubscriberParams ,
119
- ) : MaybePromise < AgentStateMutation | undefined > ;
119
+ ) : MaybePromise < AgentStateMutation | void > ;
120
120
121
121
onMessagesSnapshotEvent ?(
122
122
params : { event : MessagesSnapshotEvent } & RunAgentSubscriberParams ,
123
- ) : MaybePromise < AgentStateMutation | undefined > ;
123
+ ) : MaybePromise < AgentStateMutation | void > ;
124
124
125
125
onRawEvent ?(
126
126
params : { event : RawEvent } & RunAgentSubscriberParams ,
127
- ) : MaybePromise < AgentStateMutation | undefined > ;
127
+ ) : MaybePromise < AgentStateMutation | void > ;
128
128
129
129
onCustomEvent ?(
130
130
params : { event : CustomEvent } & RunAgentSubscriberParams ,
131
- ) : MaybePromise < AgentStateMutation | undefined > ;
131
+ ) : MaybePromise < AgentStateMutation | void > ;
132
132
133
133
// State changes
134
134
onMessagesChanged ?( params : Omit < RunAgentSubscriberParams , "state" > ) : MaybePromise < void > ;
@@ -143,7 +143,7 @@ export async function runSubscribersWithMutation(
143
143
subscriber : RunAgentSubscriber ,
144
144
messages : Message [ ] ,
145
145
state : State ,
146
- ) => MaybePromise < AgentStateMutation | undefined > ,
146
+ ) => MaybePromise < AgentStateMutation | void > ,
147
147
) : Promise < AgentStateMutation > {
148
148
let messages : Message [ ] = initialMessages ;
149
149
let state : State = initialState ;
0 commit comments