Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@ai-sdk/ui-utils

Package Overview
Dependencies
Maintainers
2
Versions
65
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ai-sdk/ui-utils - npm Package Compare versions

Comparing version 1.0.0-canary.8 to 1.0.0-canary.9

6

CHANGELOG.md
# @ai-sdk/ui-utils
## 1.0.0-canary.9
### Patch Changes
- 04d3747: chore (ui-utils): restructure processAssistantMessage
## 1.0.0-canary.8

@@ -4,0 +10,0 @@

18

dist/index.d.ts

@@ -565,5 +565,19 @@ import { LanguageModelV1FinishReason, JSONValue as JSONValue$1 } from '@ai-sdk/provider';

declare function processAssistantStream({ stream, onStreamPart, }: {
declare function processAssistantStream({ stream, onTextPart, onErrorPart, onAssistantMessagePart, onAssistantControlDataPart, onDataMessagePart, }: {
stream: ReadableStream<Uint8Array>;
onStreamPart: (streamPart: AssistantStreamPartType) => Promise<void> | void;
onTextPart?: (streamPart: (AssistantStreamPartType & {
type: 'text';
})['value']) => Promise<void> | void;
onErrorPart?: (streamPart: (AssistantStreamPartType & {
type: 'error';
})['value']) => Promise<void> | void;
onAssistantMessagePart?: (streamPart: (AssistantStreamPartType & {
type: 'assistant_message';
})['value']) => Promise<void> | void;
onAssistantControlDataPart?: (streamPart: (AssistantStreamPartType & {
type: 'assistant_control_data';
})['value']) => Promise<void> | void;
onDataMessagePart?: (streamPart: (AssistantStreamPartType & {
type: 'data_message';
})['value']) => Promise<void> | void;
}): Promise<void>;

@@ -570,0 +584,0 @@

@@ -1259,3 +1259,7 @@ "use strict";

stream,
onStreamPart
onTextPart,
onErrorPart,
onAssistantMessagePart,
onAssistantControlDataPart,
onDataMessagePart
}) {

@@ -1281,4 +1285,24 @@ const reader = stream.getReader();

const streamParts = decoder.decode(concatenatedChunks, { stream: true }).split("\n").filter((line) => line !== "").map(parseAssistantStreamPart);
for (const streamPart of streamParts) {
await onStreamPart(streamPart);
for (const { type, value: value2 } of streamParts) {
switch (type) {
case "text":
await (onTextPart == null ? void 0 : onTextPart(value2));
break;
case "error":
await (onErrorPart == null ? void 0 : onErrorPart(value2));
break;
case "assistant_message":
await (onAssistantMessagePart == null ? void 0 : onAssistantMessagePart(value2));
break;
case "assistant_control_data":
await (onAssistantControlDataPart == null ? void 0 : onAssistantControlDataPart(value2));
break;
case "data_message":
await (onDataMessagePart == null ? void 0 : onDataMessagePart(value2));
break;
default: {
const exhaustiveCheck = type;
throw new Error(`Unknown stream part type: ${exhaustiveCheck}`);
}
}
}

@@ -1285,0 +1309,0 @@ }

2

package.json
{
"name": "@ai-sdk/ui-utils",
"version": "1.0.0-canary.8",
"version": "1.0.0-canary.9",
"license": "Apache-2.0",

@@ -5,0 +5,0 @@ "sideEffects": false,

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc