ai-stream-utils 2.0.0 → 2.0.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/dist/index.d.mts +7 -7
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -529,9 +529,9 @@ declare class ChunkPipeline<UI_MESSAGE extends UIMessage, CHUNK extends InferUIM
|
|
|
529
529
|
* Use with includeChunks(), includeParts(), excludeChunks(), or excludeParts().
|
|
530
530
|
* The callback only receives content chunks because meta chunks pass through unchanged.
|
|
531
531
|
*/
|
|
532
|
-
filter<NARROWED_CHUNK extends
|
|
533
|
-
type:
|
|
534
|
-
}>(guard: FilterGuard<UI_MESSAGE, NARROWED_CHUNK, NARROWED_PART>): ChunkPipeline<UI_MESSAGE, NARROWED_CHUNK, NARROWED_PART>;
|
|
532
|
+
filter<NARROWED_CHUNK extends CHUNK, NARROWED_PART extends {
|
|
533
|
+
type: PART[`type`];
|
|
534
|
+
}>(guard: FilterGuard<UI_MESSAGE, NARROWED_CHUNK, NARROWED_PART>): ChunkPipeline<UI_MESSAGE, CHUNK & NARROWED_CHUNK, PART & NARROWED_PART>;
|
|
535
535
|
/**
|
|
536
536
|
* Filters chunks using a generic predicate function.
|
|
537
537
|
* The callback only receives content chunks because meta chunks pass through unchanged.
|
|
@@ -549,8 +549,8 @@ declare class ChunkPipeline<UI_MESSAGE extends UIMessage, CHUNK extends InferUIM
|
|
|
549
549
|
* Content chunks include a part object with the type, while meta chunks have undefined part.
|
|
550
550
|
* All chunks pass through regardless of whether the callback is invoked.
|
|
551
551
|
*/
|
|
552
|
-
on<NARROWED_CHUNK extends
|
|
553
|
-
type:
|
|
552
|
+
on<NARROWED_CHUNK extends CHUNK, NARROWED_PART extends {
|
|
553
|
+
type: PART[`type`];
|
|
554
554
|
} | undefined>(guard: ObserveGuard<UI_MESSAGE, NARROWED_CHUNK, NARROWED_PART>, callback: ChunkObserveFn<NARROWED_CHUNK, NARROWED_PART>): ChunkPipeline<UI_MESSAGE, CHUNK, PART>;
|
|
555
555
|
/**
|
|
556
556
|
* Observes chunks matching a predicate without filtering them.
|
|
@@ -638,7 +638,7 @@ declare function includeParts<UI_MESSAGE extends UIMessage, PART_TYPE extends In
|
|
|
638
638
|
* .map(({ chunk }) => chunk); // excludes text-start and text-end
|
|
639
639
|
* ```
|
|
640
640
|
*/
|
|
641
|
-
declare function excludeChunks<UI_MESSAGE extends UIMessage, CHUNK_TYPE extends ContentChunkType<UI_MESSAGE>>(types: CHUNK_TYPE | Array<CHUNK_TYPE>): FilterGuard<UI_MESSAGE,
|
|
641
|
+
declare function excludeChunks<UI_MESSAGE extends UIMessage, CHUNK_TYPE extends ContentChunkType<UI_MESSAGE>>(types: CHUNK_TYPE | Array<CHUNK_TYPE>): FilterGuard<UI_MESSAGE, ExtractChunk<UI_MESSAGE, Exclude<ContentChunkType<UI_MESSAGE>, CHUNK_TYPE>>, {
|
|
642
642
|
type: ExcludePartForChunks<UI_MESSAGE, CHUNK_TYPE>;
|
|
643
643
|
}>;
|
|
644
644
|
/**
|
|
@@ -656,7 +656,7 @@ declare function excludeChunks<UI_MESSAGE extends UIMessage, CHUNK_TYPE extends
|
|
|
656
656
|
* .map(({ chunk }) => chunk); // excludes text and reasoning chunks
|
|
657
657
|
* ```
|
|
658
658
|
*/
|
|
659
|
-
declare function excludeParts<UI_MESSAGE extends UIMessage, PART_TYPE extends InferUIMessagePartType<UI_MESSAGE>>(types: PART_TYPE | Array<PART_TYPE>): FilterGuard<UI_MESSAGE,
|
|
659
|
+
declare function excludeParts<UI_MESSAGE extends UIMessage, PART_TYPE extends InferUIMessagePartType<UI_MESSAGE>>(types: PART_TYPE | Array<PART_TYPE>): FilterGuard<UI_MESSAGE, ExtractChunk<UI_MESSAGE, Exclude<ContentChunkType<UI_MESSAGE>, PartTypeToChunkTypes<UI_MESSAGE, PART_TYPE>>>, {
|
|
660
660
|
type: Exclude<InferUIMessagePartType<UI_MESSAGE>, PART_TYPE>;
|
|
661
661
|
}>;
|
|
662
662
|
/**
|