@ag-ui/langgraph 0.0.19-alpha.0 → 0.0.19-alpha.2

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/dist/index.d.mts CHANGED
@@ -1,11 +1,12 @@
1
1
  import { TextMessageStartEvent, TextMessageContentEvent, TextMessageEndEvent, ThinkingTextMessageStartEvent, ThinkingTextMessageContentEvent, ThinkingTextMessageEndEvent, ToolCallStartEvent, ToolCallArgsEvent, ToolCallEndEvent, ToolCallResultEvent, ThinkingStartEvent, ThinkingEndEvent, StateSnapshotEvent, StateDeltaEvent, MessagesSnapshotEvent, RawEvent, CustomEvent, RunStartedEvent, RunFinishedEvent, RunErrorEvent, StepStartedEvent, StepFinishedEvent, AgentConfig, AbstractAgent, RunAgentInput as RunAgentInput$1, HttpAgent } from '@ag-ui/client';
2
- import * as _langchain_langgraph_sdk_dist_types_stream from '@langchain/langgraph-sdk/dist/types.stream';
2
+ import * as _langchain_core_tracers_tracer_langchain from '@langchain/core/tracers/tracer_langchain';
3
+ import * as _langchain_langgraph_sdk_dist_types from '@langchain/langgraph-sdk/dist/types';
4
+ import { RunsStreamPayload } from '@langchain/langgraph-sdk/dist/types';
3
5
  import * as _langchain_langgraph_sdk from '@langchain/langgraph-sdk';
4
6
  import { Message, AssistantGraph, Client, Config, Assistant, StreamMode, ThreadState, Thread } from '@langchain/langgraph-sdk';
5
7
  import { Subscriber, Observable } from 'rxjs';
6
8
  import { MessageType } from '@langchain/core/messages';
7
9
  import { RunAgentInput } from '@ag-ui/core';
8
- import { RunsStreamPayload } from '@langchain/langgraph-sdk/dist/types';
9
10
 
10
11
  declare enum LangGraphEventTypes {
11
12
  OnChainStart = "on_chain_start",
@@ -139,19 +140,506 @@ declare class LangGraphAgent extends AbstractAgent {
139
140
  run(input: RunAgentInput$1): Observable<ProcessedEvents>;
140
141
  runAgentStream(input: RunAgentExtendedInput, subscriber: Subscriber<ProcessedEvents>): Promise<void>;
141
142
  prepareRegenerateStream(input: RegenerateInput, streamMode: StreamMode | StreamMode[]): Promise<void | {
142
- streamResponse: _langchain_langgraph_sdk_dist_types_stream.TypedAsyncGenerator<"messages" | "values" | "updates" | "events" | "debug" | "tasks" | "checkpoints" | "custom" | "messages-tuple" | StreamMode[], false, _langchain_langgraph_sdk.DefaultValues, _langchain_langgraph_sdk.DefaultValues, unknown>;
143
+ payload: {
144
+ input: State<StateEnrichment>;
145
+ checkpointId: any;
146
+ streamMode: StreamMode | StreamMode[];
147
+ context?: unknown;
148
+ streamSubgraphs?: false | undefined;
149
+ streamResumable?: boolean | undefined;
150
+ feedbackKeys?: string[] | undefined;
151
+ metadata?: _langchain_langgraph_sdk.Metadata;
152
+ config?: Config | undefined;
153
+ checkpoint?: Omit<_langchain_langgraph_sdk.Checkpoint, "thread_id"> | undefined;
154
+ checkpointDuring?: boolean | undefined;
155
+ durability?: _langchain_langgraph_sdk_dist_types.Durability | undefined;
156
+ interruptBefore?: "*" | string[] | undefined;
157
+ interruptAfter?: "*" | string[] | undefined;
158
+ multitaskStrategy?: _langchain_langgraph_sdk_dist_types.MultitaskStrategy | undefined;
159
+ signal?: AbortController["signal"] | undefined;
160
+ onCompletion?: _langchain_langgraph_sdk_dist_types.OnCompletionBehavior | undefined;
161
+ webhook?: string | undefined;
162
+ onDisconnect?: _langchain_langgraph_sdk_dist_types.DisconnectMode | undefined;
163
+ afterSeconds?: number | undefined;
164
+ ifNotExists?: "create" | "reject" | undefined;
165
+ command?: _langchain_langgraph_sdk.Command | undefined;
166
+ onRunCreated?: ((params: {
167
+ run_id: string;
168
+ thread_id?: string;
169
+ }) => void) | undefined;
170
+ _langsmithTracer?: _langchain_core_tracers_tracer_langchain.LangChainTracer | undefined;
171
+ nodeName?: string;
172
+ threadMetadata?: Record<string, any>;
173
+ };
143
174
  state: ThreadState<State>;
144
- streamMode: StreamMode | StreamMode[];
145
175
  }>;
146
176
  prepareStream(input: RunAgentExtendedInput, streamMode: StreamMode | StreamMode[]): Promise<void | {
147
- streamResponse: _langchain_langgraph_sdk_dist_types_stream.TypedAsyncGenerator<"messages" | "values" | "updates" | "events" | "debug" | "tasks" | "checkpoints" | "custom" | "messages-tuple" | StreamMode[], false, _langchain_langgraph_sdk.DefaultValues, _langchain_langgraph_sdk.DefaultValues, unknown>;
177
+ payload: {
178
+ input: State<StateEnrichment>;
179
+ checkpointId: any;
180
+ streamMode: StreamMode | StreamMode[];
181
+ context?: unknown;
182
+ streamSubgraphs?: false | undefined;
183
+ streamResumable?: boolean | undefined;
184
+ feedbackKeys?: string[] | undefined;
185
+ metadata?: _langchain_langgraph_sdk.Metadata;
186
+ config?: Config | undefined;
187
+ checkpoint?: Omit<_langchain_langgraph_sdk.Checkpoint, "thread_id"> | undefined;
188
+ checkpointDuring?: boolean | undefined;
189
+ durability?: _langchain_langgraph_sdk_dist_types.Durability | undefined;
190
+ interruptBefore?: "*" | string[] | undefined;
191
+ interruptAfter?: "*" | string[] | undefined;
192
+ multitaskStrategy?: _langchain_langgraph_sdk_dist_types.MultitaskStrategy | undefined;
193
+ signal?: AbortController["signal"] | undefined;
194
+ onCompletion?: _langchain_langgraph_sdk_dist_types.OnCompletionBehavior | undefined;
195
+ webhook?: string | undefined;
196
+ onDisconnect?: _langchain_langgraph_sdk_dist_types.DisconnectMode | undefined;
197
+ afterSeconds?: number | undefined;
198
+ ifNotExists?: "create" | "reject" | undefined;
199
+ command?: _langchain_langgraph_sdk.Command | undefined;
200
+ onRunCreated?: ((params: {
201
+ run_id: string;
202
+ thread_id?: string;
203
+ }) => void) | undefined;
204
+ _langsmithTracer?: _langchain_core_tracers_tracer_langchain.LangChainTracer | undefined;
205
+ nodeName?: string;
206
+ threadMetadata?: Record<string, any>;
207
+ };
148
208
  state: ThreadState<State>;
149
- streamMode: StreamMode | StreamMode[];
150
209
  } | {
151
- streamResponse: _langchain_langgraph_sdk_dist_types_stream.TypedAsyncGenerator<"messages" | "values" | "updates" | "events" | "debug" | "tasks" | "checkpoints" | "custom" | "messages-tuple" | StreamMode[], false, _langchain_langgraph_sdk.DefaultValues, _langchain_langgraph_sdk.DefaultValues, unknown>;
210
+ payload: {
211
+ streamMode: StreamMode | StreamMode[];
212
+ input: State | null;
213
+ config: Config | undefined;
214
+ context: {
215
+ thread_id?: string | null | undefined;
216
+ checkpoint_id?: string | null | undefined;
217
+ length: number;
218
+ toString(): string;
219
+ toLocaleString(): string;
220
+ toLocaleString(locales: string | string[], options?: Intl.NumberFormatOptions & Intl.DateTimeFormatOptions): string;
221
+ pop(): {
222
+ value: string;
223
+ description: string;
224
+ } | undefined;
225
+ push(...items: {
226
+ value: string;
227
+ description: string;
228
+ }[]): number;
229
+ concat(...items: ConcatArray<{
230
+ value: string;
231
+ description: string;
232
+ }>[]): {
233
+ value: string;
234
+ description: string;
235
+ }[];
236
+ concat(...items: ({
237
+ value: string;
238
+ description: string;
239
+ } | ConcatArray<{
240
+ value: string;
241
+ description: string;
242
+ }>)[]): {
243
+ value: string;
244
+ description: string;
245
+ }[];
246
+ join(separator?: string): string;
247
+ reverse(): {
248
+ value: string;
249
+ description: string;
250
+ }[];
251
+ shift(): {
252
+ value: string;
253
+ description: string;
254
+ } | undefined;
255
+ slice(start?: number, end?: number): {
256
+ value: string;
257
+ description: string;
258
+ }[];
259
+ sort(compareFn?: ((a: {
260
+ value: string;
261
+ description: string;
262
+ }, b: {
263
+ value: string;
264
+ description: string;
265
+ }) => number) | undefined): {
266
+ value: string;
267
+ description: string;
268
+ }[];
269
+ splice(start: number, deleteCount?: number): {
270
+ value: string;
271
+ description: string;
272
+ }[];
273
+ splice(start: number, deleteCount: number, ...items: {
274
+ value: string;
275
+ description: string;
276
+ }[]): {
277
+ value: string;
278
+ description: string;
279
+ }[];
280
+ unshift(...items: {
281
+ value: string;
282
+ description: string;
283
+ }[]): number;
284
+ indexOf(searchElement: {
285
+ value: string;
286
+ description: string;
287
+ }, fromIndex?: number): number;
288
+ lastIndexOf(searchElement: {
289
+ value: string;
290
+ description: string;
291
+ }, fromIndex?: number): number;
292
+ every<S extends {
293
+ value: string;
294
+ description: string;
295
+ }>(predicate: (value: {
296
+ value: string;
297
+ description: string;
298
+ }, index: number, array: {
299
+ value: string;
300
+ description: string;
301
+ }[]) => value is S, thisArg?: any): this is S[];
302
+ every(predicate: (value: {
303
+ value: string;
304
+ description: string;
305
+ }, index: number, array: {
306
+ value: string;
307
+ description: string;
308
+ }[]) => unknown, thisArg?: any): boolean;
309
+ some(predicate: (value: {
310
+ value: string;
311
+ description: string;
312
+ }, index: number, array: {
313
+ value: string;
314
+ description: string;
315
+ }[]) => unknown, thisArg?: any): boolean;
316
+ forEach(callbackfn: (value: {
317
+ value: string;
318
+ description: string;
319
+ }, index: number, array: {
320
+ value: string;
321
+ description: string;
322
+ }[]) => void, thisArg?: any): void;
323
+ map<U>(callbackfn: (value: {
324
+ value: string;
325
+ description: string;
326
+ }, index: number, array: {
327
+ value: string;
328
+ description: string;
329
+ }[]) => U, thisArg?: any): U[];
330
+ filter<S extends {
331
+ value: string;
332
+ description: string;
333
+ }>(predicate: (value: {
334
+ value: string;
335
+ description: string;
336
+ }, index: number, array: {
337
+ value: string;
338
+ description: string;
339
+ }[]) => value is S, thisArg?: any): S[];
340
+ filter(predicate: (value: {
341
+ value: string;
342
+ description: string;
343
+ }, index: number, array: {
344
+ value: string;
345
+ description: string;
346
+ }[]) => unknown, thisArg?: any): {
347
+ value: string;
348
+ description: string;
349
+ }[];
350
+ reduce(callbackfn: (previousValue: {
351
+ value: string;
352
+ description: string;
353
+ }, currentValue: {
354
+ value: string;
355
+ description: string;
356
+ }, currentIndex: number, array: {
357
+ value: string;
358
+ description: string;
359
+ }[]) => {
360
+ value: string;
361
+ description: string;
362
+ }): {
363
+ value: string;
364
+ description: string;
365
+ };
366
+ reduce(callbackfn: (previousValue: {
367
+ value: string;
368
+ description: string;
369
+ }, currentValue: {
370
+ value: string;
371
+ description: string;
372
+ }, currentIndex: number, array: {
373
+ value: string;
374
+ description: string;
375
+ }[]) => {
376
+ value: string;
377
+ description: string;
378
+ }, initialValue: {
379
+ value: string;
380
+ description: string;
381
+ }): {
382
+ value: string;
383
+ description: string;
384
+ };
385
+ reduce<U>(callbackfn: (previousValue: U, currentValue: {
386
+ value: string;
387
+ description: string;
388
+ }, currentIndex: number, array: {
389
+ value: string;
390
+ description: string;
391
+ }[]) => U, initialValue: U): U;
392
+ reduceRight(callbackfn: (previousValue: {
393
+ value: string;
394
+ description: string;
395
+ }, currentValue: {
396
+ value: string;
397
+ description: string;
398
+ }, currentIndex: number, array: {
399
+ value: string;
400
+ description: string;
401
+ }[]) => {
402
+ value: string;
403
+ description: string;
404
+ }): {
405
+ value: string;
406
+ description: string;
407
+ };
408
+ reduceRight(callbackfn: (previousValue: {
409
+ value: string;
410
+ description: string;
411
+ }, currentValue: {
412
+ value: string;
413
+ description: string;
414
+ }, currentIndex: number, array: {
415
+ value: string;
416
+ description: string;
417
+ }[]) => {
418
+ value: string;
419
+ description: string;
420
+ }, initialValue: {
421
+ value: string;
422
+ description: string;
423
+ }): {
424
+ value: string;
425
+ description: string;
426
+ };
427
+ reduceRight<U>(callbackfn: (previousValue: U, currentValue: {
428
+ value: string;
429
+ description: string;
430
+ }, currentIndex: number, array: {
431
+ value: string;
432
+ description: string;
433
+ }[]) => U, initialValue: U): U;
434
+ find<S extends {
435
+ value: string;
436
+ description: string;
437
+ }>(predicate: (value: {
438
+ value: string;
439
+ description: string;
440
+ }, index: number, obj: {
441
+ value: string;
442
+ description: string;
443
+ }[]) => value is S, thisArg?: any): S | undefined;
444
+ find(predicate: (value: {
445
+ value: string;
446
+ description: string;
447
+ }, index: number, obj: {
448
+ value: string;
449
+ description: string;
450
+ }[]) => unknown, thisArg?: any): {
451
+ value: string;
452
+ description: string;
453
+ } | undefined;
454
+ findIndex(predicate: (value: {
455
+ value: string;
456
+ description: string;
457
+ }, index: number, obj: {
458
+ value: string;
459
+ description: string;
460
+ }[]) => unknown, thisArg?: any): number;
461
+ fill(value: {
462
+ value: string;
463
+ description: string;
464
+ }, start?: number, end?: number): {
465
+ value: string;
466
+ description: string;
467
+ }[];
468
+ copyWithin(target: number, start: number, end?: number): {
469
+ value: string;
470
+ description: string;
471
+ }[];
472
+ entries(): ArrayIterator<[number, {
473
+ value: string;
474
+ description: string;
475
+ }]>;
476
+ keys(): ArrayIterator<number>;
477
+ values(): ArrayIterator<{
478
+ value: string;
479
+ description: string;
480
+ }>;
481
+ includes(searchElement: {
482
+ value: string;
483
+ description: string;
484
+ }, fromIndex?: number): boolean;
485
+ flatMap<U, This = undefined>(callback: (this: This, value: {
486
+ value: string;
487
+ description: string;
488
+ }, index: number, array: {
489
+ value: string;
490
+ description: string;
491
+ }[]) => U | readonly U[], thisArg?: This | undefined): U[];
492
+ flat<A, D extends number = 1>(this: A, depth?: D | undefined): FlatArray<A, D>[];
493
+ at(index: number): {
494
+ value: string;
495
+ description: string;
496
+ } | undefined;
497
+ findLast<S extends {
498
+ value: string;
499
+ description: string;
500
+ }>(predicate: (value: {
501
+ value: string;
502
+ description: string;
503
+ }, index: number, array: {
504
+ value: string;
505
+ description: string;
506
+ }[]) => value is S, thisArg?: any): S | undefined;
507
+ findLast(predicate: (value: {
508
+ value: string;
509
+ description: string;
510
+ }, index: number, array: {
511
+ value: string;
512
+ description: string;
513
+ }[]) => unknown, thisArg?: any): {
514
+ value: string;
515
+ description: string;
516
+ } | undefined;
517
+ findLastIndex(predicate: (value: {
518
+ value: string;
519
+ description: string;
520
+ }, index: number, array: {
521
+ value: string;
522
+ description: string;
523
+ }[]) => unknown, thisArg?: any): number;
524
+ toReversed(): {
525
+ value: string;
526
+ description: string;
527
+ }[];
528
+ toSorted(compareFn?: ((a: {
529
+ value: string;
530
+ description: string;
531
+ }, b: {
532
+ value: string;
533
+ description: string;
534
+ }) => number) | undefined): {
535
+ value: string;
536
+ description: string;
537
+ }[];
538
+ toSpliced(start: number, deleteCount: number, ...items: {
539
+ value: string;
540
+ description: string;
541
+ }[]): {
542
+ value: string;
543
+ description: string;
544
+ }[];
545
+ toSpliced(start: number, deleteCount?: number): {
546
+ value: string;
547
+ description: string;
548
+ }[];
549
+ with(index: number, value: {
550
+ value: string;
551
+ description: string;
552
+ }): {
553
+ value: string;
554
+ description: string;
555
+ }[];
556
+ [Symbol.iterator](): ArrayIterator<{
557
+ value: string;
558
+ description: string;
559
+ }>;
560
+ [Symbol.unscopables]: {
561
+ [x: number]: boolean | undefined;
562
+ length?: boolean | undefined;
563
+ toString?: boolean | undefined;
564
+ toLocaleString?: boolean | undefined;
565
+ pop?: boolean | undefined;
566
+ push?: boolean | undefined;
567
+ concat?: boolean | undefined;
568
+ join?: boolean | undefined;
569
+ reverse?: boolean | undefined;
570
+ shift?: boolean | undefined;
571
+ slice?: boolean | undefined;
572
+ sort?: boolean | undefined;
573
+ splice?: boolean | undefined;
574
+ unshift?: boolean | undefined;
575
+ indexOf?: boolean | undefined;
576
+ lastIndexOf?: boolean | undefined;
577
+ every?: boolean | undefined;
578
+ some?: boolean | undefined;
579
+ forEach?: boolean | undefined;
580
+ map?: boolean | undefined;
581
+ filter?: boolean | undefined;
582
+ reduce?: boolean | undefined;
583
+ reduceRight?: boolean | undefined;
584
+ find?: boolean | undefined;
585
+ findIndex?: boolean | undefined;
586
+ fill?: boolean | undefined;
587
+ copyWithin?: boolean | undefined;
588
+ entries?: boolean | undefined;
589
+ keys?: boolean | undefined;
590
+ values?: boolean | undefined;
591
+ includes?: boolean | undefined;
592
+ flatMap?: boolean | undefined;
593
+ flat?: boolean | undefined;
594
+ at?: boolean | undefined;
595
+ findLast?: boolean | undefined;
596
+ findLastIndex?: boolean | undefined;
597
+ toReversed?: boolean | undefined;
598
+ toSorted?: boolean | undefined;
599
+ toSpliced?: boolean | undefined;
600
+ with?: boolean | undefined;
601
+ [Symbol.iterator]?: boolean | undefined;
602
+ readonly [Symbol.unscopables]?: boolean | undefined;
603
+ };
604
+ };
605
+ streamSubgraphs?: false | undefined;
606
+ streamResumable?: boolean;
607
+ feedbackKeys?: string[];
608
+ metadata?: _langchain_langgraph_sdk.Metadata;
609
+ checkpointId?: string;
610
+ checkpoint?: Omit<_langchain_langgraph_sdk.Checkpoint, "thread_id">;
611
+ checkpointDuring?: boolean;
612
+ durability?: _langchain_langgraph_sdk_dist_types.Durability;
613
+ interruptBefore?: "*" | string[];
614
+ interruptAfter?: "*" | string[];
615
+ multitaskStrategy?: _langchain_langgraph_sdk_dist_types.MultitaskStrategy;
616
+ signal?: AbortController["signal"];
617
+ onCompletion?: _langchain_langgraph_sdk_dist_types.OnCompletionBehavior;
618
+ webhook?: string;
619
+ onDisconnect?: _langchain_langgraph_sdk_dist_types.DisconnectMode;
620
+ afterSeconds?: number;
621
+ ifNotExists?: "create" | "reject";
622
+ command?: _langchain_langgraph_sdk.Command;
623
+ onRunCreated?: (params: {
624
+ run_id: string;
625
+ thread_id?: string;
626
+ }) => void;
627
+ _langsmithTracer?: _langchain_core_tracers_tracer_langchain.LangChainTracer;
628
+ nodeName?: string;
629
+ threadMetadata?: Record<string, any>;
630
+ };
152
631
  state: ThreadState<State>;
153
632
  }>;
154
- handleStreamEvents(stream: Awaited<ReturnType<typeof this.prepareStream> | ReturnType<typeof this.prepareRegenerateStream>>, threadId: string, subscriber: Subscriber<ProcessedEvents>, input: RunAgentExtendedInput, streamModes: StreamMode | StreamMode[]): Promise<void>;
633
+ handleStreamEvents({ threadId, payload, state, subscriber, input, streamMode, }: {
634
+ threadId: string;
635
+ payload: Omit<RunsStreamPayload, 'streamMode'> & {
636
+ streamMode: StreamMode | StreamMode[];
637
+ };
638
+ state: ThreadState<State>;
639
+ subscriber: Subscriber<ProcessedEvents>;
640
+ input: RunAgentExtendedInput;
641
+ streamMode: StreamMode | StreamMode[];
642
+ }): Promise<void>;
155
643
  handleSingleEvent(event: any): void;
156
644
  handleThinkingEvent(reasoningData: LangGraphReasoning): void;
157
645
  getStateSnapshot(threadState: ThreadState<State>): State;