Skip to content
Source
Sign inSign up
TanStack/ai
Open History to see the last commit

StreamProcessorEvents.md

262 lines4.1 KB

1---
2id: StreamProcessorEvents
3title: StreamProcessorEvents
4---
5​
6# Interface: StreamProcessorEvents
7​
8Defined in: [packages/typescript/ai/src/activities/chat/stream/processor.ts:59](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/activities/chat/stream/processor.ts#L59)
9​
10Events emitted by the StreamProcessor
11​
12## Properties
13​
14### onApprovalRequest()?
15​
16```ts
17optional onApprovalRequest: (args) => void;
18```
19​
20Defined in: [packages/typescript/ai/src/activities/chat/stream/processor.ts:74](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/activities/chat/stream/processor.ts#L74)
21​
22#### Parameters
23​
24##### args
25​
26###### approvalId
27​
28`string`
29​
30###### input
31​
32`any`
33​
34###### toolCallId
35​
36`string`
37​
38###### toolName
39​
40`string`
41​
42#### Returns
43​
44`void`
45​
46***
47​
48### onCustomEvent()?
49​
50```ts
51optional onCustomEvent: (eventType, data, context) => void;
52```
53​
54Defined in: [packages/typescript/ai/src/activities/chat/stream/processor.ts:82](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/activities/chat/stream/processor.ts#L82)
55​
56#### Parameters
57​
58##### eventType
59​
60`string`
61​
62##### data
63​
64`unknown`
65​
66##### context
67​
68###### toolCallId?
69​
70`string`
71​
72#### Returns
73​
74`void`
75​
76***
77​
78### onError()?
79​
80```ts
81optional onError: (error) => void;
82```
83​
84Defined in: [packages/typescript/ai/src/activities/chat/stream/processor.ts:66](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/activities/chat/stream/processor.ts#L66)
85​
86#### Parameters
87​
88##### error
89​
90`Error`
91​
92#### Returns
93​
94`void`
95​
96***
97​
98### onMessagesChange()?
99​
100```ts
101optional onMessagesChange: (messages) => void;
102```
103​
104Defined in: [packages/typescript/ai/src/activities/chat/stream/processor.ts:61](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/activities/chat/stream/processor.ts#L61)
105​
106#### Parameters
107​
108##### messages
109​
110[`UIMessage`](UIMessage.md)\<`unknown`\>[]
111​
112#### Returns
113​
114`void`
115​
116***
117​
118### onStreamEnd()?
119​
120```ts
121optional onStreamEnd: (message) => void;
122```
123​
124Defined in: [packages/typescript/ai/src/activities/chat/stream/processor.ts:65](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/activities/chat/stream/processor.ts#L65)
125​
126#### Parameters
127​
128##### message
129​
130[`UIMessage`](UIMessage.md)
131​
132#### Returns
133​
134`void`
135​
136***
137​
138### onStreamStart()?
139​
140```ts
141optional onStreamStart: () => void;
142```
143​
144Defined in: [packages/typescript/ai/src/activities/chat/stream/processor.ts:64](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/activities/chat/stream/processor.ts#L64)
145​
146#### Returns
147​
148`void`
149​
150***
151​
152### onTextUpdate()?
153​
154```ts
155optional onTextUpdate: (messageId, content) => void;
156```
157​
158Defined in: [packages/typescript/ai/src/activities/chat/stream/processor.ts:89](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/activities/chat/stream/processor.ts#L89)
159​
160#### Parameters
161​
162##### messageId
163​
164`string`
165​
166##### content
167​
168`string`
169​
170#### Returns
171​
172`void`
173​
174***
175​
176### onThinkingUpdate()?
177​
178```ts
179optional onThinkingUpdate: (messageId, stepId, content) => void;
180```
181​
182Defined in: [packages/typescript/ai/src/activities/chat/stream/processor.ts:96](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/activities/chat/stream/processor.ts#L96)
183​
184#### Parameters
185​
186##### messageId
187​
188`string`
189​
190##### stepId
191​
192`string`
193​
194##### content
195​
196`string`
197​
198#### Returns
199​
200`void`
201​
202***
203​
204### onToolCall()?
205​
206```ts
207optional onToolCall: (args) => void;
208```
209​
210Defined in: [packages/typescript/ai/src/activities/chat/stream/processor.ts:69](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/activities/chat/stream/processor.ts#L69)
211​
212#### Parameters
213​
214##### args
215​
216###### input
217​
218`any`
219​
220###### toolCallId
221​
222`string`
223​
224###### toolName
225​
226`string`
227​
228#### Returns
229​
230`void`
231​
232***
233​
234### onToolCallStateChange()?
235​
236```ts
237optional onToolCallStateChange: (messageId, toolCallId, state, args) => void;
238```
239​
240Defined in: [packages/typescript/ai/src/activities/chat/stream/processor.ts:90](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/activities/chat/stream/processor.ts#L90)
241​
242#### Parameters
243​
244##### messageId
245​
246`string`
247​
248##### toolCallId
249​
250`string`
251​
252##### state
253​
254[`ToolCallState`](../type-aliases/ToolCallState.md)
255​
256##### args
257​
258`string`
259​
260#### Returns
261​
262`void`