You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

@assistant-ui/react-edge

Package Overview
Dependencies
Maintainers
1
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@assistant-ui/react-edge - npm Package Compare versions

Comparing version

to
0.2.13

2

dist/converters/fromLanguageModelMessages.js

@@ -52,3 +52,3 @@ // src/converters/fromLanguageModelMessages.ts

const unhandledType = type;
throw new Error(`Unknown content part type: ${unhandledType}`);
throw new Error(`Unknown message part type: ${unhandledType}`);
}

@@ -55,0 +55,0 @@ }

@@ -13,3 +13,3 @@ // src/converters/toLanguageModelMessages.ts

return {
addTextContentPart: (part) => {
addTextMessagePart: (part) => {
if (toolMessage.content.length > 0) {

@@ -99,3 +99,3 @@ stash.push(assistantMessage);

throw new Error(
`Unspported content part type: ${unhandledType}`
`Unspported message part type: ${unhandledType}`
);

@@ -120,3 +120,3 @@ }

case "text": {
splitter.addTextContentPart(part);
splitter.addTextMessagePart(part);
break;

@@ -130,3 +130,3 @@ }

const unhandledType = type;
throw new Error(`Unhandled content part type: ${unhandledType}`);
throw new Error(`Unhandled message part type: ${unhandledType}`);
}

@@ -133,0 +133,0 @@ }

@@ -1,4 +0,4 @@

/** Core Message Types (without UI content parts) */
import { FileContentPart, ImageContentPart, TextContentPart, Unstable_AudioContentPart } from "@assistant-ui/react";
export type CoreToolCallContentPart<TArgs extends Record<string, unknown> = Record<string, unknown>, TResult = unknown> = {
/** Core Message Types (without UI message parts) */
import { FileMessagePart, ImageMessagePart, TextMessagePart, Unstable_AudioMessagePart } from "@assistant-ui/react";
export type CoreToolCallMessagePart<TArgs extends Record<string, unknown> = Record<string, unknown>, TResult = unknown> = {
readonly type: "tool-call";

@@ -11,17 +11,17 @@ readonly toolCallId: string;

};
export type CoreUserContentPart = TextContentPart | ImageContentPart | FileContentPart | Unstable_AudioContentPart;
export type CoreAssistantContentPart = TextContentPart | CoreToolCallContentPart;
export type CoreUserMessagePart = TextMessagePart | ImageMessagePart | FileMessagePart | Unstable_AudioMessagePart;
export type CoreAssistantMessagePart = TextMessagePart | CoreToolCallMessagePart;
export type CoreSystemMessage = {
role: "system";
content: readonly [TextContentPart];
content: readonly [TextMessagePart];
};
export type CoreUserMessage = {
role: "user";
content: readonly CoreUserContentPart[];
content: readonly CoreUserMessagePart[];
};
export type CoreAssistantMessage = {
role: "assistant";
content: readonly CoreAssistantContentPart[];
content: readonly CoreAssistantMessagePart[];
};
export type CoreMessage = CoreSystemMessage | CoreUserMessage | CoreAssistantMessage;
//# sourceMappingURL=CoreTypes.d.ts.map

@@ -19,3 +19,3 @@ import { z } from "zod";

}>;
export declare const TextContentPartSchema: z.ZodObject<{
export declare const TextMessagePartSchema: z.ZodObject<{
type: z.ZodLiteral<"text">;

@@ -30,3 +30,3 @@ text: z.ZodString;

}>;
export declare const ImageContentPartSchema: z.ZodObject<{
export declare const ImageMessagePartSchema: z.ZodObject<{
type: z.ZodLiteral<"image">;

@@ -41,3 +41,3 @@ image: z.ZodString;

}>;
export declare const FileContentPartSchema: z.ZodObject<{
export declare const FileMessagePartSchema: z.ZodObject<{
type: z.ZodLiteral<"file">;

@@ -55,3 +55,3 @@ data: z.ZodString;

}>;
export declare const Unstable_AudioContentPart: z.ZodObject<{
export declare const Unstable_AudioMessagePart: z.ZodObject<{
type: z.ZodLiteral<"audio">;

@@ -81,3 +81,3 @@ audio: z.ZodObject<{

}>;
export declare const CoreToolCallContentPartSchema: z.ZodObject<{
export declare const CoreToolCallMessagePartSchema: z.ZodObject<{
type: z.ZodLiteral<"tool-call">;

@@ -84,0 +84,0 @@ toolCallId: z.ZodString;

@@ -11,11 +11,11 @@ // src/edge/schemas.ts

});
var TextContentPartSchema = z.object({
var TextMessagePartSchema = z.object({
type: z.literal("text"),
text: z.string()
});
var ImageContentPartSchema = z.object({
var ImageMessagePartSchema = z.object({
type: z.literal("image"),
image: z.string()
});
var FileContentPartSchema = z.object({
var FileMessagePartSchema = z.object({
type: z.literal("file"),

@@ -25,3 +25,3 @@ data: z.string(),

});
var Unstable_AudioContentPart = z.object({
var Unstable_AudioMessagePart = z.object({
type: z.literal("audio"),

@@ -33,3 +33,3 @@ audio: z.object({

});
var CoreToolCallContentPartSchema = z.object({
var CoreToolCallMessagePartSchema = z.object({
type: z.literal("tool-call"),

@@ -46,6 +46,6 @@ toolCallId: z.string(),

z.discriminatedUnion("type", [
TextContentPartSchema,
ImageContentPartSchema,
FileContentPartSchema,
Unstable_AudioContentPart
TextMessagePartSchema,
ImageMessagePartSchema,
FileMessagePartSchema,
Unstable_AudioMessagePart
])

@@ -58,4 +58,4 @@ ).min(1).readonly()

z.discriminatedUnion("type", [
TextContentPartSchema,
CoreToolCallContentPartSchema
TextMessagePartSchema,
CoreToolCallMessagePartSchema
])

@@ -66,3 +66,3 @@ ).min(1).readonly()

role: z.literal("system"),
content: z.tuple([TextContentPartSchema]).readonly()
content: z.tuple([TextMessagePartSchema]).readonly()
});

@@ -92,12 +92,12 @@ var CoreMessageSchema = z.discriminatedUnion("role", [

CoreSystemMessageSchema,
CoreToolCallContentPartSchema,
CoreToolCallMessagePartSchema,
CoreUserMessageSchema,
FileContentPartSchema,
ImageContentPartSchema,
FileMessagePartSchema,
ImageMessagePartSchema,
LanguageModelConfigSchema,
LanguageModelV1CallSettingsSchema,
LanguageModelV1FunctionToolSchema,
TextContentPartSchema,
Unstable_AudioContentPart
TextMessagePartSchema,
Unstable_AudioMessagePart
};
//# sourceMappingURL=schemas.js.map
{
"name": "@assistant-ui/react-edge",
"description": "The legacy edge runtime for assistant-ui",
"version": "0.2.12",
"version": "0.2.13",
"license": "MIT",

@@ -29,6 +29,6 @@ "type": "module",

"@ai-sdk/provider": "^1.1.3",
"assistant-stream": "^0.2.17",
"assistant-stream": "^0.2.18",
"json-schema": "^0.4.0",
"zod": "^3.25.64",
"zod-to-json-schema": "^3.24.5"
"zod": "^3.25.67",
"zod-to-json-schema": "^3.24.6"
},

@@ -52,10 +52,10 @@ "peerDependencies": {

"@types/json-schema": "^7.0.15",
"@types/node": "^24.0.1",
"@types/node": "^24.0.4",
"@types/react": "^19.1.8",
"@types/react-dom": "^19.1.6",
"eslint": "^9",
"eslint-config-next": "15.3.3",
"eslint-config-next": "15.3.4",
"tsx": "^4.20.3",
"@assistant-ui/x-buildutils": "0.0.1",
"@assistant-ui/react": "0.10.24"
"@assistant-ui/react": "0.10.25"
},

@@ -62,0 +62,0 @@ "publishConfig": {

@@ -6,3 +6,3 @@ import {

ThreadMessage,
ToolCallContentPart,
ToolCallMessagePart,
} from "@assistant-ui/react";

@@ -44,3 +44,3 @@ import { CoreMessage } from "../edge/CoreTypes";

argsText: JSON.stringify(part.args),
} satisfies ToolCallContentPart;
} satisfies ToolCallMessagePart;
}

@@ -47,0 +47,0 @@ return part;

import { LanguageModelV1Message } from "@ai-sdk/provider";
import { CoreMessage } from "../edge/CoreTypes";
import { ToolCallContentPart } from "@assistant-ui/react";
import { ToolCallMessagePart } from "@assistant-ui/react";

@@ -67,3 +67,3 @@ type fromLanguageModelMessagesOptions = {

const unhandledType: never = type;
throw new Error(`Unknown content part type: ${unhandledType}`);
throw new Error(`Unknown message part type: ${unhandledType}`);
}

@@ -85,3 +85,3 @@ }

args: part.args as any,
} satisfies ToolCallContentPart;
} satisfies ToolCallMessagePart;
}

@@ -126,3 +126,3 @@ // TODO handle these

const toolCall = previousMessage.content.find(
(c): c is ToolCallContentPart =>
(c): c is ToolCallMessagePart =>
c.type === "tool-call" && c.toolCallId === tool.toolCallId,

@@ -136,3 +136,3 @@ );

type Writable<T> = { -readonly [P in keyof T]: T[P] };
const writable = toolCall as Writable<ToolCallContentPart>;
const writable = toolCall as Writable<ToolCallMessagePart>;
writable.result = tool.result;

@@ -139,0 +139,0 @@ if (tool.isError) {

@@ -10,7 +10,7 @@ import {

import {
TextContentPart,
TextMessagePart,
ThreadMessage,
ToolCallContentPart,
ToolCallMessagePart,
} from "@assistant-ui/react";
import { CoreMessage, CoreToolCallContentPart } from "../edge/CoreTypes";
import { CoreMessage, CoreToolCallMessagePart } from "../edge/CoreTypes";

@@ -29,3 +29,3 @@ const assistantMessageSplitter = () => {

return {
addTextContentPart: (part: TextContentPart) => {
addTextMessagePart: (part: TextMessagePart) => {
if (toolMessage.content.length > 0) {

@@ -51,3 +51,3 @@ stash.push(assistantMessage);

},
addToolCallPart: (part: CoreToolCallContentPart | ToolCallContentPart) => {
addToolCallPart: (part: CoreToolCallMessagePart | ToolCallMessagePart) => {
assistantMessage.content.push({

@@ -145,3 +145,3 @@ type: "tool-call",

throw new Error(
`Unspported content part type: ${unhandledType}`,
`Unspported message part type: ${unhandledType}`,
);

@@ -168,3 +168,3 @@ }

case "text": {
splitter.addTextContentPart(part);
splitter.addTextMessagePart(part);
break;

@@ -178,3 +178,3 @@ }

const unhandledType: never = type;
throw new Error(`Unhandled content part type: ${unhandledType}`);
throw new Error(`Unhandled message part type: ${unhandledType}`);
}

@@ -181,0 +181,0 @@ }

@@ -1,11 +0,11 @@

/** Core Message Types (without UI content parts) */
/** Core Message Types (without UI message parts) */
import {
FileContentPart,
ImageContentPart,
TextContentPart,
Unstable_AudioContentPart,
FileMessagePart,
ImageMessagePart,
TextMessagePart,
Unstable_AudioMessagePart,
} from "@assistant-ui/react";
export type CoreToolCallContentPart<
export type CoreToolCallMessagePart<
TArgs extends Record<string, unknown> = Record<string, unknown>,

@@ -22,14 +22,14 @@ TResult = unknown,

export type CoreUserContentPart =
| TextContentPart
| ImageContentPart
| FileContentPart
| Unstable_AudioContentPart;
export type CoreAssistantContentPart =
| TextContentPart
| CoreToolCallContentPart;
export type CoreUserMessagePart =
| TextMessagePart
| ImageMessagePart
| FileMessagePart
| Unstable_AudioMessagePart;
export type CoreAssistantMessagePart =
| TextMessagePart
| CoreToolCallMessagePart;
export type CoreSystemMessage = {
role: "system";
content: readonly [TextContentPart];
content: readonly [TextMessagePart];
};

@@ -39,3 +39,3 @@

role: "user";
content: readonly CoreUserContentPart[];
content: readonly CoreUserMessagePart[];
};

@@ -45,3 +45,3 @@

role: "assistant";
content: readonly CoreAssistantContentPart[];
content: readonly CoreAssistantMessagePart[];
};

@@ -48,0 +48,0 @@

@@ -13,3 +13,3 @@ import { z } from "zod";

export const TextContentPartSchema = z.object({
export const TextMessagePartSchema = z.object({
type: z.literal("text"),

@@ -19,3 +19,3 @@ text: z.string(),

export const ImageContentPartSchema = z.object({
export const ImageMessagePartSchema = z.object({
type: z.literal("image"),

@@ -25,3 +25,3 @@ image: z.string(),

export const FileContentPartSchema = z.object({
export const FileMessagePartSchema = z.object({
type: z.literal("file"),

@@ -32,3 +32,3 @@ data: z.string(),

export const Unstable_AudioContentPart = z.object({
export const Unstable_AudioMessagePart = z.object({
type: z.literal("audio"),

@@ -41,3 +41,3 @@ audio: z.object({

export const CoreToolCallContentPartSchema = z.object({
export const CoreToolCallMessagePartSchema = z.object({
type: z.literal("tool-call"),

@@ -56,6 +56,6 @@ toolCallId: z.string(),

z.discriminatedUnion("type", [
TextContentPartSchema,
ImageContentPartSchema,
FileContentPartSchema,
Unstable_AudioContentPart,
TextMessagePartSchema,
ImageMessagePartSchema,
FileMessagePartSchema,
Unstable_AudioMessagePart,
]),

@@ -72,4 +72,4 @@ )

z.discriminatedUnion("type", [
TextContentPartSchema,
CoreToolCallContentPartSchema,
TextMessagePartSchema,
CoreToolCallMessagePartSchema,
]),

@@ -83,3 +83,3 @@ )

role: z.literal("system"),
content: z.tuple([TextContentPartSchema]).readonly(),
content: z.tuple([TextMessagePartSchema]).readonly(),
});

@@ -86,0 +86,0 @@

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