@scoutqa/ag-ui-client 0.0.42-fork.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md ADDED
@@ -0,0 +1,78 @@
1
+ # @ag-ui/client
2
+
3
+ Client SDK for connecting to **Agent-User Interaction (AG-UI) Protocol** servers.
4
+
5
+ `@ag-ui/client` provides agent implementations that handle the full lifecycle of AG-UI communication: connecting to servers, processing streaming events, managing state mutations, and providing reactive subscriber hooks.
6
+
7
+ ## Installation
8
+
9
+ ```bash
10
+ npm install @ag-ui/client
11
+ pnpm add @ag-ui/client
12
+ yarn add @ag-ui/client
13
+ ```
14
+
15
+ ## Features
16
+
17
+ - 🔗 **HTTP connectivity** – `HttpAgent` for direct server connections with SSE/protobuf support
18
+ - 🏗️ **Custom agents** – `AbstractAgent` base class for building your own transport layer
19
+ - 📡 **Event streaming** – Full AG-UI event processing with validation and transformation
20
+ - 🔄 **State management** – Automatic message/state tracking with reactive updates
21
+ - 🪝 **Subscriber system** – Middleware-style hooks for logging, persistence, and custom logic
22
+ - 🎯 **Middleware support** – Transform and filter events with function or class-based middleware
23
+
24
+ ## Quick example
25
+
26
+ ```ts
27
+ import { HttpAgent } from "@ag-ui/client";
28
+
29
+ const agent = new HttpAgent({
30
+ url: "https://api.example.com/agent",
31
+ headers: { Authorization: "Bearer token" },
32
+ });
33
+
34
+ const result = await agent.runAgent({
35
+ messages: [{ role: "user", content: "Hello!" }],
36
+ });
37
+
38
+ console.log(result.newMessages);
39
+ ```
40
+
41
+ ## Using Middleware
42
+
43
+ ```ts
44
+ import { HttpAgent, FilterToolCallsMiddleware } from "@ag-ui/client";
45
+
46
+ const agent = new HttpAgent({
47
+ url: "https://api.example.com/agent",
48
+ });
49
+
50
+ // Add middleware to transform or filter events
51
+ agent.use(
52
+ // Function middleware for logging
53
+ (input, next) => {
54
+ console.log("Starting run:", input.runId);
55
+ return next.run(input);
56
+ },
57
+
58
+ // Class middleware for filtering tool calls
59
+ new FilterToolCallsMiddleware({
60
+ allowedToolCalls: ["search", "calculate"]
61
+ })
62
+ );
63
+
64
+ await agent.runAgent();
65
+ ```
66
+
67
+ ## Documentation
68
+
69
+ - Concepts & architecture: [`docs/concepts`](https://docs.ag-ui.com/concepts/architecture)
70
+ - Full API reference: [`docs/sdk/js/client`](https://docs.ag-ui.com/sdk/js/client/overview)
71
+
72
+ ## Contributing
73
+
74
+ Bug reports and pull requests are welcome! Please read our [contributing guide](https://docs.ag-ui.com/development/contributing) first.
75
+
76
+ ## License
77
+
78
+ MIT © 2025 AG-UI Protocol Contributors
@@ -0,0 +1,446 @@
1
+ import { Message, State, RunAgentInput, BaseEvent, RunStartedEvent, RunFinishedEvent, RunErrorEvent, StepStartedEvent, StepFinishedEvent, TextMessageStartEvent, TextMessageContentEvent, TextMessageEndEvent, ToolCallStartEvent, ToolCallArgsEvent, ToolCallEndEvent, ToolCallResultEvent, StateSnapshotEvent, StateDeltaEvent, MessagesSnapshotEvent, ActivitySnapshotEvent, ActivityMessage, ActivityDeltaEvent, RawEvent, CustomEvent, ToolCall } from '@ag-ui/core';
2
+ export * from '@ag-ui/core';
3
+ import { Observable } from 'rxjs';
4
+ import { z } from 'zod';
5
+
6
+ interface AgentConfig {
7
+ agentId?: string;
8
+ description?: string;
9
+ threadId?: string;
10
+ initialMessages?: Message[];
11
+ initialState?: State;
12
+ debug?: boolean;
13
+ }
14
+ interface HttpAgentConfig extends AgentConfig {
15
+ url: string;
16
+ headers?: Record<string, string>;
17
+ }
18
+ type RunAgentParameters = Partial<Pick<RunAgentInput, "runId" | "tools" | "context" | "forwardedProps">>;
19
+
20
+ declare const LegacyRuntimeProtocolEvent: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
21
+ type: z.ZodLiteral<"TextMessageStart">;
22
+ messageId: z.ZodString;
23
+ parentMessageId: z.ZodOptional<z.ZodString>;
24
+ role: z.ZodOptional<z.ZodString>;
25
+ }, "strip", z.ZodTypeAny, {
26
+ type: "TextMessageStart";
27
+ messageId: string;
28
+ role?: string | undefined;
29
+ parentMessageId?: string | undefined;
30
+ }, {
31
+ type: "TextMessageStart";
32
+ messageId: string;
33
+ role?: string | undefined;
34
+ parentMessageId?: string | undefined;
35
+ }>, z.ZodObject<{
36
+ type: z.ZodLiteral<"TextMessageContent">;
37
+ messageId: z.ZodString;
38
+ content: z.ZodString;
39
+ }, "strip", z.ZodTypeAny, {
40
+ type: "TextMessageContent";
41
+ messageId: string;
42
+ content: string;
43
+ }, {
44
+ type: "TextMessageContent";
45
+ messageId: string;
46
+ content: string;
47
+ }>, z.ZodObject<{
48
+ type: z.ZodLiteral<"TextMessageEnd">;
49
+ messageId: z.ZodString;
50
+ }, "strip", z.ZodTypeAny, {
51
+ type: "TextMessageEnd";
52
+ messageId: string;
53
+ }, {
54
+ type: "TextMessageEnd";
55
+ messageId: string;
56
+ }>, z.ZodObject<{
57
+ type: z.ZodLiteral<"ActionExecutionStart">;
58
+ actionExecutionId: z.ZodString;
59
+ actionName: z.ZodString;
60
+ parentMessageId: z.ZodOptional<z.ZodString>;
61
+ }, "strip", z.ZodTypeAny, {
62
+ type: "ActionExecutionStart";
63
+ actionExecutionId: string;
64
+ actionName: string;
65
+ parentMessageId?: string | undefined;
66
+ }, {
67
+ type: "ActionExecutionStart";
68
+ actionExecutionId: string;
69
+ actionName: string;
70
+ parentMessageId?: string | undefined;
71
+ }>, z.ZodObject<{
72
+ type: z.ZodLiteral<"ActionExecutionArgs">;
73
+ actionExecutionId: z.ZodString;
74
+ args: z.ZodString;
75
+ }, "strip", z.ZodTypeAny, {
76
+ type: "ActionExecutionArgs";
77
+ actionExecutionId: string;
78
+ args: string;
79
+ }, {
80
+ type: "ActionExecutionArgs";
81
+ actionExecutionId: string;
82
+ args: string;
83
+ }>, z.ZodObject<{
84
+ type: z.ZodLiteral<"ActionExecutionEnd">;
85
+ actionExecutionId: z.ZodString;
86
+ }, "strip", z.ZodTypeAny, {
87
+ type: "ActionExecutionEnd";
88
+ actionExecutionId: string;
89
+ }, {
90
+ type: "ActionExecutionEnd";
91
+ actionExecutionId: string;
92
+ }>, z.ZodObject<{
93
+ type: z.ZodLiteral<"ActionExecutionResult">;
94
+ actionName: z.ZodString;
95
+ actionExecutionId: z.ZodString;
96
+ result: z.ZodString;
97
+ }, "strip", z.ZodTypeAny, {
98
+ type: "ActionExecutionResult";
99
+ actionExecutionId: string;
100
+ actionName: string;
101
+ result: string;
102
+ }, {
103
+ type: "ActionExecutionResult";
104
+ actionExecutionId: string;
105
+ actionName: string;
106
+ result: string;
107
+ }>, z.ZodObject<{
108
+ type: z.ZodLiteral<"AgentStateMessage">;
109
+ threadId: z.ZodString;
110
+ agentName: z.ZodString;
111
+ nodeName: z.ZodString;
112
+ runId: z.ZodString;
113
+ active: z.ZodBoolean;
114
+ role: z.ZodString;
115
+ state: z.ZodString;
116
+ running: z.ZodBoolean;
117
+ }, "strip", z.ZodTypeAny, {
118
+ role: string;
119
+ runId: string;
120
+ threadId: string;
121
+ state: string;
122
+ type: "AgentStateMessage";
123
+ agentName: string;
124
+ nodeName: string;
125
+ active: boolean;
126
+ running: boolean;
127
+ }, {
128
+ role: string;
129
+ runId: string;
130
+ threadId: string;
131
+ state: string;
132
+ type: "AgentStateMessage";
133
+ agentName: string;
134
+ nodeName: string;
135
+ active: boolean;
136
+ running: boolean;
137
+ }>, z.ZodObject<{
138
+ type: z.ZodLiteral<"MetaEvent">;
139
+ name: z.ZodEnum<["LangGraphInterruptEvent", "PredictState", "Exit"]>;
140
+ value: z.ZodAny;
141
+ }, "strip", z.ZodTypeAny, {
142
+ type: "MetaEvent";
143
+ name: "LangGraphInterruptEvent" | "PredictState" | "Exit";
144
+ value?: any;
145
+ }, {
146
+ type: "MetaEvent";
147
+ name: "LangGraphInterruptEvent" | "PredictState" | "Exit";
148
+ value?: any;
149
+ }>, z.ZodObject<{
150
+ type: z.ZodLiteral<"RunError">;
151
+ message: z.ZodString;
152
+ code: z.ZodOptional<z.ZodString>;
153
+ }, "strip", z.ZodTypeAny, {
154
+ type: "RunError";
155
+ message: string;
156
+ code?: string | undefined;
157
+ }, {
158
+ type: "RunError";
159
+ message: string;
160
+ code?: string | undefined;
161
+ }>]>;
162
+ type LegacyRuntimeProtocolEvent = z.infer<typeof LegacyRuntimeProtocolEvent>;
163
+
164
+ interface RunHttpAgentConfig extends RunAgentParameters {
165
+ abortController?: AbortController;
166
+ }
167
+ declare class HttpAgent extends AbstractAgent {
168
+ url: string;
169
+ headers: Record<string, string>;
170
+ abortController: AbortController;
171
+ /**
172
+ * Returns the fetch config for the http request.
173
+ * Override this to customize the request.
174
+ *
175
+ * @returns The fetch config for the http request.
176
+ */
177
+ protected requestInit(input: RunAgentInput): RequestInit;
178
+ runAgent(parameters?: RunHttpAgentConfig, subscriber?: AgentSubscriber): Promise<RunAgentResult>;
179
+ abortRun(): void;
180
+ constructor(config: HttpAgentConfig);
181
+ run(input: RunAgentInput): Observable<BaseEvent>;
182
+ clone(): HttpAgent;
183
+ }
184
+
185
+ type MiddlewareFunction = (input: RunAgentInput, next: AbstractAgent) => Observable<BaseEvent>;
186
+ interface EventWithState {
187
+ event: BaseEvent;
188
+ messages: Message[];
189
+ state: any;
190
+ }
191
+ declare abstract class Middleware {
192
+ abstract run(input: RunAgentInput, next: AbstractAgent): Observable<BaseEvent>;
193
+ /**
194
+ * Runs the next agent in the chain with automatic chunk transformation.
195
+ */
196
+ protected runNext(input: RunAgentInput, next: AbstractAgent): Observable<BaseEvent>;
197
+ /**
198
+ * Runs the next agent and tracks state, providing current messages and state with each event.
199
+ * The messages and state represent the state AFTER the event has been applied.
200
+ */
201
+ protected runNextWithState(input: RunAgentInput, next: AbstractAgent): Observable<EventWithState>;
202
+ }
203
+ declare class FunctionMiddleware extends Middleware {
204
+ private fn;
205
+ constructor(fn: MiddlewareFunction);
206
+ run(input: RunAgentInput, next: AbstractAgent): Observable<BaseEvent>;
207
+ }
208
+
209
+ type FilterToolCallsConfig = {
210
+ allowedToolCalls: string[];
211
+ disallowedToolCalls?: never;
212
+ } | {
213
+ disallowedToolCalls: string[];
214
+ allowedToolCalls?: never;
215
+ };
216
+ declare class FilterToolCallsMiddleware extends Middleware {
217
+ private blockedToolCallIds;
218
+ private readonly allowedTools?;
219
+ private readonly disallowedTools?;
220
+ constructor(config: FilterToolCallsConfig);
221
+ run(input: RunAgentInput, next: AbstractAgent): Observable<BaseEvent>;
222
+ private shouldFilterTool;
223
+ }
224
+
225
+ /**
226
+ * Middleware placeholder that maintains compatibility with AG-UI 0.0.39 flows.
227
+ * Currently it simply forwards all events to the next middleware/agent.
228
+ */
229
+ declare class BackwardCompatibility_0_0_39 extends Middleware {
230
+ run(input: RunAgentInput, next: AbstractAgent): Observable<BaseEvent>;
231
+ }
232
+
233
+ interface RunAgentResult {
234
+ result: any;
235
+ newMessages: Message[];
236
+ }
237
+ declare abstract class AbstractAgent {
238
+ agentId?: string;
239
+ description: string;
240
+ threadId: string;
241
+ messages: Message[];
242
+ state: State;
243
+ debug: boolean;
244
+ subscribers: AgentSubscriber[];
245
+ isRunning: boolean;
246
+ private middlewares;
247
+ private activeRunDetach$?;
248
+ private activeRunCompletionPromise?;
249
+ get maxVersion(): string;
250
+ constructor({ agentId, description, threadId, initialMessages, initialState, debug, }?: AgentConfig);
251
+ subscribe(subscriber: AgentSubscriber): {
252
+ unsubscribe: () => void;
253
+ };
254
+ abstract run(input: RunAgentInput): Observable<BaseEvent>;
255
+ use(...middlewares: (Middleware | MiddlewareFunction)[]): this;
256
+ runAgent(parameters?: RunAgentParameters, subscriber?: AgentSubscriber): Promise<RunAgentResult>;
257
+ protected connect(input: RunAgentInput): Observable<BaseEvent>;
258
+ connectAgent(parameters?: RunAgentParameters, subscriber?: AgentSubscriber): Promise<RunAgentResult>;
259
+ abortRun(): void;
260
+ detachActiveRun(): Promise<void>;
261
+ protected apply(input: RunAgentInput, events$: Observable<BaseEvent>, subscribers: AgentSubscriber[]): Observable<AgentStateMutation>;
262
+ protected processApplyEvents(input: RunAgentInput, events$: Observable<AgentStateMutation>, subscribers: AgentSubscriber[]): Observable<AgentStateMutation>;
263
+ protected prepareRunAgentInput(parameters?: RunAgentParameters): RunAgentInput;
264
+ protected onInitialize(input: RunAgentInput, subscribers: AgentSubscriber[]): Promise<void>;
265
+ protected onError(input: RunAgentInput, error: Error, subscribers: AgentSubscriber[]): Observable<AgentStateMutation>;
266
+ protected onFinalize(input: RunAgentInput, subscribers: AgentSubscriber[]): Promise<void>;
267
+ clone(): any;
268
+ addMessage(message: Message): void;
269
+ addMessages(messages: Message[]): void;
270
+ setMessages(messages: Message[]): void;
271
+ setState(state: State): void;
272
+ legacy_to_be_removed_runAgentBridged(config?: RunAgentParameters): Observable<LegacyRuntimeProtocolEvent>;
273
+ }
274
+
275
+ interface AgentStateMutation {
276
+ messages?: Message[];
277
+ state?: State;
278
+ stopPropagation?: boolean;
279
+ }
280
+ interface AgentSubscriberParams {
281
+ messages: Message[];
282
+ state: State;
283
+ agent: AbstractAgent;
284
+ input: RunAgentInput;
285
+ }
286
+ type MaybePromise<T> = T | Promise<T>;
287
+ interface AgentSubscriber {
288
+ onRunInitialized?(params: AgentSubscriberParams): MaybePromise<Omit<AgentStateMutation, "stopPropagation"> | void>;
289
+ onRunFailed?(params: {
290
+ error: Error;
291
+ } & AgentSubscriberParams): MaybePromise<Omit<AgentStateMutation, "stopPropagation"> | void>;
292
+ onRunFinalized?(params: AgentSubscriberParams): MaybePromise<Omit<AgentStateMutation, "stopPropagation"> | void>;
293
+ onEvent?(params: {
294
+ event: BaseEvent;
295
+ } & AgentSubscriberParams): MaybePromise<AgentStateMutation | void>;
296
+ onRunStartedEvent?(params: {
297
+ event: RunStartedEvent;
298
+ } & AgentSubscriberParams): MaybePromise<AgentStateMutation | void>;
299
+ onRunFinishedEvent?(params: {
300
+ event: RunFinishedEvent;
301
+ result?: any;
302
+ } & AgentSubscriberParams): MaybePromise<AgentStateMutation | void>;
303
+ onRunErrorEvent?(params: {
304
+ event: RunErrorEvent;
305
+ } & AgentSubscriberParams): MaybePromise<AgentStateMutation | void>;
306
+ onStepStartedEvent?(params: {
307
+ event: StepStartedEvent;
308
+ } & AgentSubscriberParams): MaybePromise<AgentStateMutation | void>;
309
+ onStepFinishedEvent?(params: {
310
+ event: StepFinishedEvent;
311
+ } & AgentSubscriberParams): MaybePromise<AgentStateMutation | void>;
312
+ onTextMessageStartEvent?(params: {
313
+ event: TextMessageStartEvent;
314
+ } & AgentSubscriberParams): MaybePromise<AgentStateMutation | void>;
315
+ onTextMessageContentEvent?(params: {
316
+ event: TextMessageContentEvent;
317
+ textMessageBuffer: string;
318
+ } & AgentSubscriberParams): MaybePromise<AgentStateMutation | void>;
319
+ onTextMessageEndEvent?(params: {
320
+ event: TextMessageEndEvent;
321
+ textMessageBuffer: string;
322
+ } & AgentSubscriberParams): MaybePromise<AgentStateMutation | void>;
323
+ onToolCallStartEvent?(params: {
324
+ event: ToolCallStartEvent;
325
+ } & AgentSubscriberParams): MaybePromise<AgentStateMutation | void>;
326
+ onToolCallArgsEvent?(params: {
327
+ event: ToolCallArgsEvent;
328
+ toolCallBuffer: string;
329
+ toolCallName: string;
330
+ partialToolCallArgs: Record<string, any>;
331
+ } & AgentSubscriberParams): MaybePromise<AgentStateMutation | void>;
332
+ onToolCallEndEvent?(params: {
333
+ event: ToolCallEndEvent;
334
+ toolCallName: string;
335
+ toolCallArgs: Record<string, any>;
336
+ } & AgentSubscriberParams): MaybePromise<AgentStateMutation | void>;
337
+ onToolCallResultEvent?(params: {
338
+ event: ToolCallResultEvent;
339
+ } & AgentSubscriberParams): MaybePromise<AgentStateMutation | void>;
340
+ onStateSnapshotEvent?(params: {
341
+ event: StateSnapshotEvent;
342
+ } & AgentSubscriberParams): MaybePromise<AgentStateMutation | void>;
343
+ onStateDeltaEvent?(params: {
344
+ event: StateDeltaEvent;
345
+ } & AgentSubscriberParams): MaybePromise<AgentStateMutation | void>;
346
+ onMessagesSnapshotEvent?(params: {
347
+ event: MessagesSnapshotEvent;
348
+ } & AgentSubscriberParams): MaybePromise<AgentStateMutation | void>;
349
+ onActivitySnapshotEvent?(params: {
350
+ event: ActivitySnapshotEvent;
351
+ activityMessage?: ActivityMessage;
352
+ existingMessage?: Message;
353
+ } & AgentSubscriberParams): MaybePromise<AgentStateMutation | void>;
354
+ onActivityDeltaEvent?(params: {
355
+ event: ActivityDeltaEvent;
356
+ activityMessage?: ActivityMessage;
357
+ } & AgentSubscriberParams): MaybePromise<AgentStateMutation | void>;
358
+ onRawEvent?(params: {
359
+ event: RawEvent;
360
+ } & AgentSubscriberParams): MaybePromise<AgentStateMutation | void>;
361
+ onCustomEvent?(params: {
362
+ event: CustomEvent;
363
+ } & AgentSubscriberParams): MaybePromise<AgentStateMutation | void>;
364
+ onMessagesChanged?(params: Omit<AgentSubscriberParams, "input"> & {
365
+ input?: RunAgentInput;
366
+ }): MaybePromise<void>;
367
+ onStateChanged?(params: Omit<AgentSubscriberParams, "input"> & {
368
+ input?: RunAgentInput;
369
+ }): MaybePromise<void>;
370
+ onNewMessage?(params: {
371
+ message: Message;
372
+ } & Omit<AgentSubscriberParams, "input"> & {
373
+ input?: RunAgentInput;
374
+ }): MaybePromise<void>;
375
+ onNewToolCall?(params: {
376
+ toolCall: ToolCall;
377
+ } & Omit<AgentSubscriberParams, "input"> & {
378
+ input?: RunAgentInput;
379
+ }): MaybePromise<void>;
380
+ }
381
+
382
+ declare const defaultApplyEvents: (input: RunAgentInput, events$: Observable<BaseEvent>, agent: AbstractAgent, subscribers: AgentSubscriber[]) => Observable<AgentStateMutation>;
383
+
384
+ declare const verifyEvents: (debug: boolean) => (source$: Observable<BaseEvent>) => Observable<BaseEvent>;
385
+
386
+ declare enum HttpEventType {
387
+ HEADERS = "headers",
388
+ DATA = "data"
389
+ }
390
+ interface HttpDataEvent {
391
+ type: HttpEventType.DATA;
392
+ data?: Uint8Array;
393
+ }
394
+ interface HttpHeadersEvent {
395
+ type: HttpEventType.HEADERS;
396
+ status: number;
397
+ headers: Headers;
398
+ }
399
+ type HttpEvent = HttpDataEvent | HttpHeadersEvent;
400
+ declare const runHttpRequest: (url: string, requestInit: RequestInit) => Observable<HttpEvent>;
401
+
402
+ /**
403
+ * Transforms HTTP events into BaseEvents using the appropriate format parser based on content type.
404
+ */
405
+ declare const transformHttpEventStream: (source$: Observable<HttpEvent>) => Observable<BaseEvent>;
406
+
407
+ /**
408
+ * Parses a stream of HTTP events into a stream of JSON objects using Server-Sent Events (SSE) format.
409
+ * Strictly follows the SSE standard where:
410
+ * - Events are separated by double newlines ('\n\n')
411
+ * - Only 'data:' prefixed lines are processed
412
+ * - Multi-line data events are supported and joined
413
+ * - Non-data fields (event, id, retry) are ignored
414
+ */
415
+ declare const parseSSEStream: (source$: Observable<HttpEvent>) => Observable<any>;
416
+
417
+ /**
418
+ * Parses a stream of HTTP events into a stream of BaseEvent objects using Protocol Buffer format.
419
+ * Each message is prefixed with a 4-byte length header (uint32 in big-endian format)
420
+ * followed by the protocol buffer encoded message.
421
+ */
422
+ declare const parseProtoStream: (source$: Observable<HttpEvent>) => Observable<BaseEvent>;
423
+
424
+ declare const convertToLegacyEvents: (threadId: string, runId: string, agentName: string) => (events$: Observable<BaseEvent>) => Observable<LegacyRuntimeProtocolEvent>;
425
+
426
+ declare const structuredClone_: <T>(obj: T) => T;
427
+ /**
428
+ * Generate a random UUID v4
429
+ * Cross-platform compatible (Node.js, browsers, React Native)
430
+ */
431
+ declare function randomUUID(): string;
432
+
433
+ /**
434
+ * Compacts streaming events by consolidating multiple deltas into single events.
435
+ * For text messages: multiple content deltas become one concatenated delta.
436
+ * For tool calls: multiple args deltas become one concatenated delta.
437
+ * Events between related streaming events are reordered to keep streaming events together.
438
+ *
439
+ * @param events - Array of events to compact
440
+ * @returns Compacted array of events
441
+ */
442
+ declare function compactEvents(events: BaseEvent[]): BaseEvent[];
443
+
444
+ declare const transformChunks: (debug: boolean) => (events$: Observable<BaseEvent>) => Observable<BaseEvent>;
445
+
446
+ export { AbstractAgent, type AgentConfig, type AgentStateMutation, type AgentSubscriber, type AgentSubscriberParams, BackwardCompatibility_0_0_39, FilterToolCallsMiddleware, FunctionMiddleware, HttpAgent, type HttpAgentConfig, Middleware, type MiddlewareFunction, type RunAgentParameters, type RunAgentResult, compactEvents, convertToLegacyEvents, defaultApplyEvents, parseProtoStream, parseSSEStream, randomUUID, runHttpRequest, structuredClone_, transformChunks, transformHttpEventStream, verifyEvents };