@assistant-ui/react 0.7.70 → 0.7.72
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/cloud/auiV0.d.ts +3 -0
- package/dist/cloud/auiV0.d.ts.map +1 -1
- package/dist/cloud/auiV0.js +6 -0
- package/dist/cloud/auiV0.js.map +1 -1
- package/dist/cloud/auiV0.mjs +6 -0
- package/dist/cloud/auiV0.mjs.map +1 -1
- package/dist/primitives/contentPart/useContentPartReasoning.d.ts +5 -0
- package/dist/primitives/contentPart/useContentPartReasoning.d.ts.map +1 -0
- package/dist/primitives/contentPart/useContentPartReasoning.js +42 -0
- package/dist/primitives/contentPart/useContentPartReasoning.js.map +1 -0
- package/dist/primitives/contentPart/useContentPartReasoning.mjs +18 -0
- package/dist/primitives/contentPart/useContentPartReasoning.mjs.map +1 -0
- package/dist/primitives/index.d.ts +1 -0
- package/dist/primitives/index.d.ts.map +1 -1
- package/dist/primitives/index.js +3 -0
- package/dist/primitives/index.js.map +1 -1
- package/dist/primitives/index.mjs +2 -0
- package/dist/primitives/index.mjs.map +1 -1
- package/dist/primitives/message/MessageContent.d.ts +2 -1
- package/dist/primitives/message/MessageContent.d.ts.map +1 -1
- package/dist/primitives/message/MessageContent.js +5 -1
- package/dist/primitives/message/MessageContent.js.map +1 -1
- package/dist/primitives/message/MessageContent.mjs +5 -1
- package/dist/primitives/message/MessageContent.mjs.map +1 -1
- package/dist/runtimes/edge/EdgeRuntimeRequestOptions.d.ts +6 -6
- package/dist/runtimes/edge/converters/toCoreMessages.d.ts.map +1 -1
- package/dist/runtimes/edge/converters/toCoreMessages.js +2 -1
- package/dist/runtimes/edge/converters/toCoreMessages.js.map +1 -1
- package/dist/runtimes/edge/converters/toCoreMessages.mjs +2 -1
- package/dist/runtimes/edge/converters/toCoreMessages.mjs.map +1 -1
- package/dist/runtimes/edge/converters/toLanguageModelMessages.d.ts.map +1 -1
- package/dist/runtimes/edge/converters/toLanguageModelMessages.js +3 -0
- package/dist/runtimes/edge/converters/toLanguageModelMessages.js.map +1 -1
- package/dist/runtimes/edge/converters/toLanguageModelMessages.mjs +3 -0
- package/dist/runtimes/edge/converters/toLanguageModelMessages.mjs.map +1 -1
- package/dist/runtimes/edge/createEdgeRuntimeAPI.d.ts +2 -2
- package/dist/runtimes/edge/createEdgeRuntimeAPI.d.ts.map +1 -1
- package/dist/runtimes/edge/createEdgeRuntimeAPI.js +10 -1
- package/dist/runtimes/edge/createEdgeRuntimeAPI.js.map +1 -1
- package/dist/runtimes/edge/createEdgeRuntimeAPI.mjs +10 -1
- package/dist/runtimes/edge/createEdgeRuntimeAPI.mjs.map +1 -1
- package/dist/runtimes/edge/streams/assistantEncoderStream.d.ts.map +1 -1
- package/dist/runtimes/edge/streams/assistantEncoderStream.js +7 -0
- package/dist/runtimes/edge/streams/assistantEncoderStream.js.map +1 -1
- package/dist/runtimes/edge/streams/assistantEncoderStream.mjs +7 -0
- package/dist/runtimes/edge/streams/assistantEncoderStream.mjs.map +1 -1
- package/dist/runtimes/edge/streams/runResultStream.d.ts.map +1 -1
- package/dist/runtimes/edge/streams/runResultStream.js +21 -2
- package/dist/runtimes/edge/streams/runResultStream.js.map +1 -1
- package/dist/runtimes/edge/streams/runResultStream.mjs +21 -2
- package/dist/runtimes/edge/streams/runResultStream.mjs.map +1 -1
- package/dist/runtimes/edge/streams/toolResultStream.d.ts.map +1 -1
- package/dist/runtimes/edge/streams/toolResultStream.js +1 -0
- package/dist/runtimes/edge/streams/toolResultStream.js.map +1 -1
- package/dist/runtimes/edge/streams/toolResultStream.mjs +1 -0
- package/dist/runtimes/edge/streams/toolResultStream.mjs.map +1 -1
- package/dist/runtimes/external-store/ThreadMessageLike.d.ts +2 -2
- package/dist/runtimes/external-store/ThreadMessageLike.d.ts.map +1 -1
- package/dist/runtimes/external-store/ThreadMessageLike.js +2 -1
- package/dist/runtimes/external-store/ThreadMessageLike.js.map +1 -1
- package/dist/runtimes/external-store/ThreadMessageLike.mjs +2 -1
- package/dist/runtimes/external-store/ThreadMessageLike.mjs.map +1 -1
- package/dist/runtimes/local/ChatModelAdapter.d.ts +2 -2
- package/dist/runtimes/local/ChatModelAdapter.d.ts.map +1 -1
- package/dist/runtimes/local/ChatModelAdapter.js.map +1 -1
- package/dist/styles/index.css +57 -29
- package/dist/styles/index.css.map +1 -1
- package/dist/styles/tailwindcss/thread.css +30 -23
- package/dist/styles/tailwindcss/thread.css.json +31 -25
- package/dist/types/AssistantTypes.d.ts +5 -1
- package/dist/types/AssistantTypes.d.ts.map +1 -1
- package/dist/types/AssistantTypes.js.map +1 -1
- package/dist/types/ContentPartComponentTypes.d.ts +3 -1
- package/dist/types/ContentPartComponentTypes.d.ts.map +1 -1
- package/dist/types/ContentPartComponentTypes.js.map +1 -1
- package/dist/types/index.d.ts +2 -2
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js.map +1 -1
- package/package.json +14 -14
- package/src/cloud/auiV0.ts +11 -0
- package/src/primitives/contentPart/useContentPartReasoning.tsx +18 -0
- package/src/primitives/index.ts +1 -0
- package/src/primitives/message/MessageContent.tsx +8 -0
- package/src/runtimes/edge/converters/toCoreMessages.ts +2 -1
- package/src/runtimes/edge/converters/toLanguageModelMessages.ts +4 -0
- package/src/runtimes/edge/createEdgeRuntimeAPI.ts +12 -3
- package/src/runtimes/edge/streams/assistantEncoderStream.ts +8 -0
- package/src/runtimes/edge/streams/runResultStream.ts +26 -2
- package/src/runtimes/edge/streams/toolResultStream.ts +1 -0
- package/src/runtimes/external-store/ThreadMessageLike.tsx +5 -3
- package/src/runtimes/local/ChatModelAdapter.tsx +2 -1
- package/src/styles/tailwindcss/thread.css +30 -23
- package/src/types/AssistantTypes.ts +7 -0
- package/src/types/ContentPartComponentTypes.tsx +4 -0
- package/src/types/index.ts +3 -0
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../src/types/ContentPartComponentTypes.tsx"],"sourcesContent":["import type { ComponentType } from \"react\";\nimport type {\n ContentPartStatus,\n FileContentPart,\n ImageContentPart,\n TextContentPart,\n ToolCallContentPart,\n UIContentPart,\n Unstable_AudioContentPart,\n} from \"./AssistantTypes\";\nimport { ContentPartState } from \"../api/ContentPartRuntime\";\nimport { ReadonlyJSONObject } from \"../utils/json/json-value\";\n\nexport type EmptyContentPartProps = {\n status: ContentPartStatus;\n};\nexport type EmptyContentPartComponent = ComponentType<EmptyContentPartProps>;\n\nexport type TextContentPartProps = ContentPartState & TextContentPart;\nexport type TextContentPartComponent = ComponentType<TextContentPartProps>;\n\nexport type ImageContentPartProps = ContentPartState & ImageContentPart;\nexport type ImageContentPartComponent = ComponentType<ImageContentPartProps>;\n\nexport type FileContentPartProps = ContentPartState & FileContentPart;\nexport type FileContentPartComponent = ComponentType<FileContentPartProps>;\n\nexport type Unstable_AudioContentPartProps = ContentPartState &\n Unstable_AudioContentPart;\nexport type Unstable_AudioContentPartComponent =\n ComponentType<Unstable_AudioContentPartProps>;\n\nexport type UIContentPartProps = ContentPartState & UIContentPart;\nexport type UIContentPartComponent = ComponentType<UIContentPartProps>;\n\nexport type ToolCallContentPartProps<\n TArgs extends ReadonlyJSONObject = any,\n TResult = unknown,\n> = ContentPartState &\n ToolCallContentPart<TArgs, TResult> & {\n addResult: (result: any) => void;\n };\n\nexport type ToolCallContentPartComponent<\n TArgs extends ReadonlyJSONObject = any,\n TResult = any,\n> = ComponentType<ToolCallContentPartProps<TArgs, TResult>>;\n"],"mappings":";;;;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
|
1
|
+
{"version":3,"sources":["../../src/types/ContentPartComponentTypes.tsx"],"sourcesContent":["import type { ComponentType } from \"react\";\nimport type {\n ContentPartStatus,\n FileContentPart,\n ImageContentPart,\n ReasoningContentPart,\n TextContentPart,\n ToolCallContentPart,\n UIContentPart,\n Unstable_AudioContentPart,\n} from \"./AssistantTypes\";\nimport { ContentPartState } from \"../api/ContentPartRuntime\";\nimport { ReadonlyJSONObject } from \"../utils/json/json-value\";\n\nexport type EmptyContentPartProps = {\n status: ContentPartStatus;\n};\nexport type EmptyContentPartComponent = ComponentType<EmptyContentPartProps>;\n\nexport type TextContentPartProps = ContentPartState & TextContentPart;\nexport type TextContentPartComponent = ComponentType<TextContentPartProps>;\n\nexport type ReasoningContentPartProps = ContentPartState & ReasoningContentPart;\nexport type ReasoningContentPartComponent = ComponentType<ReasoningContentPartProps>;\n\nexport type ImageContentPartProps = ContentPartState & ImageContentPart;\nexport type ImageContentPartComponent = ComponentType<ImageContentPartProps>;\n\nexport type FileContentPartProps = ContentPartState & FileContentPart;\nexport type FileContentPartComponent = ComponentType<FileContentPartProps>;\n\nexport type Unstable_AudioContentPartProps = ContentPartState &\n Unstable_AudioContentPart;\nexport type Unstable_AudioContentPartComponent =\n ComponentType<Unstable_AudioContentPartProps>;\n\nexport type UIContentPartProps = ContentPartState & UIContentPart;\nexport type UIContentPartComponent = ComponentType<UIContentPartProps>;\n\nexport type ToolCallContentPartProps<\n TArgs extends ReadonlyJSONObject = any,\n TResult = unknown,\n> = ContentPartState &\n ToolCallContentPart<TArgs, TResult> & {\n addResult: (result: any) => void;\n };\n\nexport type ToolCallContentPartComponent<\n TArgs extends ReadonlyJSONObject = any,\n TResult = any,\n> = ComponentType<ToolCallContentPartProps<TArgs, TResult>>;\n"],"mappings":";;;;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
|
package/dist/types/index.d.ts
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
export type { Attachment, PendingAttachment, CompleteAttachment, AttachmentStatus, } from "./AttachmentTypes";
|
2
|
-
export type { AppendMessage, TextContentPart, ImageContentPart, FileContentPart, Unstable_AudioContentPart, ToolCallContentPart, UIContentPart, MessageStatus, ThreadUserContentPart, ThreadAssistantContentPart, ThreadSystemMessage, ThreadAssistantMessage, ThreadUserMessage, ThreadMessage, CoreUserContentPart, CoreAssistantContentPart, CoreSystemMessage, CoreUserMessage, CoreAssistantMessage, CoreMessage, } from "./AssistantTypes";
|
3
|
-
export type { EmptyContentPartProps, EmptyContentPartComponent, TextContentPartProps, TextContentPartComponent, ImageContentPartProps, ImageContentPartComponent, FileContentPartProps, FileContentPartComponent, Unstable_AudioContentPartProps, Unstable_AudioContentPartComponent, UIContentPartProps, UIContentPartComponent, ToolCallContentPartProps, ToolCallContentPartComponent, } from "./ContentPartComponentTypes";
|
2
|
+
export type { AppendMessage, TextContentPart, ReasoningContentPart, ImageContentPart, FileContentPart, Unstable_AudioContentPart, ToolCallContentPart, UIContentPart, MessageStatus, ThreadUserContentPart, ThreadAssistantContentPart, ThreadSystemMessage, ThreadAssistantMessage, ThreadUserMessage, ThreadMessage, CoreUserContentPart, CoreAssistantContentPart, CoreSystemMessage, CoreUserMessage, CoreAssistantMessage, CoreMessage, } from "./AssistantTypes";
|
3
|
+
export type { EmptyContentPartProps, EmptyContentPartComponent, TextContentPartProps, TextContentPartComponent, ReasoningContentPartProps, ReasoningContentPartComponent, ImageContentPartProps, ImageContentPartComponent, FileContentPartProps, FileContentPartComponent, Unstable_AudioContentPartProps, Unstable_AudioContentPartComponent, UIContentPartProps, UIContentPartComponent, ToolCallContentPartProps, ToolCallContentPartComponent, } from "./ContentPartComponentTypes";
|
4
4
|
export type { Unsubscribe } from "./Unsubscribe";
|
5
5
|
//# sourceMappingURL=index.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,UAAU,EACV,iBAAiB,EACjB,kBAAkB,EAClB,gBAAgB,GACjB,MAAM,mBAAmB,CAAC;AAE3B,YAAY,EACV,aAAa,EACb,eAAe,EACf,gBAAgB,EAChB,eAAe,EACf,yBAAyB,EACzB,mBAAmB,EACnB,aAAa,EACb,aAAa,EAGb,qBAAqB,EACrB,0BAA0B,EAC1B,mBAAmB,EACnB,sBAAsB,EACtB,iBAAiB,EACjB,aAAa,EAGb,mBAAmB,EACnB,wBAAwB,EACxB,iBAAiB,EACjB,eAAe,EACf,oBAAoB,EACpB,WAAW,GACZ,MAAM,kBAAkB,CAAC;AAE1B,YAAY,EACV,qBAAqB,EACrB,yBAAyB,EACzB,oBAAoB,EACpB,wBAAwB,EACxB,qBAAqB,EACrB,yBAAyB,EACzB,oBAAoB,EACpB,wBAAwB,EACxB,8BAA8B,EAC9B,kCAAkC,EAClC,kBAAkB,EAClB,sBAAsB,EACtB,wBAAwB,EACxB,4BAA4B,GAC7B,MAAM,6BAA6B,CAAC;AAErC,YAAY,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC"}
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,UAAU,EACV,iBAAiB,EACjB,kBAAkB,EAClB,gBAAgB,GACjB,MAAM,mBAAmB,CAAC;AAE3B,YAAY,EACV,aAAa,EACb,eAAe,EACf,oBAAoB,EACpB,gBAAgB,EAChB,eAAe,EACf,yBAAyB,EACzB,mBAAmB,EACnB,aAAa,EACb,aAAa,EAGb,qBAAqB,EACrB,0BAA0B,EAC1B,mBAAmB,EACnB,sBAAsB,EACtB,iBAAiB,EACjB,aAAa,EAGb,mBAAmB,EACnB,wBAAwB,EACxB,iBAAiB,EACjB,eAAe,EACf,oBAAoB,EACpB,WAAW,GACZ,MAAM,kBAAkB,CAAC;AAE1B,YAAY,EACV,qBAAqB,EACrB,yBAAyB,EACzB,oBAAoB,EACpB,wBAAwB,EACxB,yBAAyB,EACzB,6BAA6B,EAC7B,qBAAqB,EACrB,yBAAyB,EACzB,oBAAoB,EACpB,wBAAwB,EACxB,8BAA8B,EAC9B,kCAAkC,EAClC,kBAAkB,EAClB,sBAAsB,EACtB,wBAAwB,EACxB,4BAA4B,GAC7B,MAAM,6BAA6B,CAAC;AAErC,YAAY,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC"}
|
package/dist/types/index.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../src/types/index.ts"],"sourcesContent":["export type {\n Attachment,\n PendingAttachment,\n CompleteAttachment,\n AttachmentStatus,\n} from \"./AttachmentTypes\";\n\nexport type {\n AppendMessage,\n TextContentPart,\n ImageContentPart,\n FileContentPart,\n Unstable_AudioContentPart,\n ToolCallContentPart,\n UIContentPart,\n MessageStatus,\n\n // thread message types\n ThreadUserContentPart,\n ThreadAssistantContentPart,\n ThreadSystemMessage,\n ThreadAssistantMessage,\n ThreadUserMessage,\n ThreadMessage,\n\n // core message types\n CoreUserContentPart,\n CoreAssistantContentPart,\n CoreSystemMessage,\n CoreUserMessage,\n CoreAssistantMessage,\n CoreMessage,\n} from \"./AssistantTypes\";\n\nexport type {\n EmptyContentPartProps,\n EmptyContentPartComponent,\n TextContentPartProps,\n TextContentPartComponent,\n ImageContentPartProps,\n ImageContentPartComponent,\n FileContentPartProps,\n FileContentPartComponent,\n Unstable_AudioContentPartProps,\n Unstable_AudioContentPartComponent,\n UIContentPartProps,\n UIContentPartComponent,\n ToolCallContentPartProps,\n ToolCallContentPartComponent,\n} from \"./ContentPartComponentTypes\";\n\nexport type { Unsubscribe } from \"./Unsubscribe\";\n"],"mappings":";;;;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
|
1
|
+
{"version":3,"sources":["../../src/types/index.ts"],"sourcesContent":["export type {\n Attachment,\n PendingAttachment,\n CompleteAttachment,\n AttachmentStatus,\n} from \"./AttachmentTypes\";\n\nexport type {\n AppendMessage,\n TextContentPart,\n ReasoningContentPart,\n ImageContentPart,\n FileContentPart,\n Unstable_AudioContentPart,\n ToolCallContentPart,\n UIContentPart,\n MessageStatus,\n\n // thread message types\n ThreadUserContentPart,\n ThreadAssistantContentPart,\n ThreadSystemMessage,\n ThreadAssistantMessage,\n ThreadUserMessage,\n ThreadMessage,\n\n // core message types\n CoreUserContentPart,\n CoreAssistantContentPart,\n CoreSystemMessage,\n CoreUserMessage,\n CoreAssistantMessage,\n CoreMessage,\n} from \"./AssistantTypes\";\n\nexport type {\n EmptyContentPartProps,\n EmptyContentPartComponent,\n TextContentPartProps,\n TextContentPartComponent,\n ReasoningContentPartProps,\n ReasoningContentPartComponent,\n ImageContentPartProps,\n ImageContentPartComponent,\n FileContentPartProps,\n FileContentPartComponent,\n Unstable_AudioContentPartProps,\n Unstable_AudioContentPartComponent,\n UIContentPartProps,\n UIContentPartComponent,\n ToolCallContentPartProps,\n ToolCallContentPartComponent,\n} from \"./ContentPartComponentTypes\";\n\nexport type { Unsubscribe } from \"./Unsubscribe\";\n"],"mappings":";;;;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
|
package/package.json
CHANGED
@@ -29,7 +29,7 @@
|
|
29
29
|
"conversational-ui",
|
30
30
|
"conversational-ai"
|
31
31
|
],
|
32
|
-
"version": "0.7.
|
32
|
+
"version": "0.7.72",
|
33
33
|
"license": "MIT",
|
34
34
|
"exports": {
|
35
35
|
".": {
|
@@ -65,29 +65,29 @@
|
|
65
65
|
],
|
66
66
|
"sideEffects": false,
|
67
67
|
"dependencies": {
|
68
|
-
"@ai-sdk/provider": "^1.0.
|
68
|
+
"@ai-sdk/provider": "^1.0.7",
|
69
69
|
"@radix-ui/primitive": "^1.1.1",
|
70
|
-
"@radix-ui/react-avatar": "^1.1.
|
70
|
+
"@radix-ui/react-avatar": "^1.1.3",
|
71
71
|
"@radix-ui/react-compose-refs": "^1.1.1",
|
72
72
|
"@radix-ui/react-context": "^1.1.1",
|
73
|
-
"@radix-ui/react-dialog": "^1.1.
|
74
|
-
"@radix-ui/react-popover": "^1.1.
|
75
|
-
"@radix-ui/react-primitive": "^2.0.
|
76
|
-
"@radix-ui/react-slot": "^1.1.
|
77
|
-
"@radix-ui/react-tooltip": "^1.1.
|
73
|
+
"@radix-ui/react-dialog": "^1.1.6",
|
74
|
+
"@radix-ui/react-popover": "^1.1.6",
|
75
|
+
"@radix-ui/react-primitive": "^2.0.2",
|
76
|
+
"@radix-ui/react-slot": "^1.1.2",
|
77
|
+
"@radix-ui/react-tooltip": "^1.1.8",
|
78
78
|
"@radix-ui/react-use-callback-ref": "^1.1.0",
|
79
79
|
"@radix-ui/react-use-escape-keydown": "^1.1.0",
|
80
80
|
"class-variance-authority": "^0.7.1",
|
81
81
|
"classnames": "^2.5.1",
|
82
82
|
"json-schema": "^0.4.0",
|
83
|
-
"lucide-react": "^0.
|
83
|
+
"lucide-react": "^0.475.0",
|
84
84
|
"nanoid": "^5.0.9",
|
85
85
|
"react-textarea-autosize": "^8.5.7",
|
86
86
|
"secure-json-parse": "^3.0.2",
|
87
87
|
"zod": "^3.24.1",
|
88
88
|
"zod-to-json-schema": "^3.24.1",
|
89
89
|
"zustand": "^5.0.3",
|
90
|
-
"assistant-stream": "^0.0.
|
90
|
+
"assistant-stream": "^0.0.19"
|
91
91
|
},
|
92
92
|
"peerDependencies": {
|
93
93
|
"@types/react": "*",
|
@@ -109,17 +109,17 @@
|
|
109
109
|
},
|
110
110
|
"devDependencies": {
|
111
111
|
"@types/json-schema": "^7.0.15",
|
112
|
-
"@types/node": "^22.
|
112
|
+
"@types/node": "^22.13.1",
|
113
113
|
"autoprefixer": "^10.4.20",
|
114
114
|
"eslint": "^9",
|
115
|
-
"eslint-config-next": "15.1.
|
115
|
+
"eslint-config-next": "15.1.6",
|
116
116
|
"postcss": "^8.5.1",
|
117
117
|
"tailwindcss": "^3.4.17",
|
118
118
|
"tailwindcss-animate": "^1.0.7",
|
119
119
|
"tsx": "^4.19.2",
|
120
|
+
"@assistant-ui/tailwindcss-transformer": "0.1.0",
|
120
121
|
"@assistant-ui/tsbuildutils": "^0.0.1",
|
121
|
-
"@assistant-ui/tsconfig": "0.0.0"
|
122
|
-
"@assistant-ui/tailwindcss-transformer": "0.1.0"
|
122
|
+
"@assistant-ui/tsconfig": "0.0.0"
|
123
123
|
},
|
124
124
|
"publishConfig": {
|
125
125
|
"access": "public",
|
package/src/cloud/auiV0.ts
CHANGED
@@ -15,6 +15,10 @@ type AuiV0MessageContentPart =
|
|
15
15
|
readonly type: "text";
|
16
16
|
readonly text: string;
|
17
17
|
}
|
18
|
+
| {
|
19
|
+
readonly type: "reasoning";
|
20
|
+
readonly text: string;
|
21
|
+
}
|
18
22
|
| {
|
19
23
|
readonly type: "tool-call";
|
20
24
|
readonly toolCallId: string;
|
@@ -64,6 +68,13 @@ export const auiV0Encode = (message: ThreadMessage): AuiV0Message => {
|
|
64
68
|
};
|
65
69
|
}
|
66
70
|
|
71
|
+
case "reasoning": {
|
72
|
+
return {
|
73
|
+
type: "reasoning",
|
74
|
+
text: part.text,
|
75
|
+
};
|
76
|
+
}
|
77
|
+
|
67
78
|
case "tool-call": {
|
68
79
|
if (!isJSONValue(part.result)) {
|
69
80
|
console.warn(
|
@@ -0,0 +1,18 @@
|
|
1
|
+
"use client";
|
2
|
+
|
3
|
+
import { ContentPartState } from "../../api/ContentPartRuntime";
|
4
|
+
import { useContentPart } from "../../context/react/ContentPartContext";
|
5
|
+
import { ReasoningContentPart } from "../../types";
|
6
|
+
|
7
|
+
export const useContentPartReasoning = () => {
|
8
|
+
const text = useContentPart((c) => {
|
9
|
+
if (c.type !== "reasoning")
|
10
|
+
throw new Error(
|
11
|
+
"ContentPartReasoning can only be used inside reasoning content parts.",
|
12
|
+
);
|
13
|
+
|
14
|
+
return c as ContentPartState & ReasoningContentPart;
|
15
|
+
});
|
16
|
+
|
17
|
+
return text;
|
18
|
+
};
|
package/src/primitives/index.ts
CHANGED
@@ -12,4 +12,5 @@ export * as ThreadListItemPrimitive from "./threadListItem";
|
|
12
12
|
export { useContentPartDisplay } from "./contentPart/useContentPartDisplay";
|
13
13
|
export { useContentPartImage } from "./contentPart/useContentPartImage";
|
14
14
|
export { useContentPartText } from "./contentPart/useContentPartText";
|
15
|
+
export { useContentPartReasoning } from "./contentPart/useContentPartReasoning";
|
15
16
|
export { useThreadViewportAutoScroll } from "./thread/useThreadViewportAutoScroll";
|
@@ -24,6 +24,7 @@ import type {
|
|
24
24
|
ToolCallContentPartProps,
|
25
25
|
UIContentPartComponent,
|
26
26
|
FileContentPartComponent,
|
27
|
+
ReasoningContentPartComponent,
|
27
28
|
} from "../../types/ContentPartComponentTypes";
|
28
29
|
import { ContentPartPrimitiveInProgress } from "../contentPart/ContentPartInProgress";
|
29
30
|
import { ContentPartStatus } from "../../types/AssistantTypes";
|
@@ -33,6 +34,7 @@ export namespace MessagePrimitiveContent {
|
|
33
34
|
components?:
|
34
35
|
| {
|
35
36
|
Empty?: EmptyContentPartComponent | undefined;
|
37
|
+
Reasoning?: ReasoningContentPartComponent | undefined;
|
36
38
|
Text?: TextContentPartComponent | undefined;
|
37
39
|
Image?: ImageContentPartComponent | undefined;
|
38
40
|
File?: FileContentPartComponent | undefined;
|
@@ -74,6 +76,7 @@ const defaultComponents = {
|
|
74
76
|
</ContentPartPrimitiveInProgress>
|
75
77
|
</p>
|
76
78
|
),
|
79
|
+
Reasoning: () => null,
|
77
80
|
Image: () => <ContentPartPrimitiveImage />,
|
78
81
|
File: () => null,
|
79
82
|
Unstable_Audio: () => null,
|
@@ -87,6 +90,7 @@ type MessageContentPartComponentProps = {
|
|
87
90
|
const MessageContentPartComponent: FC<MessageContentPartComponentProps> = ({
|
88
91
|
components: {
|
89
92
|
Text = defaultComponents.Text,
|
93
|
+
Reasoning = defaultComponents.Reasoning,
|
90
94
|
Image = defaultComponents.Image,
|
91
95
|
File = defaultComponents.File,
|
92
96
|
Unstable_Audio: Audio = defaultComponents.Unstable_Audio,
|
@@ -114,6 +118,9 @@ const MessageContentPartComponent: FC<MessageContentPartComponentProps> = ({
|
|
114
118
|
case "text":
|
115
119
|
return <Text {...part} />;
|
116
120
|
|
121
|
+
case "reasoning":
|
122
|
+
return <Reasoning {...part} />;
|
123
|
+
|
117
124
|
case "image":
|
118
125
|
// eslint-disable-next-line jsx-a11y/alt-text
|
119
126
|
return <Image {...part} />;
|
@@ -160,6 +167,7 @@ const MessageContentPart = memo(
|
|
160
167
|
(prev, next) =>
|
161
168
|
prev.partIndex === next.partIndex &&
|
162
169
|
prev.components?.Text === next.components?.Text &&
|
170
|
+
prev.components?.Reasoning === next.components?.Reasoning &&
|
163
171
|
prev.components?.Image === next.components?.Image &&
|
164
172
|
prev.components?.File === next.components?.File &&
|
165
173
|
prev.components?.Unstable_Audio === next.components?.Unstable_Audio &&
|
@@ -22,13 +22,14 @@ export const toCoreMessage = <T extends boolean = false>(
|
|
22
22
|
return {
|
23
23
|
role,
|
24
24
|
content: message.content.map((part) => {
|
25
|
+
if (part.type === "reasoning") return null; // reasoning parts are omitted
|
25
26
|
if (part.type === "ui") throw new Error("UI parts are not supported");
|
26
27
|
if (part.type === "tool-call") {
|
27
28
|
const { argsText, ...rest } = part;
|
28
29
|
return rest;
|
29
30
|
}
|
30
31
|
return part;
|
31
|
-
}),
|
32
|
+
}).filter(c => !!c),
|
32
33
|
...(includeId ? { unstable_id: message.id } : {}),
|
33
34
|
};
|
34
35
|
|
@@ -147,6 +147,10 @@ export function toLanguageModelMessages(
|
|
147
147
|
for (const part of message.content) {
|
148
148
|
const type = part.type;
|
149
149
|
switch (type) {
|
150
|
+
case "reasoning": {
|
151
|
+
break; // reasoning parts are omitted
|
152
|
+
}
|
153
|
+
|
150
154
|
case "text": {
|
151
155
|
splitter.addTextContentPart(part);
|
152
156
|
break;
|
@@ -5,7 +5,7 @@ import {
|
|
5
5
|
LanguageModelV1Prompt,
|
6
6
|
LanguageModelV1CallOptions,
|
7
7
|
} from "@ai-sdk/provider";
|
8
|
-
import { CoreMessage, ThreadStep } from "../../types/AssistantTypes";
|
8
|
+
import { CoreMessage, ThreadMessage, ThreadStep } from "../../types/AssistantTypes";
|
9
9
|
import { assistantEncoderStream } from "./streams/assistantEncoderStream";
|
10
10
|
import { EdgeRuntimeRequestOptionsSchema } from "./EdgeRuntimeRequestOptions";
|
11
11
|
import { toLanguageModelMessages } from "./converters/toLanguageModelMessages";
|
@@ -26,7 +26,7 @@ import { streamPartEncoderStream } from "./streams/utils/streamPartEncoderStream
|
|
26
26
|
import { z } from "zod";
|
27
27
|
|
28
28
|
type FinishResult = {
|
29
|
-
messages: readonly CoreMessage[];
|
29
|
+
messages: readonly (CoreMessage | ThreadMessage)[];
|
30
30
|
metadata: {
|
31
31
|
steps: readonly ThreadStep[];
|
32
32
|
};
|
@@ -143,9 +143,18 @@ export const getEdgeRuntimeStream = async ({
|
|
143
143
|
const resultingMessages = [
|
144
144
|
...messages,
|
145
145
|
{
|
146
|
+
id: "DEFAULT",
|
147
|
+
createdAt: new Date(),
|
146
148
|
role: "assistant",
|
147
149
|
content: lastChunk.content,
|
148
|
-
|
150
|
+
status: lastChunk.status,
|
151
|
+
metadata: {
|
152
|
+
unstable_data: lastChunk.metadata?.unstable_data ?? [],
|
153
|
+
unstable_annotations: lastChunk.metadata?.unstable_annotations ?? [],
|
154
|
+
steps: lastChunk.metadata?.steps ?? [],
|
155
|
+
custom: lastChunk.metadata?.custom ?? {},
|
156
|
+
}
|
157
|
+
} satisfies ThreadMessage,
|
149
158
|
];
|
150
159
|
onFinish({
|
151
160
|
messages: resultingMessages,
|
@@ -14,6 +14,14 @@ export function assistantEncoderStream() {
|
|
14
14
|
transform(chunk, controller) {
|
15
15
|
const chunkType = chunk.type;
|
16
16
|
switch (chunkType) {
|
17
|
+
case "reasoning": {
|
18
|
+
controller.enqueue({
|
19
|
+
type: AssistantStreamChunkType.ReasoningDelta,
|
20
|
+
value: chunk.textDelta,
|
21
|
+
});
|
22
|
+
break;
|
23
|
+
}
|
24
|
+
|
17
25
|
case "text-delta": {
|
18
26
|
if (!chunk.textDelta) break; // ignore empty text deltas
|
19
27
|
controller.enqueue({
|
@@ -14,6 +14,12 @@ export function runResultStream() {
|
|
14
14
|
transform(chunk, controller) {
|
15
15
|
const chunkType = chunk.type;
|
16
16
|
switch (chunkType) {
|
17
|
+
case "reasoning": {
|
18
|
+
message = appendOrUpdateReasoning(message, chunk.textDelta);
|
19
|
+
controller.enqueue(message);
|
20
|
+
break;
|
21
|
+
}
|
22
|
+
|
17
23
|
case "text-delta": {
|
18
24
|
message = appendOrUpdateText(message, chunk.textDelta);
|
19
25
|
controller.enqueue(message);
|
@@ -105,6 +111,24 @@ export function runResultStream() {
|
|
105
111
|
});
|
106
112
|
}
|
107
113
|
|
114
|
+
const appendOrUpdateReasoning= (
|
115
|
+
message: CoreChatModelRunResult,
|
116
|
+
textDelta: string,
|
117
|
+
) => {
|
118
|
+
let contentParts = message.content ?? [];
|
119
|
+
let contentPart = message.content?.at(-1);
|
120
|
+
if (contentPart?.type !== "reasoning") {
|
121
|
+
contentPart = { type: "reasoning", text: textDelta };
|
122
|
+
} else {
|
123
|
+
contentParts = contentParts.slice(0, -1);
|
124
|
+
contentPart = { type: "reasoning", text: contentPart.text + textDelta };
|
125
|
+
}
|
126
|
+
return {
|
127
|
+
...message,
|
128
|
+
content: contentParts.concat([contentPart]),
|
129
|
+
};
|
130
|
+
};
|
131
|
+
|
108
132
|
const appendOrUpdateText = (
|
109
133
|
message: CoreChatModelRunResult,
|
110
134
|
textDelta: string,
|
@@ -144,7 +168,7 @@ const appendOrUpdateToolCall = (
|
|
144
168
|
toolCallId,
|
145
169
|
toolName,
|
146
170
|
argsText: argsTextDelta,
|
147
|
-
args: parsePartialJson(argsTextDelta),
|
171
|
+
args: argsTextDelta ? parsePartialJson(argsTextDelta) : {},
|
148
172
|
};
|
149
173
|
contentParts = [...contentParts, contentPart];
|
150
174
|
} else {
|
@@ -152,7 +176,7 @@ const appendOrUpdateToolCall = (
|
|
152
176
|
contentPart = {
|
153
177
|
...contentPart,
|
154
178
|
argsText,
|
155
|
-
args: parsePartialJson(
|
179
|
+
args: argsTextDelta ? parsePartialJson(argsTextDelta) : {},
|
156
180
|
};
|
157
181
|
contentParts = [
|
158
182
|
...contentParts.slice(0, contentPartIdx),
|
@@ -14,7 +14,7 @@ import {
|
|
14
14
|
FileContentPart,
|
15
15
|
Unstable_AudioContentPart,
|
16
16
|
} from "../../types";
|
17
|
-
import { ThreadStep } from "../../types/AssistantTypes";
|
17
|
+
import { ReasoningContentPart, ThreadStep } from "../../types/AssistantTypes";
|
18
18
|
import {
|
19
19
|
ReadonlyJSONObject,
|
20
20
|
ReadonlyJSONValue,
|
@@ -27,6 +27,7 @@ export type ThreadMessageLike = {
|
|
27
27
|
| string
|
28
28
|
| readonly (
|
29
29
|
| TextContentPart
|
30
|
+
| ReasoningContentPart
|
30
31
|
| ImageContentPart
|
31
32
|
| FileContentPart
|
32
33
|
| Unstable_AudioContentPart
|
@@ -92,6 +93,7 @@ export const fromThreadMessageLike = (
|
|
92
93
|
const type = part.type;
|
93
94
|
switch (type) {
|
94
95
|
case "text":
|
96
|
+
case "reasoning":
|
95
97
|
if (part.text.trim().length === 0) return null;
|
96
98
|
return part;
|
97
99
|
|
@@ -110,7 +112,7 @@ export const fromThreadMessageLike = (
|
|
110
112
|
return {
|
111
113
|
...part,
|
112
114
|
toolCallId: part.toolCallId ?? "tool-" + generateId(),
|
113
|
-
args: part.args ?? parsePartialJson(part.argsText ?? ""),
|
115
|
+
args: part.args ?? parsePartialJson(part.argsText ?? "{}"),
|
114
116
|
argsText: part.argsText ?? "",
|
115
117
|
};
|
116
118
|
}
|
@@ -148,7 +150,7 @@ export const fromThreadMessageLike = (
|
|
148
150
|
return part;
|
149
151
|
|
150
152
|
default: {
|
151
|
-
const unhandledType: "tool-call" = type;
|
153
|
+
const unhandledType: "tool-call" | "reasoning" = type;
|
152
154
|
throw new Error(
|
153
155
|
`Unsupported user content part type: ${unhandledType}`,
|
154
156
|
);
|
@@ -1,5 +1,6 @@
|
|
1
1
|
import type {
|
2
2
|
MessageStatus,
|
3
|
+
ReasoningContentPart,
|
3
4
|
RunConfig,
|
4
5
|
TextContentPart,
|
5
6
|
ThreadAssistantContentPart,
|
@@ -27,7 +28,7 @@ export type ChatModelRunResult = {
|
|
27
28
|
};
|
28
29
|
|
29
30
|
export type CoreChatModelRunResult = Omit<ChatModelRunResult, "content"> & {
|
30
|
-
readonly content: readonly (TextContentPart | ToolCallContentPart)[];
|
31
|
+
readonly content: readonly (TextContentPart | ReasoningContentPart | ToolCallContentPart)[];
|
31
32
|
};
|
32
33
|
|
33
34
|
export type ChatModelRunOptions = {
|
@@ -1,11 +1,10 @@
|
|
1
1
|
/* thread */
|
2
2
|
.aui-thread-root {
|
3
3
|
@apply bg-aui-background box-border h-full;
|
4
|
-
@apply [&>.aui-thread-viewport]:bg-inherit;
|
5
4
|
}
|
6
5
|
|
7
6
|
.aui-thread-viewport {
|
8
|
-
@apply
|
7
|
+
@apply flex h-full flex-col items-center overflow-y-scroll scroll-smooth bg-inherit px-4 pt-8;
|
9
8
|
}
|
10
9
|
|
11
10
|
.aui-thread-viewport-footer {
|
@@ -60,8 +59,12 @@
|
|
60
59
|
@apply placeholder:text-aui-muted-foreground max-h-40 flex-grow resize-none border-none bg-transparent px-2 py-4 text-sm outline-none focus:ring-0 disabled:cursor-not-allowed;
|
61
60
|
}
|
62
61
|
|
63
|
-
.aui-composer-send
|
64
|
-
.
|
62
|
+
.aui-composer-send {
|
63
|
+
@apply my-2.5 size-8 p-2 transition-opacity ease-in;
|
64
|
+
}
|
65
|
+
.aui-composer-cancel {
|
66
|
+
@apply my-2.5 size-8 p-2 transition-opacity ease-in;
|
67
|
+
}
|
65
68
|
.aui-composer-attach {
|
66
69
|
@apply my-2.5 size-8 p-2 transition-opacity ease-in;
|
67
70
|
}
|
@@ -111,36 +114,35 @@
|
|
111
114
|
@apply max-w-[var(--aui-thread-max-width)] w-full py-4;
|
112
115
|
}
|
113
116
|
|
114
|
-
:where(.aui-user-message-root) > .aui-
|
115
|
-
@apply col-start-1 row-start-
|
116
|
-
|
117
|
-
|
118
|
-
:where(.aui-user-message-root) > .aui-user-message-attachments {
|
119
|
-
@apply col-span-full col-start-1 row-start-1;
|
120
|
-
@apply justify-end;
|
121
|
-
}
|
122
|
-
|
123
|
-
:where(.aui-user-message-root) > .aui-user-message-content {
|
124
|
-
@apply col-start-2 row-start-2;
|
117
|
+
:where(.aui-user-message-root) > .aui-branch-picker-root {
|
118
|
+
@apply col-span-full col-start-1 row-start-3;
|
119
|
+
@apply -mr-1 justify-end;
|
125
120
|
}
|
126
121
|
|
127
|
-
|
122
|
+
.aui-user-branch-picker {
|
128
123
|
@apply col-span-full col-start-1 row-start-3;
|
129
124
|
@apply -mr-1 justify-end;
|
130
125
|
}
|
131
126
|
|
132
127
|
.aui-user-message-content {
|
133
128
|
@apply bg-aui-muted text-aui-foreground max-w-[calc(var(--aui-thread-max-width)*0.8)] break-words rounded-3xl px-5 py-2.5;
|
129
|
+
|
130
|
+
@apply col-start-2 row-start-2;
|
134
131
|
}
|
135
132
|
|
136
133
|
.aui-user-message-attachments {
|
137
134
|
@apply flex w-full flex-row gap-3;
|
135
|
+
|
136
|
+
@apply col-span-full col-start-1 row-start-1;
|
137
|
+
@apply justify-end;
|
138
138
|
}
|
139
139
|
|
140
140
|
/* user action bar */
|
141
141
|
|
142
142
|
.aui-user-action-bar-root {
|
143
143
|
@apply flex flex-col items-end;
|
144
|
+
|
145
|
+
@apply col-start-1 row-start-2 mr-3 mt-2.5;
|
144
146
|
}
|
145
147
|
|
146
148
|
/* edit composer */
|
@@ -168,28 +170,33 @@
|
|
168
170
|
@apply col-start-1 row-span-full row-start-1 mr-4;
|
169
171
|
}
|
170
172
|
|
173
|
+
.aui-assistant-avatar {
|
174
|
+
@apply col-start-1 row-span-full row-start-1 mr-4;
|
175
|
+
}
|
176
|
+
|
171
177
|
:where(.aui-assistant-message-root) > .aui-branch-picker-root {
|
172
178
|
@apply col-start-2 row-start-2;
|
173
179
|
@apply -ml-2 mr-2;
|
174
180
|
}
|
175
181
|
|
176
|
-
|
177
|
-
@apply col-start-
|
178
|
-
@apply -ml-
|
179
|
-
}
|
180
|
-
|
181
|
-
:where(.aui-assistant-message-root) > .aui-assistant-message-content {
|
182
|
-
@apply col-span-2 col-start-2 row-start-1 my-1.5;
|
182
|
+
.aui-assistant-branch-picker {
|
183
|
+
@apply col-start-2 row-start-2;
|
184
|
+
@apply -ml-2 mr-2;
|
183
185
|
}
|
184
186
|
|
185
187
|
.aui-assistant-message-content {
|
186
188
|
@apply text-aui-foreground max-w-[calc(var(--aui-thread-max-width)*0.8)] break-words leading-7;
|
189
|
+
|
190
|
+
@apply col-span-2 col-start-2 row-start-1 my-1.5;
|
187
191
|
}
|
188
192
|
|
189
193
|
/* assistant action bar */
|
190
194
|
|
191
195
|
.aui-assistant-action-bar-root {
|
192
196
|
@apply text-aui-muted-foreground flex gap-1;
|
197
|
+
|
198
|
+
@apply col-start-3 row-start-2;
|
199
|
+
@apply -ml-1;
|
193
200
|
}
|
194
201
|
|
195
202
|
:where(.aui-assistant-action-bar-root)[data-floating] {
|
@@ -12,6 +12,12 @@ export type TextContentPart = {
|
|
12
12
|
readonly text: string;
|
13
13
|
};
|
14
14
|
|
15
|
+
export type ReasoningContentPart = {
|
16
|
+
readonly type: "reasoning";
|
17
|
+
readonly text: string;
|
18
|
+
};
|
19
|
+
|
20
|
+
|
15
21
|
export type ImageContentPart = {
|
16
22
|
readonly type: "image";
|
17
23
|
readonly image: string;
|
@@ -101,6 +107,7 @@ export type ThreadUserContentPart =
|
|
101
107
|
|
102
108
|
export type ThreadAssistantContentPart =
|
103
109
|
| TextContentPart
|
110
|
+
| ReasoningContentPart
|
104
111
|
| ToolCallContentPart
|
105
112
|
| UIContentPart;
|
106
113
|
|
@@ -3,6 +3,7 @@ import type {
|
|
3
3
|
ContentPartStatus,
|
4
4
|
FileContentPart,
|
5
5
|
ImageContentPart,
|
6
|
+
ReasoningContentPart,
|
6
7
|
TextContentPart,
|
7
8
|
ToolCallContentPart,
|
8
9
|
UIContentPart,
|
@@ -19,6 +20,9 @@ export type EmptyContentPartComponent = ComponentType<EmptyContentPartProps>;
|
|
19
20
|
export type TextContentPartProps = ContentPartState & TextContentPart;
|
20
21
|
export type TextContentPartComponent = ComponentType<TextContentPartProps>;
|
21
22
|
|
23
|
+
export type ReasoningContentPartProps = ContentPartState & ReasoningContentPart;
|
24
|
+
export type ReasoningContentPartComponent = ComponentType<ReasoningContentPartProps>;
|
25
|
+
|
22
26
|
export type ImageContentPartProps = ContentPartState & ImageContentPart;
|
23
27
|
export type ImageContentPartComponent = ComponentType<ImageContentPartProps>;
|
24
28
|
|
package/src/types/index.ts
CHANGED
@@ -8,6 +8,7 @@ export type {
|
|
8
8
|
export type {
|
9
9
|
AppendMessage,
|
10
10
|
TextContentPart,
|
11
|
+
ReasoningContentPart,
|
11
12
|
ImageContentPart,
|
12
13
|
FileContentPart,
|
13
14
|
Unstable_AudioContentPart,
|
@@ -37,6 +38,8 @@ export type {
|
|
37
38
|
EmptyContentPartComponent,
|
38
39
|
TextContentPartProps,
|
39
40
|
TextContentPartComponent,
|
41
|
+
ReasoningContentPartProps,
|
42
|
+
ReasoningContentPartComponent,
|
40
43
|
ImageContentPartProps,
|
41
44
|
ImageContentPartComponent,
|
42
45
|
FileContentPartProps,
|