@assistant-ui/react 0.7.69 → 0.7.71

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.
Files changed (177) hide show
  1. package/dist/api/MessageRuntime.d.ts +2 -1
  2. package/dist/api/MessageRuntime.d.ts.map +1 -1
  3. package/dist/api/MessageRuntime.js +9 -2
  4. package/dist/api/MessageRuntime.js.map +1 -1
  5. package/dist/api/MessageRuntime.mjs +9 -2
  6. package/dist/api/MessageRuntime.mjs.map +1 -1
  7. package/dist/cloud/auiV0.d.ts +3 -0
  8. package/dist/cloud/auiV0.d.ts.map +1 -1
  9. package/dist/cloud/auiV0.js +6 -0
  10. package/dist/cloud/auiV0.js.map +1 -1
  11. package/dist/cloud/auiV0.mjs +6 -0
  12. package/dist/cloud/auiV0.mjs.map +1 -1
  13. package/dist/context/providers/ThreadRuntimeProvider.d.ts.map +1 -1
  14. package/dist/context/providers/ThreadRuntimeProvider.js +3 -5
  15. package/dist/context/providers/ThreadRuntimeProvider.js.map +1 -1
  16. package/dist/context/providers/ThreadRuntimeProvider.mjs +3 -5
  17. package/dist/context/providers/ThreadRuntimeProvider.mjs.map +1 -1
  18. package/dist/context/providers/ThreadViewportProvider.d.ts +3 -0
  19. package/dist/context/providers/ThreadViewportProvider.d.ts.map +1 -0
  20. package/dist/context/providers/ThreadViewportProvider.js +63 -0
  21. package/dist/context/providers/ThreadViewportProvider.js.map +1 -0
  22. package/dist/context/providers/ThreadViewportProvider.mjs +42 -0
  23. package/dist/context/providers/ThreadViewportProvider.mjs.map +1 -0
  24. package/dist/context/react/ThreadContext.d.ts +0 -18
  25. package/dist/context/react/ThreadContext.d.ts.map +1 -1
  26. package/dist/context/react/ThreadContext.js +2 -11
  27. package/dist/context/react/ThreadContext.js.map +1 -1
  28. package/dist/context/react/ThreadContext.mjs +1 -8
  29. package/dist/context/react/ThreadContext.mjs.map +1 -1
  30. package/dist/context/react/ThreadViewportContext.d.ts +24 -0
  31. package/dist/context/react/ThreadViewportContext.d.ts.map +1 -0
  32. package/dist/context/react/ThreadViewportContext.js +44 -0
  33. package/dist/context/react/ThreadViewportContext.js.map +1 -0
  34. package/dist/context/react/ThreadViewportContext.mjs +18 -0
  35. package/dist/context/react/ThreadViewportContext.mjs.map +1 -0
  36. package/dist/context/react/index.d.ts +2 -1
  37. package/dist/context/react/index.d.ts.map +1 -1
  38. package/dist/context/react/index.js +3 -2
  39. package/dist/context/react/index.js.map +1 -1
  40. package/dist/context/react/index.mjs +4 -2
  41. package/dist/context/react/index.mjs.map +1 -1
  42. package/dist/context/stores/ThreadViewport.d.ts.map +1 -1
  43. package/dist/context/stores/ThreadViewport.js +1 -0
  44. package/dist/context/stores/ThreadViewport.js.map +1 -1
  45. package/dist/context/stores/ThreadViewport.mjs +2 -0
  46. package/dist/context/stores/ThreadViewport.mjs.map +1 -1
  47. package/dist/model-context/ModelContextTypes.d.ts +3 -0
  48. package/dist/model-context/ModelContextTypes.d.ts.map +1 -1
  49. package/dist/model-context/ModelContextTypes.js.map +1 -1
  50. package/dist/model-context/ModelContextTypes.mjs.map +1 -1
  51. package/dist/primitives/contentPart/useContentPartReasoning.d.ts +5 -0
  52. package/dist/primitives/contentPart/useContentPartReasoning.d.ts.map +1 -0
  53. package/dist/primitives/contentPart/useContentPartReasoning.js +42 -0
  54. package/dist/primitives/contentPart/useContentPartReasoning.js.map +1 -0
  55. package/dist/primitives/contentPart/useContentPartReasoning.mjs +18 -0
  56. package/dist/primitives/contentPart/useContentPartReasoning.mjs.map +1 -0
  57. package/dist/primitives/index.d.ts +1 -0
  58. package/dist/primitives/index.d.ts.map +1 -1
  59. package/dist/primitives/index.js +3 -0
  60. package/dist/primitives/index.js.map +1 -1
  61. package/dist/primitives/index.mjs +2 -0
  62. package/dist/primitives/index.mjs.map +1 -1
  63. package/dist/primitives/message/MessageContent.d.ts +2 -1
  64. package/dist/primitives/message/MessageContent.d.ts.map +1 -1
  65. package/dist/primitives/message/MessageContent.js +5 -1
  66. package/dist/primitives/message/MessageContent.js.map +1 -1
  67. package/dist/primitives/message/MessageContent.mjs +5 -1
  68. package/dist/primitives/message/MessageContent.mjs.map +1 -1
  69. package/dist/primitives/thread/ThreadScrollToBottom.d.ts.map +1 -1
  70. package/dist/primitives/thread/ThreadScrollToBottom.js +3 -4
  71. package/dist/primitives/thread/ThreadScrollToBottom.js.map +1 -1
  72. package/dist/primitives/thread/ThreadScrollToBottom.mjs +1 -2
  73. package/dist/primitives/thread/ThreadScrollToBottom.mjs.map +1 -1
  74. package/dist/primitives/thread/ThreadViewport.d.ts.map +1 -1
  75. package/dist/primitives/thread/ThreadViewport.js +5 -1
  76. package/dist/primitives/thread/ThreadViewport.js.map +1 -1
  77. package/dist/primitives/thread/ThreadViewport.mjs +5 -1
  78. package/dist/primitives/thread/ThreadViewport.mjs.map +1 -1
  79. package/dist/primitives/thread/useThreadViewportAutoScroll.d.ts.map +1 -1
  80. package/dist/primitives/thread/useThreadViewportAutoScroll.js +2 -1
  81. package/dist/primitives/thread/useThreadViewportAutoScroll.js.map +1 -1
  82. package/dist/primitives/thread/useThreadViewportAutoScroll.mjs +2 -4
  83. package/dist/primitives/thread/useThreadViewportAutoScroll.mjs.map +1 -1
  84. package/dist/runtimes/composer/DefaultEditComposerRuntimeCore.d.ts +1 -1
  85. package/dist/runtimes/composer/DefaultEditComposerRuntimeCore.d.ts.map +1 -1
  86. package/dist/runtimes/composer/DefaultEditComposerRuntimeCore.js +1 -0
  87. package/dist/runtimes/composer/DefaultEditComposerRuntimeCore.js.map +1 -1
  88. package/dist/runtimes/composer/DefaultEditComposerRuntimeCore.mjs +1 -0
  89. package/dist/runtimes/composer/DefaultEditComposerRuntimeCore.mjs.map +1 -1
  90. package/dist/runtimes/edge/EdgeRuntimeRequestOptions.d.ts +6 -6
  91. package/dist/runtimes/edge/converters/toCoreMessages.d.ts.map +1 -1
  92. package/dist/runtimes/edge/converters/toCoreMessages.js +2 -1
  93. package/dist/runtimes/edge/converters/toCoreMessages.js.map +1 -1
  94. package/dist/runtimes/edge/converters/toCoreMessages.mjs +2 -1
  95. package/dist/runtimes/edge/converters/toCoreMessages.mjs.map +1 -1
  96. package/dist/runtimes/edge/converters/toLanguageModelMessages.d.ts.map +1 -1
  97. package/dist/runtimes/edge/converters/toLanguageModelMessages.js +3 -0
  98. package/dist/runtimes/edge/converters/toLanguageModelMessages.js.map +1 -1
  99. package/dist/runtimes/edge/converters/toLanguageModelMessages.mjs +3 -0
  100. package/dist/runtimes/edge/converters/toLanguageModelMessages.mjs.map +1 -1
  101. package/dist/runtimes/edge/createEdgeRuntimeAPI.d.ts +2 -2
  102. package/dist/runtimes/edge/createEdgeRuntimeAPI.d.ts.map +1 -1
  103. package/dist/runtimes/edge/createEdgeRuntimeAPI.js +10 -1
  104. package/dist/runtimes/edge/createEdgeRuntimeAPI.js.map +1 -1
  105. package/dist/runtimes/edge/createEdgeRuntimeAPI.mjs +10 -1
  106. package/dist/runtimes/edge/createEdgeRuntimeAPI.mjs.map +1 -1
  107. package/dist/runtimes/edge/streams/assistantEncoderStream.d.ts.map +1 -1
  108. package/dist/runtimes/edge/streams/assistantEncoderStream.js +7 -0
  109. package/dist/runtimes/edge/streams/assistantEncoderStream.js.map +1 -1
  110. package/dist/runtimes/edge/streams/assistantEncoderStream.mjs +7 -0
  111. package/dist/runtimes/edge/streams/assistantEncoderStream.mjs.map +1 -1
  112. package/dist/runtimes/edge/streams/runResultStream.d.ts.map +1 -1
  113. package/dist/runtimes/edge/streams/runResultStream.js +19 -0
  114. package/dist/runtimes/edge/streams/runResultStream.js.map +1 -1
  115. package/dist/runtimes/edge/streams/runResultStream.mjs +19 -0
  116. package/dist/runtimes/edge/streams/runResultStream.mjs.map +1 -1
  117. package/dist/runtimes/edge/streams/toolResultStream.d.ts.map +1 -1
  118. package/dist/runtimes/edge/streams/toolResultStream.js +14 -15
  119. package/dist/runtimes/edge/streams/toolResultStream.js.map +1 -1
  120. package/dist/runtimes/edge/streams/toolResultStream.mjs +14 -15
  121. package/dist/runtimes/edge/streams/toolResultStream.mjs.map +1 -1
  122. package/dist/runtimes/external-store/ThreadMessageLike.d.ts +2 -2
  123. package/dist/runtimes/external-store/ThreadMessageLike.d.ts.map +1 -1
  124. package/dist/runtimes/external-store/ThreadMessageLike.js +1 -0
  125. package/dist/runtimes/external-store/ThreadMessageLike.js.map +1 -1
  126. package/dist/runtimes/external-store/ThreadMessageLike.mjs +1 -0
  127. package/dist/runtimes/external-store/ThreadMessageLike.mjs.map +1 -1
  128. package/dist/runtimes/local/ChatModelAdapter.d.ts +2 -2
  129. package/dist/runtimes/local/ChatModelAdapter.d.ts.map +1 -1
  130. package/dist/runtimes/local/ChatModelAdapter.js.map +1 -1
  131. package/dist/styles/index.css +57 -29
  132. package/dist/styles/index.css.map +1 -1
  133. package/dist/styles/tailwindcss/thread.css +30 -23
  134. package/dist/styles/tailwindcss/thread.css.json +31 -25
  135. package/dist/types/AssistantTypes.d.ts +5 -1
  136. package/dist/types/AssistantTypes.d.ts.map +1 -1
  137. package/dist/types/AssistantTypes.js.map +1 -1
  138. package/dist/types/ContentPartComponentTypes.d.ts +3 -1
  139. package/dist/types/ContentPartComponentTypes.d.ts.map +1 -1
  140. package/dist/types/ContentPartComponentTypes.js.map +1 -1
  141. package/dist/types/index.d.ts +2 -2
  142. package/dist/types/index.d.ts.map +1 -1
  143. package/dist/types/index.js.map +1 -1
  144. package/dist/utils/hooks/useOnScrollToBottom.js +2 -2
  145. package/dist/utils/hooks/useOnScrollToBottom.js.map +1 -1
  146. package/dist/utils/hooks/useOnScrollToBottom.mjs +1 -1
  147. package/dist/utils/hooks/useOnScrollToBottom.mjs.map +1 -1
  148. package/package.json +14 -14
  149. package/src/api/MessageRuntime.ts +14 -5
  150. package/src/cloud/auiV0.ts +11 -0
  151. package/src/context/providers/ThreadRuntimeProvider.tsx +4 -5
  152. package/src/context/providers/ThreadViewportProvider.tsx +49 -0
  153. package/src/context/react/ThreadContext.ts +0 -8
  154. package/src/context/react/ThreadViewportContext.ts +23 -0
  155. package/src/context/react/index.ts +4 -1
  156. package/src/context/stores/ThreadViewport.tsx +2 -0
  157. package/src/model-context/ModelContextTypes.ts +7 -0
  158. package/src/primitives/contentPart/useContentPartReasoning.tsx +18 -0
  159. package/src/primitives/index.ts +1 -0
  160. package/src/primitives/message/MessageContent.tsx +8 -0
  161. package/src/primitives/thread/ThreadScrollToBottom.tsx +1 -2
  162. package/src/primitives/thread/ThreadViewport.tsx +13 -1
  163. package/src/primitives/thread/useThreadViewportAutoScroll.tsx +2 -4
  164. package/src/runtimes/composer/DefaultEditComposerRuntimeCore.tsx +4 -1
  165. package/src/runtimes/edge/converters/toCoreMessages.ts +2 -1
  166. package/src/runtimes/edge/converters/toLanguageModelMessages.ts +4 -0
  167. package/src/runtimes/edge/createEdgeRuntimeAPI.ts +12 -3
  168. package/src/runtimes/edge/streams/assistantEncoderStream.ts +8 -0
  169. package/src/runtimes/edge/streams/runResultStream.ts +24 -0
  170. package/src/runtimes/edge/streams/toolResultStream.ts +21 -18
  171. package/src/runtimes/external-store/ThreadMessageLike.tsx +4 -2
  172. package/src/runtimes/local/ChatModelAdapter.tsx +2 -1
  173. package/src/styles/tailwindcss/thread.css +30 -23
  174. package/src/types/AssistantTypes.ts +7 -0
  175. package/src/types/ContentPartComponentTypes.tsx +4 -0
  176. package/src/types/index.ts +3 -0
  177. package/src/utils/hooks/useOnScrollToBottom.tsx +1 -1
@@ -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":[]}
@@ -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"}
@@ -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":[]}
@@ -26,10 +26,10 @@ __export(useOnScrollToBottom_exports, {
26
26
  module.exports = __toCommonJS(useOnScrollToBottom_exports);
27
27
  var import_react_use_callback_ref = require("@radix-ui/react-use-callback-ref");
28
28
  var import_react = require("react");
29
- var import_ThreadContext = require("../../context/react/ThreadContext.js");
29
+ var import_ThreadViewportContext = require("../../context/react/ThreadViewportContext.js");
30
30
  var useOnScrollToBottom = (callback) => {
31
31
  const callbackRef = (0, import_react_use_callback_ref.useCallbackRef)(callback);
32
- const onScrollToBottom = (0, import_ThreadContext.useThreadViewport)((vp) => vp.onScrollToBottom);
32
+ const onScrollToBottom = (0, import_ThreadViewportContext.useThreadViewport)((vp) => vp.onScrollToBottom);
33
33
  (0, import_react.useEffect)(() => {
34
34
  return onScrollToBottom(callbackRef);
35
35
  }, [onScrollToBottom, callbackRef]);
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/utils/hooks/useOnScrollToBottom.tsx"],"sourcesContent":["\"use client\";\n\nimport { useCallbackRef } from \"@radix-ui/react-use-callback-ref\";\nimport { useEffect } from \"react\";\nimport { useThreadViewport } from \"../../context/react/ThreadContext\";\n\nexport const useOnScrollToBottom = (callback: () => void) => {\n const callbackRef = useCallbackRef(callback);\n const onScrollToBottom = useThreadViewport((vp) => vp.onScrollToBottom);\n\n useEffect(() => {\n return onScrollToBottom(callbackRef);\n }, [onScrollToBottom, callbackRef]);\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,oCAA+B;AAC/B,mBAA0B;AAC1B,2BAAkC;AAE3B,IAAM,sBAAsB,CAAC,aAAyB;AAC3D,QAAM,kBAAc,8CAAe,QAAQ;AAC3C,QAAM,uBAAmB,wCAAkB,CAAC,OAAO,GAAG,gBAAgB;AAEtE,8BAAU,MAAM;AACd,WAAO,iBAAiB,WAAW;AAAA,EACrC,GAAG,CAAC,kBAAkB,WAAW,CAAC;AACpC;","names":[]}
1
+ {"version":3,"sources":["../../../src/utils/hooks/useOnScrollToBottom.tsx"],"sourcesContent":["\"use client\";\n\nimport { useCallbackRef } from \"@radix-ui/react-use-callback-ref\";\nimport { useEffect } from \"react\";\nimport { useThreadViewport } from \"../../context/react/ThreadViewportContext\";\n\nexport const useOnScrollToBottom = (callback: () => void) => {\n const callbackRef = useCallbackRef(callback);\n const onScrollToBottom = useThreadViewport((vp) => vp.onScrollToBottom);\n\n useEffect(() => {\n return onScrollToBottom(callbackRef);\n }, [onScrollToBottom, callbackRef]);\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,oCAA+B;AAC/B,mBAA0B;AAC1B,mCAAkC;AAE3B,IAAM,sBAAsB,CAAC,aAAyB;AAC3D,QAAM,kBAAc,8CAAe,QAAQ;AAC3C,QAAM,uBAAmB,gDAAkB,CAAC,OAAO,GAAG,gBAAgB;AAEtE,8BAAU,MAAM;AACd,WAAO,iBAAiB,WAAW;AAAA,EACrC,GAAG,CAAC,kBAAkB,WAAW,CAAC;AACpC;","names":[]}
@@ -3,7 +3,7 @@
3
3
  // src/utils/hooks/useOnScrollToBottom.tsx
4
4
  import { useCallbackRef } from "@radix-ui/react-use-callback-ref";
5
5
  import { useEffect } from "react";
6
- import { useThreadViewport } from "../../context/react/ThreadContext.mjs";
6
+ import { useThreadViewport } from "../../context/react/ThreadViewportContext.mjs";
7
7
  var useOnScrollToBottom = (callback) => {
8
8
  const callbackRef = useCallbackRef(callback);
9
9
  const onScrollToBottom = useThreadViewport((vp) => vp.onScrollToBottom);
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/utils/hooks/useOnScrollToBottom.tsx"],"sourcesContent":["\"use client\";\n\nimport { useCallbackRef } from \"@radix-ui/react-use-callback-ref\";\nimport { useEffect } from \"react\";\nimport { useThreadViewport } from \"../../context/react/ThreadContext\";\n\nexport const useOnScrollToBottom = (callback: () => void) => {\n const callbackRef = useCallbackRef(callback);\n const onScrollToBottom = useThreadViewport((vp) => vp.onScrollToBottom);\n\n useEffect(() => {\n return onScrollToBottom(callbackRef);\n }, [onScrollToBottom, callbackRef]);\n};\n"],"mappings":";;;AAEA,SAAS,sBAAsB;AAC/B,SAAS,iBAAiB;AAC1B,SAAS,yBAAyB;AAE3B,IAAM,sBAAsB,CAAC,aAAyB;AAC3D,QAAM,cAAc,eAAe,QAAQ;AAC3C,QAAM,mBAAmB,kBAAkB,CAAC,OAAO,GAAG,gBAAgB;AAEtE,YAAU,MAAM;AACd,WAAO,iBAAiB,WAAW;AAAA,EACrC,GAAG,CAAC,kBAAkB,WAAW,CAAC;AACpC;","names":[]}
1
+ {"version":3,"sources":["../../../src/utils/hooks/useOnScrollToBottom.tsx"],"sourcesContent":["\"use client\";\n\nimport { useCallbackRef } from \"@radix-ui/react-use-callback-ref\";\nimport { useEffect } from \"react\";\nimport { useThreadViewport } from \"../../context/react/ThreadViewportContext\";\n\nexport const useOnScrollToBottom = (callback: () => void) => {\n const callbackRef = useCallbackRef(callback);\n const onScrollToBottom = useThreadViewport((vp) => vp.onScrollToBottom);\n\n useEffect(() => {\n return onScrollToBottom(callbackRef);\n }, [onScrollToBottom, callbackRef]);\n};\n"],"mappings":";;;AAEA,SAAS,sBAAsB;AAC/B,SAAS,iBAAiB;AAC1B,SAAS,yBAAyB;AAE3B,IAAM,sBAAsB,CAAC,aAAyB;AAC3D,QAAM,cAAc,eAAe,QAAQ;AAC3C,QAAM,mBAAmB,kBAAkB,CAAC,OAAO,GAAG,gBAAgB;AAEtE,YAAU,MAAM;AACd,WAAO,iBAAiB,WAAW;AAAA,EACrC,GAAG,CAAC,kBAAkB,WAAW,CAAC;AACpC;","names":[]}
package/package.json CHANGED
@@ -29,7 +29,7 @@
29
29
  "conversational-ui",
30
30
  "conversational-ai"
31
31
  ],
32
- "version": "0.7.69",
32
+ "version": "0.7.71",
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.4",
68
+ "@ai-sdk/provider": "^1.0.7",
69
69
  "@radix-ui/primitive": "^1.1.1",
70
- "@radix-ui/react-avatar": "^1.1.2",
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.4",
74
- "@radix-ui/react-popover": "^1.1.4",
75
- "@radix-ui/react-primitive": "^2.0.1",
76
- "@radix-ui/react-slot": "^1.1.1",
77
- "@radix-ui/react-tooltip": "^1.1.6",
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.473.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.18"
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.10.7",
112
+ "@types/node": "^22.13.1",
113
113
  "autoprefixer": "^10.4.20",
114
114
  "eslint": "^9",
115
- "eslint-config-next": "15.1.5",
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/tsbuildutils": "^0.0.1",
120
121
  "@assistant-ui/tailwindcss-transformer": "0.1.0",
121
- "@assistant-ui/tsconfig": "0.0.0",
122
- "@assistant-ui/tsbuildutils": "^0.0.1"
122
+ "@assistant-ui/tsconfig": "0.0.0"
123
123
  },
124
124
  "publishConfig": {
125
125
  "access": "public",
@@ -150,10 +150,7 @@ export class MessageRuntimeImpl implements MessageRuntime {
150
150
  ref: this.path.ref + `${this.path.ref}.composer`,
151
151
  composerSource: "edit",
152
152
  },
153
- getState: () =>
154
- this._threadBinding
155
- .getState()
156
- .getEditComposer(this._core.getState().id),
153
+ getState: this._getEditComposerRuntimeCore,
157
154
  subscribe: (callback) => this._threadBinding.subscribe(callback),
158
155
  }),
159
156
  () => this._threadBinding.getState().beginEdit(this._core.getState().id),
@@ -177,11 +174,23 @@ export class MessageRuntimeImpl implements MessageRuntime {
177
174
 
178
175
  public readonly composer;
179
176
 
177
+ private _getEditComposerRuntimeCore = () => {
178
+ return this._threadBinding
179
+ .getState()
180
+ .getEditComposer(this._core.getState().id);
181
+ };
182
+
180
183
  public getState() {
181
184
  return this._core.getState();
182
185
  }
183
186
 
184
- public reload({ runConfig = {} }: ReloadConfig = {}) {
187
+ public reload(reloadConfig: ReloadConfig = {}) {
188
+ const editComposerRuntimeCore = this._getEditComposerRuntimeCore();
189
+ const composerRuntimeCore =
190
+ editComposerRuntimeCore ?? this._threadBinding.getState().composer;
191
+ const composer = editComposerRuntimeCore ?? composerRuntimeCore;
192
+
193
+ const { runConfig = composer.runConfig } = reloadConfig;
185
194
  const state = this._core.getState();
186
195
  if (state.role !== "assistant")
187
196
  throw new Error("Can only reload assistant messages");
@@ -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(
@@ -4,13 +4,13 @@ import type { FC, PropsWithChildren } from "react";
4
4
  import { useEffect, useState } from "react";
5
5
  import type { ThreadContextValue } from "../react/ThreadContext";
6
6
  import { ThreadContext } from "../react/ThreadContext";
7
- import { makeThreadViewportStore } from "../stores/ThreadViewport";
8
7
  import { writableStore } from "../ReadonlyStore";
9
8
  import { ThreadRuntime } from "../../api/ThreadRuntime";
10
9
  import { create } from "zustand";
11
10
  import { ThreadListItemRuntime } from "../../api/ThreadListItemRuntime";
12
11
  import { ThreadListItemRuntimeProvider } from "./ThreadListItemRuntimeProvider";
13
12
  import { ensureBinding } from "../react/utils/ensureBinding";
13
+ import { ThreadViewportProvider } from "./ThreadViewportProvider";
14
14
 
15
15
  type ThreadProviderProps = {
16
16
  listItemRuntime: ThreadListItemRuntime;
@@ -36,18 +36,17 @@ export const ThreadRuntimeProvider: FC<
36
36
  const useThreadRuntime = useThreadRuntimeStore(runtime);
37
37
 
38
38
  const [context] = useState<ThreadContextValue>(() => {
39
- const useViewport = makeThreadViewportStore();
40
-
41
39
  return {
42
40
  useThreadRuntime,
43
- useViewport,
44
41
  };
45
42
  });
46
43
 
47
44
  return (
48
45
  <ThreadListItemRuntimeProvider runtime={threadListItemRuntime}>
49
46
  <ThreadContext.Provider value={context}>
50
- {children}
47
+ {/* TODO temporarily allow accessing viewport state from outside the viewport */}
48
+ {/* TODO figure out if this behavior should be deprecated, since it is quite hacky */}
49
+ <ThreadViewportProvider>{children}</ThreadViewportProvider>
51
50
  </ThreadContext.Provider>
52
51
  </ThreadListItemRuntimeProvider>
53
52
  );
@@ -0,0 +1,49 @@
1
+ "use client";
2
+
3
+ import type { FC, PropsWithChildren } from "react";
4
+ import { useEffect, useState } from "react";
5
+ import { makeThreadViewportStore } from "../stores/ThreadViewport";
6
+ import {
7
+ ThreadViewportContext,
8
+ ThreadViewportContextValue,
9
+ useThreadViewportStore,
10
+ } from "../react/ThreadViewportContext";
11
+ import { writableStore } from "../ReadonlyStore";
12
+
13
+ const useThreadViewportStoreValue = () => {
14
+ const outerViewport = useThreadViewportStore({ optional: true });
15
+ const [store] = useState(() => makeThreadViewportStore());
16
+
17
+ useEffect(() => {
18
+ return outerViewport?.getState().onScrollToBottom(() => {
19
+ store.getState().scrollToBottom();
20
+ });
21
+ }, [outerViewport, store]);
22
+
23
+ useEffect(() => {
24
+ if (!outerViewport) return;
25
+ return store.subscribe((state) => {
26
+ if (outerViewport.getState().isAtBottom !== state.isAtBottom) {
27
+ writableStore(outerViewport).setState({ isAtBottom: state.isAtBottom });
28
+ }
29
+ });
30
+ }, [store, outerViewport]);
31
+
32
+ return store;
33
+ };
34
+
35
+ export const ThreadViewportProvider: FC<PropsWithChildren> = ({ children }) => {
36
+ const useThreadViewport = useThreadViewportStoreValue();
37
+
38
+ const [context] = useState<ThreadViewportContextValue>(() => {
39
+ return {
40
+ useThreadViewport,
41
+ };
42
+ });
43
+
44
+ return (
45
+ <ThreadViewportContext.Provider value={context}>
46
+ {children}
47
+ </ThreadViewportContext.Provider>
48
+ );
49
+ };
@@ -1,11 +1,9 @@
1
1
  "use client";
2
2
 
3
3
  import { createContext, useEffect, useState } from "react";
4
- import type { ThreadViewportState } from "../stores/ThreadViewport";
5
4
  import { ReadonlyStore } from "../ReadonlyStore";
6
5
  import { UseBoundStore } from "zustand";
7
6
  import { createContextHook } from "./utils/createContextHook";
8
- import { createContextStoreHook } from "./utils/createContextStoreHook";
9
7
  import { ThreadRuntime } from "../../api/ThreadRuntime";
10
8
  import { ModelContext } from "../../model-context";
11
9
  import { createStateHookForRuntime } from "./utils/createStateHookForRuntime";
@@ -13,7 +11,6 @@ import { ThreadComposerRuntime } from "../../api";
13
11
 
14
12
  export type ThreadContextValue = {
15
13
  useThreadRuntime: UseBoundStore<ReadonlyStore<ThreadRuntime>>;
16
- useViewport: UseBoundStore<ReadonlyStore<ThreadViewportState>>;
17
14
  };
18
15
 
19
16
  export const ThreadContext = createContext<ThreadContextValue | null>(null);
@@ -44,11 +41,6 @@ export const useThreadComposer = createStateHookForRuntime(
44
41
  useThreadComposerRuntime,
45
42
  );
46
43
 
47
- export const {
48
- useViewport: useThreadViewport,
49
- useViewportStore: useThreadViewportStore,
50
- } = createContextStoreHook(useThreadContext, "useViewport");
51
-
52
44
  export function useThreadModelContext(options?: {
53
45
  optional?: false | undefined;
54
46
  }): ModelContext;
@@ -0,0 +1,23 @@
1
+ "use client";
2
+
3
+ import { createContext } from "react";
4
+ import { ReadonlyStore } from "../ReadonlyStore";
5
+ import { UseBoundStore } from "zustand";
6
+ import { createContextHook } from "./utils/createContextHook";
7
+ import { createContextStoreHook } from "./utils/createContextStoreHook";
8
+ import { ThreadViewportState } from "../stores";
9
+
10
+ export type ThreadViewportContextValue = {
11
+ useThreadViewport: UseBoundStore<ReadonlyStore<ThreadViewportState>>;
12
+ };
13
+
14
+ export const ThreadViewportContext =
15
+ createContext<ThreadViewportContextValue | null>(null);
16
+
17
+ const useThreadViewportContext = createContextHook(
18
+ ThreadViewportContext,
19
+ "ThreadPrimitive.Viewport",
20
+ );
21
+
22
+ export const { useThreadViewport, useThreadViewportStore } =
23
+ createContextStoreHook(useThreadViewportContext, "useThreadViewport");
@@ -18,9 +18,12 @@ export {
18
18
  * @deprecated This method was renamed to `useThreadModelContext`.
19
19
  */
20
20
  useThreadModelContext as useThreadModelConfig,
21
+ } from "./ThreadContext";
22
+
23
+ export {
21
24
  useThreadViewport,
22
25
  useThreadViewportStore,
23
- } from "./ThreadContext";
26
+ } from "./ThreadViewportContext";
24
27
 
25
28
  export {
26
29
  useThreadListItemRuntime,
@@ -1,3 +1,5 @@
1
+ "use client";
2
+
1
3
  import { create } from "zustand";
2
4
  import type { Unsubscribe } from "../../types/Unsubscribe";
3
5
 
@@ -27,10 +27,16 @@ export type LanguageModelConfig = z.infer<typeof LanguageModelConfigSchema>;
27
27
  type ToolExecuteFunction<TArgs, TResult> = (
28
28
  args: TArgs,
29
29
  context: {
30
+ toolCallId: string;
30
31
  abortSignal: AbortSignal;
31
32
  },
32
33
  ) => TResult | Promise<TResult>;
33
34
 
35
+ type OnSchemaValidationErrorFunction<TResult> = ToolExecuteFunction<
36
+ unknown,
37
+ TResult
38
+ >;
39
+
34
40
  export type Tool<
35
41
  TArgs extends Record<string, unknown> = Record<string | number, unknown>,
36
42
  TResult = unknown,
@@ -38,6 +44,7 @@ export type Tool<
38
44
  description?: string | undefined;
39
45
  parameters: z.ZodSchema<TArgs> | JSONSchema7;
40
46
  execute?: ToolExecuteFunction<TArgs, TResult>;
47
+ experimental_onSchemaValidationError?: OnSchemaValidationErrorFunction<TResult>;
41
48
  };
42
49
 
43
50
  export type ModelContext = {
@@ -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
+ };
@@ -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 &&
@@ -6,8 +6,7 @@ import {
6
6
  createActionButton,
7
7
  } from "../../utils/createActionButton";
8
8
  import { useCallback } from "react";
9
- import { useThreadViewport } from "../../context";
10
- import { useThreadViewportStore } from "../../context/react/ThreadContext";
9
+ import { useThreadViewport, useThreadViewportStore } from "../../context/react/ThreadViewportContext";
11
10
 
12
11
  const useThreadScrollToBottom = () => {
13
12
  const isAtBottom = useThreadViewport((s) => s.isAtBottom);
@@ -4,6 +4,7 @@ import { useComposedRefs } from "@radix-ui/react-compose-refs";
4
4
  import { Primitive } from "@radix-ui/react-primitive";
5
5
  import { type ComponentRef, forwardRef, ComponentPropsWithoutRef } from "react";
6
6
  import { useThreadViewportAutoScroll } from "./useThreadViewportAutoScroll";
7
+ import { ThreadViewportProvider } from "../../context/providers/ThreadViewportProvider";
7
8
 
8
9
  export namespace ThreadPrimitiveViewport {
9
10
  export type Element = ComponentRef<typeof Primitive.div>;
@@ -12,7 +13,7 @@ export namespace ThreadPrimitiveViewport {
12
13
  };
13
14
  }
14
15
 
15
- export const ThreadPrimitiveViewport = forwardRef<
16
+ const ThreadPrimitiveViewportScrollable = forwardRef<
16
17
  ThreadPrimitiveViewport.Element,
17
18
  ThreadPrimitiveViewport.Props
18
19
  >(({ autoScroll, children, ...rest }, forwardedRef) => {
@@ -29,4 +30,15 @@ export const ThreadPrimitiveViewport = forwardRef<
29
30
  );
30
31
  });
31
32
 
33
+ export const ThreadPrimitiveViewport = forwardRef<
34
+ ThreadPrimitiveViewport.Element,
35
+ ThreadPrimitiveViewport.Props
36
+ >((props, ref) => {
37
+ return (
38
+ <ThreadViewportProvider>
39
+ <ThreadPrimitiveViewportScrollable {...props} ref={ref} />
40
+ </ThreadViewportProvider>
41
+ );
42
+ });
43
+
32
44
  ThreadPrimitiveViewport.displayName = "ThreadPrimitive.Viewport";
@@ -2,14 +2,12 @@
2
2
 
3
3
  import { useComposedRefs } from "@radix-ui/react-compose-refs";
4
4
  import { RefCallback, useEffect, useRef } from "react";
5
- import {
6
- useThreadRuntime,
7
- useThreadViewportStore,
8
- } from "../../context/react/ThreadContext";
5
+ import { useThreadRuntime } from "../../context/react/ThreadContext";
9
6
  import { useOnResizeContent } from "../../utils/hooks/useOnResizeContent";
10
7
  import { useOnScrollToBottom } from "../../utils/hooks/useOnScrollToBottom";
11
8
  import { useManagedRef } from "../../utils/hooks/useManagedRef";
12
9
  import { writableStore } from "../../context/ReadonlyStore";
10
+ import { useThreadViewportStore } from "../../context/react/ThreadViewportContext";
13
11
 
14
12
  export namespace useThreadViewportAutoScroll {
15
13
  export type Options = {
@@ -18,7 +18,7 @@ export class DefaultEditComposerRuntimeCore extends BaseComposerRuntimeCore {
18
18
  private _parentId;
19
19
  private _sourceId;
20
20
  constructor(
21
- private runtime: Omit<ThreadRuntimeCore, "composer"> & {
21
+ private runtime: ThreadRuntimeCore & {
22
22
  adapters?: { attachments?: AttachmentAdapter | undefined } | undefined;
23
23
  },
24
24
  private endEditCallback: () => void,
@@ -36,6 +36,9 @@ export class DefaultEditComposerRuntimeCore extends BaseComposerRuntimeCore {
36
36
  this._nonTextParts = message.content.filter(
37
37
  (part) => part.type !== "text" && part.type !== "ui",
38
38
  );
39
+
40
+ // Use the runConfig from the regular (non-edit) composer as the initial runConfig for the edit composer
41
+ this.setRunConfig({ ...runtime.composer.runConfig });
39
42
  }
40
43
 
41
44
  public async handleSend(
@@ -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
- } satisfies CoreMessage,
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({