@assistant-ui/react-native 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (255) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +2 -6
  3. package/dist/client/index.d.ts +5 -0
  4. package/dist/client/index.d.ts.map +1 -0
  5. package/dist/client/index.js +7 -0
  6. package/dist/client/index.js.map +1 -0
  7. package/dist/context/AssistantContext.d.ts.map +1 -1
  8. package/dist/context/AssistantContext.js +4 -9
  9. package/dist/context/AssistantContext.js.map +1 -1
  10. package/dist/context/providers/AttachmentByIndexProvider.d.ts +2 -0
  11. package/dist/context/providers/AttachmentByIndexProvider.d.ts.map +1 -0
  12. package/dist/context/providers/AttachmentByIndexProvider.js +2 -0
  13. package/dist/context/providers/AttachmentByIndexProvider.js.map +1 -0
  14. package/dist/context/providers/RuntimeAdapterProvider.d.ts +2 -1
  15. package/dist/context/providers/RuntimeAdapterProvider.d.ts.map +1 -1
  16. package/dist/context/providers/RuntimeAdapterProvider.js.map +1 -1
  17. package/dist/context/providers/ThreadListItemRuntimeProvider.d.ts +1 -5
  18. package/dist/context/providers/ThreadListItemRuntimeProvider.d.ts.map +1 -1
  19. package/dist/context/providers/ThreadListItemRuntimeProvider.js +1 -9
  20. package/dist/context/providers/ThreadListItemRuntimeProvider.js.map +1 -1
  21. package/dist/index.d.ts +15 -6
  22. package/dist/index.d.ts.map +1 -1
  23. package/dist/index.js +17 -6
  24. package/dist/index.js.map +1 -1
  25. package/dist/model-context/index.d.ts +9 -0
  26. package/dist/model-context/index.d.ts.map +1 -0
  27. package/dist/model-context/index.js +7 -0
  28. package/dist/model-context/index.js.map +1 -0
  29. package/dist/primitive-hooks/index.d.ts +1 -0
  30. package/dist/primitive-hooks/index.d.ts.map +1 -1
  31. package/dist/primitive-hooks/index.js +1 -0
  32. package/dist/primitive-hooks/index.js.map +1 -1
  33. package/dist/primitive-hooks/useComposerAddAttachment.d.ts +5 -0
  34. package/dist/primitive-hooks/useComposerAddAttachment.d.ts.map +1 -0
  35. package/dist/primitive-hooks/useComposerAddAttachment.js +10 -0
  36. package/dist/primitive-hooks/useComposerAddAttachment.js.map +1 -0
  37. package/dist/primitive-hooks/useThreadIsRunning.js +2 -2
  38. package/dist/primitive-hooks/useThreadIsRunning.js.map +1 -1
  39. package/dist/primitives/attachment/AttachmentName.d.ts +5 -0
  40. package/dist/primitives/attachment/AttachmentName.d.ts.map +1 -0
  41. package/dist/primitives/attachment/AttachmentName.js +8 -0
  42. package/dist/primitives/attachment/AttachmentName.js.map +1 -0
  43. package/dist/primitives/attachment/AttachmentRemove.d.ts +7 -0
  44. package/dist/primitives/attachment/AttachmentRemove.d.ts.map +1 -0
  45. package/dist/primitives/attachment/AttachmentRemove.js +12 -0
  46. package/dist/primitives/attachment/AttachmentRemove.js.map +1 -0
  47. package/dist/primitives/attachment/AttachmentRoot.d.ts +7 -0
  48. package/dist/primitives/attachment/AttachmentRoot.d.ts.map +1 -0
  49. package/dist/primitives/attachment/AttachmentRoot.js +6 -0
  50. package/dist/primitives/attachment/AttachmentRoot.js.map +1 -0
  51. package/dist/primitives/attachment/AttachmentThumb.d.ts +5 -0
  52. package/dist/primitives/attachment/AttachmentThumb.d.ts.map +1 -0
  53. package/dist/primitives/attachment/AttachmentThumb.js +11 -0
  54. package/dist/primitives/attachment/AttachmentThumb.js.map +1 -0
  55. package/dist/primitives/attachment/index.d.ts +5 -0
  56. package/dist/primitives/attachment/index.d.ts.map +1 -0
  57. package/dist/primitives/attachment/index.js +5 -0
  58. package/dist/primitives/attachment/index.js.map +1 -0
  59. package/dist/primitives/chainOfThought/ChainOfThoughtAccordionTrigger.d.ts +7 -0
  60. package/dist/primitives/chainOfThought/ChainOfThoughtAccordionTrigger.d.ts.map +1 -0
  61. package/dist/primitives/chainOfThought/ChainOfThoughtAccordionTrigger.js +13 -0
  62. package/dist/primitives/chainOfThought/ChainOfThoughtAccordionTrigger.js.map +1 -0
  63. package/dist/primitives/chainOfThought/ChainOfThoughtRoot.d.ts +7 -0
  64. package/dist/primitives/chainOfThought/ChainOfThoughtRoot.d.ts.map +1 -0
  65. package/dist/primitives/chainOfThought/ChainOfThoughtRoot.js +6 -0
  66. package/dist/primitives/chainOfThought/ChainOfThoughtRoot.js.map +1 -0
  67. package/dist/primitives/chainOfThought/index.d.ts +4 -0
  68. package/dist/primitives/chainOfThought/index.d.ts.map +1 -0
  69. package/dist/primitives/chainOfThought/index.js +4 -0
  70. package/dist/primitives/chainOfThought/index.js.map +1 -0
  71. package/dist/primitives/composer/ComposerAddAttachment.d.ts +14 -0
  72. package/dist/primitives/composer/ComposerAddAttachment.d.ts.map +1 -0
  73. package/dist/primitives/composer/ComposerAddAttachment.js +17 -0
  74. package/dist/primitives/composer/ComposerAddAttachment.js.map +1 -0
  75. package/dist/primitives/composer/ComposerAttachments.d.ts +18 -0
  76. package/dist/primitives/composer/ComposerAttachments.d.ts.map +1 -0
  77. package/dist/primitives/composer/ComposerAttachments.js +4 -0
  78. package/dist/primitives/composer/ComposerAttachments.js.map +1 -0
  79. package/dist/primitives/composer/ComposerIf.d.ts +2 -0
  80. package/dist/primitives/composer/ComposerIf.d.ts.map +1 -0
  81. package/dist/primitives/composer/ComposerIf.js +2 -0
  82. package/dist/primitives/composer/ComposerIf.js.map +1 -0
  83. package/dist/primitives/composer/index.d.ts +3 -0
  84. package/dist/primitives/composer/index.d.ts.map +1 -1
  85. package/dist/primitives/composer/index.js +3 -0
  86. package/dist/primitives/composer/index.js.map +1 -1
  87. package/dist/primitives/message/MessageAttachments.d.ts +12 -0
  88. package/dist/primitives/message/MessageAttachments.d.ts.map +1 -0
  89. package/dist/primitives/message/MessageAttachments.js +4 -0
  90. package/dist/primitives/message/MessageAttachments.js.map +1 -0
  91. package/dist/primitives/message/MessageContent.d.ts.map +1 -1
  92. package/dist/primitives/message/MessageContent.js +34 -9
  93. package/dist/primitives/message/MessageContent.js.map +1 -1
  94. package/dist/primitives/message/MessageIf.js +2 -2
  95. package/dist/primitives/message/MessageIf.js.map +1 -1
  96. package/dist/primitives/message/MessageParts.d.ts +11 -0
  97. package/dist/primitives/message/MessageParts.d.ts.map +1 -0
  98. package/dist/primitives/message/MessageParts.js +37 -0
  99. package/dist/primitives/message/MessageParts.js.map +1 -0
  100. package/dist/primitives/message/index.d.ts +2 -0
  101. package/dist/primitives/message/index.d.ts.map +1 -1
  102. package/dist/primitives/message/index.js +2 -0
  103. package/dist/primitives/message/index.js.map +1 -1
  104. package/dist/primitives/suggestion/SuggestionDescription.d.ts +7 -0
  105. package/dist/primitives/suggestion/SuggestionDescription.d.ts.map +1 -0
  106. package/dist/primitives/suggestion/SuggestionDescription.js +8 -0
  107. package/dist/primitives/suggestion/SuggestionDescription.js.map +1 -0
  108. package/dist/primitives/suggestion/SuggestionTitle.d.ts +7 -0
  109. package/dist/primitives/suggestion/SuggestionTitle.d.ts.map +1 -0
  110. package/dist/primitives/suggestion/SuggestionTitle.js +8 -0
  111. package/dist/primitives/suggestion/SuggestionTitle.js.map +1 -0
  112. package/dist/primitives/suggestion/SuggestionTrigger.d.ts +18 -0
  113. package/dist/primitives/suggestion/SuggestionTrigger.d.ts.map +1 -0
  114. package/dist/primitives/suggestion/SuggestionTrigger.js +35 -0
  115. package/dist/primitives/suggestion/SuggestionTrigger.js.map +1 -0
  116. package/dist/primitives/suggestion/index.d.ts +4 -0
  117. package/dist/primitives/suggestion/index.d.ts.map +1 -0
  118. package/dist/primitives/suggestion/index.js +4 -0
  119. package/dist/primitives/suggestion/index.js.map +1 -0
  120. package/dist/primitives/thread/ThreadIf.js +2 -2
  121. package/dist/primitives/thread/ThreadIf.js.map +1 -1
  122. package/dist/primitives/thread/ThreadSuggestion.d.ts +20 -0
  123. package/dist/primitives/thread/ThreadSuggestion.d.ts.map +1 -0
  124. package/dist/primitives/thread/ThreadSuggestion.js +34 -0
  125. package/dist/primitives/thread/ThreadSuggestion.js.map +1 -0
  126. package/dist/primitives/thread/index.d.ts +3 -0
  127. package/dist/primitives/thread/index.d.ts.map +1 -1
  128. package/dist/primitives/thread/index.js +3 -0
  129. package/dist/primitives/thread/index.js.map +1 -1
  130. package/dist/primitives/threadList/ThreadListItems.js +2 -2
  131. package/dist/primitives/threadList/ThreadListItems.js.map +1 -1
  132. package/dist/primitives/threadListItem/ThreadListItemArchive.d.ts +7 -0
  133. package/dist/primitives/threadListItem/ThreadListItemArchive.d.ts.map +1 -0
  134. package/dist/primitives/threadListItem/ThreadListItemArchive.js +12 -0
  135. package/dist/primitives/threadListItem/ThreadListItemArchive.js.map +1 -0
  136. package/dist/primitives/threadListItem/ThreadListItemDelete.d.ts +7 -0
  137. package/dist/primitives/threadListItem/ThreadListItemDelete.d.ts.map +1 -0
  138. package/dist/primitives/threadListItem/ThreadListItemDelete.js +12 -0
  139. package/dist/primitives/threadListItem/ThreadListItemDelete.js.map +1 -0
  140. package/dist/primitives/threadListItem/ThreadListItemRoot.d.ts +7 -0
  141. package/dist/primitives/threadListItem/ThreadListItemRoot.d.ts.map +1 -0
  142. package/dist/primitives/threadListItem/ThreadListItemRoot.js +6 -0
  143. package/dist/primitives/threadListItem/ThreadListItemRoot.js.map +1 -0
  144. package/dist/primitives/threadListItem/ThreadListItemTrigger.d.ts +7 -0
  145. package/dist/primitives/threadListItem/ThreadListItemTrigger.d.ts.map +1 -0
  146. package/dist/primitives/threadListItem/ThreadListItemTrigger.js +12 -0
  147. package/dist/primitives/threadListItem/ThreadListItemTrigger.js.map +1 -0
  148. package/dist/primitives/threadListItem/ThreadListItemUnarchive.d.ts +7 -0
  149. package/dist/primitives/threadListItem/ThreadListItemUnarchive.d.ts.map +1 -0
  150. package/dist/primitives/threadListItem/ThreadListItemUnarchive.js +12 -0
  151. package/dist/primitives/threadListItem/ThreadListItemUnarchive.js.map +1 -0
  152. package/dist/primitives/threadListItem/index.d.ts +7 -0
  153. package/dist/primitives/threadListItem/index.d.ts.map +1 -0
  154. package/dist/primitives/threadListItem/index.js +7 -0
  155. package/dist/primitives/threadListItem/index.js.map +1 -0
  156. package/dist/runtimes/RemoteThreadListThreadListRuntimeCore.d.ts +2 -1
  157. package/dist/runtimes/RemoteThreadListThreadListRuntimeCore.d.ts.map +1 -1
  158. package/dist/runtimes/RemoteThreadListThreadListRuntimeCore.js +8 -2
  159. package/dist/runtimes/RemoteThreadListThreadListRuntimeCore.js.map +1 -1
  160. package/dist/runtimes/useLocalRuntime.d.ts.map +1 -1
  161. package/dist/runtimes/useLocalRuntime.js +7 -2
  162. package/dist/runtimes/useLocalRuntime.js.map +1 -1
  163. package/dist/runtimes/useRemoteThreadListRuntime.d.ts.map +1 -1
  164. package/dist/runtimes/useRemoteThreadListRuntime.js +14 -4
  165. package/dist/runtimes/useRemoteThreadListRuntime.js.map +1 -1
  166. package/dist/types/index.d.ts +2 -0
  167. package/dist/types/index.d.ts.map +1 -0
  168. package/dist/types/index.js +2 -0
  169. package/dist/types/index.js.map +1 -0
  170. package/dist/types/scopes/index.d.ts +3 -0
  171. package/dist/types/scopes/index.d.ts.map +1 -0
  172. package/dist/types/scopes/index.js +2 -0
  173. package/dist/types/scopes/index.js.map +1 -0
  174. package/package.json +13 -13
  175. package/src/client/index.ts +7 -0
  176. package/src/context/AssistantContext.tsx +6 -19
  177. package/src/context/providers/AttachmentByIndexProvider.tsx +4 -0
  178. package/src/context/providers/RuntimeAdapterProvider.tsx +2 -0
  179. package/src/context/providers/ThreadListItemRuntimeProvider.tsx +1 -16
  180. package/src/index.ts +52 -17
  181. package/src/model-context/index.ts +44 -0
  182. package/src/primitive-hooks/index.ts +1 -0
  183. package/src/primitive-hooks/useComposerAddAttachment.ts +16 -0
  184. package/src/primitive-hooks/useThreadIsRunning.ts +2 -2
  185. package/src/primitives/attachment/AttachmentName.tsx +10 -0
  186. package/src/primitives/attachment/AttachmentRemove.tsx +25 -0
  187. package/src/primitives/attachment/AttachmentRoot.tsx +13 -0
  188. package/src/primitives/attachment/AttachmentThumb.tsx +13 -0
  189. package/src/primitives/attachment/index.ts +7 -0
  190. package/src/primitives/chainOfThought/ChainOfThoughtAccordionTrigger.tsx +28 -0
  191. package/src/primitives/chainOfThought/ChainOfThoughtRoot.tsx +13 -0
  192. package/src/primitives/chainOfThought/index.ts +9 -0
  193. package/src/primitives/composer/ComposerAddAttachment.tsx +30 -0
  194. package/src/primitives/composer/ComposerAttachments.tsx +25 -0
  195. package/src/primitives/composer/ComposerIf.tsx +1 -0
  196. package/src/primitives/composer/index.ts +9 -0
  197. package/src/primitives/message/MessageAttachments.tsx +18 -0
  198. package/src/primitives/message/MessageContent.tsx +82 -7
  199. package/src/primitives/message/MessageIf.tsx +2 -2
  200. package/src/primitives/message/MessageParts.tsx +60 -0
  201. package/src/primitives/message/index.ts +8 -0
  202. package/src/primitives/suggestion/SuggestionDescription.tsx +16 -0
  203. package/src/primitives/suggestion/SuggestionTitle.tsx +16 -0
  204. package/src/primitives/suggestion/SuggestionTrigger.tsx +64 -0
  205. package/src/primitives/suggestion/index.ts +12 -0
  206. package/src/primitives/thread/ThreadIf.tsx +2 -2
  207. package/src/primitives/thread/ThreadSuggestion.tsx +66 -0
  208. package/src/primitives/thread/index.ts +12 -0
  209. package/src/primitives/threadList/ThreadListItems.tsx +2 -2
  210. package/src/primitives/threadListItem/ThreadListItemArchive.tsx +24 -0
  211. package/src/primitives/threadListItem/ThreadListItemDelete.tsx +24 -0
  212. package/src/primitives/threadListItem/ThreadListItemRoot.tsx +13 -0
  213. package/src/primitives/threadListItem/ThreadListItemTrigger.tsx +24 -0
  214. package/src/primitives/threadListItem/ThreadListItemUnarchive.tsx +24 -0
  215. package/src/primitives/threadListItem/index.ts +21 -0
  216. package/src/runtimes/RemoteThreadListThreadListRuntimeCore.tsx +14 -4
  217. package/src/runtimes/useLocalRuntime.ts +7 -2
  218. package/src/runtimes/useRemoteThreadListRuntime.ts +20 -4
  219. package/src/types/index.ts +23 -0
  220. package/src/types/scopes/index.ts +59 -0
  221. package/dist/hooks/index.d.ts +0 -6
  222. package/dist/hooks/index.d.ts.map +0 -1
  223. package/dist/hooks/index.js +0 -6
  224. package/dist/hooks/index.js.map +0 -1
  225. package/dist/hooks/useComposer.d.ts +0 -4
  226. package/dist/hooks/useComposer.d.ts.map +0 -1
  227. package/dist/hooks/useComposer.js +0 -5
  228. package/dist/hooks/useComposer.js.map +0 -1
  229. package/dist/hooks/useContentPart.d.ts +0 -2
  230. package/dist/hooks/useContentPart.d.ts.map +0 -1
  231. package/dist/hooks/useContentPart.js +0 -5
  232. package/dist/hooks/useContentPart.js.map +0 -1
  233. package/dist/hooks/useMessage.d.ts +0 -4
  234. package/dist/hooks/useMessage.d.ts.map +0 -1
  235. package/dist/hooks/useMessage.js +0 -5
  236. package/dist/hooks/useMessage.js.map +0 -1
  237. package/dist/hooks/useThread.d.ts +0 -4
  238. package/dist/hooks/useThread.d.ts.map +0 -1
  239. package/dist/hooks/useThread.js +0 -5
  240. package/dist/hooks/useThread.js.map +0 -1
  241. package/dist/hooks/useThreadList.d.ts +0 -4
  242. package/dist/hooks/useThreadList.d.ts.map +0 -1
  243. package/dist/hooks/useThreadList.js +0 -5
  244. package/dist/hooks/useThreadList.js.map +0 -1
  245. package/dist/runtimes/runtime-adapter.d.ts +0 -3
  246. package/dist/runtimes/runtime-adapter.d.ts.map +0 -1
  247. package/dist/runtimes/runtime-adapter.js +0 -44
  248. package/dist/runtimes/runtime-adapter.js.map +0 -1
  249. package/src/hooks/index.ts +0 -5
  250. package/src/hooks/useComposer.ts +0 -14
  251. package/src/hooks/useContentPart.ts +0 -5
  252. package/src/hooks/useMessage.ts +0 -14
  253. package/src/hooks/useThread.ts +0 -14
  254. package/src/hooks/useThreadList.ts +0 -14
  255. package/src/runtimes/runtime-adapter.ts +0 -63
@@ -1,10 +1,7 @@
1
- import { type ComponentType, type ReactNode, memo } from "react";
2
- import { useAui, AuiProvider } from "@assistant-ui/store";
3
- import type {
4
- AssistantRuntime,
5
- AssistantRuntimeCore,
6
- } from "@assistant-ui/core";
7
- import { RuntimeAdapter } from "../runtimes/runtime-adapter";
1
+ import { type ReactNode, memo } from "react";
2
+ import { useAui } from "@assistant-ui/store";
3
+ import type { AssistantRuntime } from "@assistant-ui/core";
4
+ import { AssistantProviderBase } from "@assistant-ui/core/react";
8
5
 
9
6
  export const useAssistantRuntime = (): AssistantRuntime => {
10
7
  const aui = useAui();
@@ -17,12 +14,6 @@ export const useAssistantRuntime = (): AssistantRuntime => {
17
14
  return runtime;
18
15
  };
19
16
 
20
- const getRenderComponent = (runtime: AssistantRuntime) => {
21
- return (runtime as { _core?: AssistantRuntimeCore })._core?.RenderComponent as
22
- | ComponentType
23
- | undefined;
24
- };
25
-
26
17
  export const AssistantProvider = memo(
27
18
  ({
28
19
  runtime,
@@ -31,14 +22,10 @@ export const AssistantProvider = memo(
31
22
  runtime: AssistantRuntime;
32
23
  children: ReactNode;
33
24
  }) => {
34
- const aui = useAui({ threads: RuntimeAdapter(runtime) }, { parent: null });
35
- const RenderComponent = getRenderComponent(runtime);
36
-
37
25
  return (
38
- <AuiProvider value={aui}>
39
- {RenderComponent && <RenderComponent />}
26
+ <AssistantProviderBase runtime={runtime}>
40
27
  {children}
41
- </AuiProvider>
28
+ </AssistantProviderBase>
42
29
  );
43
30
  },
44
31
  );
@@ -0,0 +1,4 @@
1
+ export {
2
+ MessageAttachmentByIndexProvider,
3
+ ComposerAttachmentByIndexProvider,
4
+ } from "@assistant-ui/core/react";
@@ -2,9 +2,11 @@ import { createContext, FC, ReactNode, useContext } from "react";
2
2
  import type {
3
3
  ThreadHistoryAdapter,
4
4
  AttachmentAdapter,
5
+ ModelContextProvider,
5
6
  } from "@assistant-ui/core";
6
7
 
7
8
  export type RuntimeAdapters = {
9
+ modelContext?: ModelContextProvider | undefined;
8
10
  history?: ThreadHistoryAdapter | undefined;
9
11
  attachments?: AttachmentAdapter | undefined;
10
12
  };
@@ -1,16 +1 @@
1
- import { type FC, type PropsWithChildren } from "react";
2
- import { useAui, AuiProvider } from "@assistant-ui/store";
3
- import type { ThreadListItemRuntime } from "@assistant-ui/core";
4
- import { ThreadListItemClient } from "@assistant-ui/core/store/internal";
5
-
6
- export const ThreadListItemRuntimeProvider: FC<
7
- PropsWithChildren<{
8
- runtime: ThreadListItemRuntime;
9
- }>
10
- > = ({ runtime, children }) => {
11
- const aui = useAui({
12
- threadListItem: ThreadListItemClient({ runtime }),
13
- });
14
-
15
- return <AuiProvider value={aui}>{children}</AuiProvider>;
16
- };
1
+ export { ThreadListItemRuntimeProvider } from "@assistant-ui/core/react";
package/src/index.ts CHANGED
@@ -1,3 +1,5 @@
1
+ import "@assistant-ui/core/react"; // store-augmentation side-effect (tools, dataRenderers scopes)
2
+
1
3
  // Re-export core types
2
4
  export type {
3
5
  // Message types
@@ -38,11 +40,31 @@ export type {
38
40
  // Attachment types
39
41
  Attachment,
40
42
  PendingAttachment,
43
+ CreateAttachment,
41
44
  AttachmentRuntime,
45
+ // Adapter types
46
+ AttachmentAdapter,
47
+ ThreadHistoryAdapter,
48
+ FeedbackAdapter,
49
+ SuggestionAdapter,
42
50
  // Other
43
51
  Unsubscribe,
44
52
  } from "@assistant-ui/core";
45
53
 
54
+ // Re-export core remote thread list types
55
+ export type {
56
+ RemoteThreadListAdapter,
57
+ RemoteThreadListOptions,
58
+ } from "@assistant-ui/core";
59
+ export { InMemoryThreadListAdapter } from "@assistant-ui/core";
60
+
61
+ // Attachment adapter implementations
62
+ export {
63
+ SimpleImageAttachmentAdapter,
64
+ SimpleTextAttachmentAdapter,
65
+ CompositeAttachmentAdapter,
66
+ } from "@assistant-ui/core";
67
+
46
68
  // Re-export store scope state types
47
69
  export type {
48
70
  ThreadState,
@@ -53,26 +75,25 @@ export type {
53
75
  ThreadListItemState,
54
76
  } from "@assistant-ui/core/store";
55
77
 
56
- // Store hooks
78
+ // Store hooks and components
57
79
  export {
58
80
  useAui,
59
81
  useAuiState,
60
82
  useAuiEvent,
61
83
  AuiProvider,
84
+ AuiIf,
85
+ type AssistantClient,
86
+ type AssistantState,
87
+ type AssistantEventScope,
88
+ type AssistantEventSelector,
89
+ type AssistantEventName,
90
+ type AssistantEventPayload,
91
+ type AssistantEventCallback,
62
92
  } from "@assistant-ui/store";
63
93
 
64
94
  // Context providers and hooks
65
95
  export { AssistantProvider, useAssistantRuntime } from "./context";
66
96
 
67
- // State hooks
68
- export {
69
- useThread,
70
- useMessage,
71
- useComposer,
72
- useContentPart,
73
- useThreadList,
74
- } from "./hooks";
75
-
76
97
  // Primitive hooks
77
98
  export {
78
99
  useThreadMessages,
@@ -90,6 +111,7 @@ export {
90
111
  useActionBarFeedbackNegative,
91
112
  useEditComposerSend,
92
113
  useEditComposerCancel,
114
+ useComposerAddAttachment,
93
115
  } from "./primitive-hooks";
94
116
 
95
117
  // Runtime
@@ -99,13 +121,6 @@ export {
99
121
  useRemoteThreadListRuntime,
100
122
  } from "./runtimes";
101
123
 
102
- // Re-export core remote thread list types
103
- export type {
104
- RemoteThreadListAdapter,
105
- RemoteThreadListOptions,
106
- } from "@assistant-ui/core";
107
- export { InMemoryThreadListAdapter } from "@assistant-ui/core";
108
-
109
124
  // Primitives
110
125
  export * from "./primitives/thread";
111
126
  export * from "./primitives/composer";
@@ -113,6 +128,26 @@ export * from "./primitives/message";
113
128
  export * from "./primitives/threadList";
114
129
  export * from "./primitives/actionBar";
115
130
  export * from "./primitives/branchPicker";
131
+ export * from "./primitives/attachment";
132
+ export * from "./primitives/threadListItem";
133
+ export * from "./primitives/chainOfThought";
134
+ export * from "./primitives/suggestion";
135
+
136
+ // Re-export shared providers from core/react
137
+ export {
138
+ ThreadListItemByIndexProvider,
139
+ ChainOfThoughtByIndicesProvider,
140
+ MessageByIndexProvider,
141
+ PartByIndexProvider,
142
+ TextMessagePartProvider,
143
+ ChainOfThoughtPartByIndexProvider,
144
+ SuggestionByIndexProvider,
145
+ } from "@assistant-ui/core/react";
146
+
147
+ // Model context, tools & clients
148
+ export * from "./model-context";
149
+ export * from "./client";
150
+ export * from "./types";
116
151
 
117
152
  // Adapters
118
153
  export {
@@ -0,0 +1,44 @@
1
+ // Re-export shared from core/react
2
+ export {
3
+ makeAssistantTool,
4
+ type AssistantTool,
5
+ makeAssistantToolUI,
6
+ type AssistantToolUI,
7
+ makeAssistantDataUI,
8
+ type AssistantDataUI,
9
+ useAssistantTool,
10
+ type AssistantToolProps,
11
+ useAssistantToolUI,
12
+ type AssistantToolUIProps,
13
+ useAssistantDataUI,
14
+ type AssistantDataUIProps,
15
+ useAssistantInstructions,
16
+ useInlineRender,
17
+ type Toolkit,
18
+ type ToolDefinition,
19
+ Tools,
20
+ DataRenderers,
21
+ } from "@assistant-ui/core/react";
22
+
23
+ // Core pass-through (unchanged)
24
+ export type {
25
+ ModelContext,
26
+ ModelContextProvider,
27
+ LanguageModelConfig,
28
+ LanguageModelV1CallSettings,
29
+ } from "@assistant-ui/core";
30
+
31
+ export { mergeModelContexts } from "@assistant-ui/core";
32
+
33
+ export type { Tool } from "assistant-stream";
34
+
35
+ export { tool } from "@assistant-ui/core";
36
+
37
+ export { Suggestions, type SuggestionConfig } from "@assistant-ui/core/store";
38
+
39
+ export { ModelContextRegistry } from "@assistant-ui/core";
40
+ export type {
41
+ ModelContextRegistryToolHandle,
42
+ ModelContextRegistryInstructionHandle,
43
+ ModelContextRegistryProviderHandle,
44
+ } from "@assistant-ui/core";
@@ -17,3 +17,4 @@ export {
17
17
  } from "./useActionBarFeedback";
18
18
  export { useEditComposerSend } from "./useEditComposerSend";
19
19
  export { useEditComposerCancel } from "./useEditComposerCancel";
20
+ export { useComposerAddAttachment } from "./useComposerAddAttachment";
@@ -0,0 +1,16 @@
1
+ import { useCallback } from "react";
2
+ import { useAui } from "@assistant-ui/store";
3
+ import type { CreateAttachment } from "@assistant-ui/core";
4
+
5
+ export const useComposerAddAttachment = () => {
6
+ const aui = useAui();
7
+
8
+ const addAttachment = useCallback(
9
+ (file: File | CreateAttachment) => {
10
+ return aui.composer().addAttachment(file);
11
+ },
12
+ [aui],
13
+ );
14
+
15
+ return { addAttachment };
16
+ };
@@ -1,5 +1,5 @@
1
- import { useThread } from "../hooks/useThread";
1
+ import { useAuiState } from "@assistant-ui/store";
2
2
 
3
3
  export const useThreadIsRunning = (): boolean => {
4
- return useThread((s) => s.isRunning);
4
+ return useAuiState((s) => s.thread.isRunning);
5
5
  };
@@ -0,0 +1,10 @@
1
+ import type { FC } from "react";
2
+ import { Text, type TextProps } from "react-native";
3
+ import { useAuiState } from "@assistant-ui/store";
4
+
5
+ export type AttachmentNameProps = TextProps;
6
+
7
+ export const AttachmentName: FC<AttachmentNameProps> = (props) => {
8
+ const name = useAuiState((s) => s.attachment.name);
9
+ return <Text {...props}>{name}</Text>;
10
+ };
@@ -0,0 +1,25 @@
1
+ import type { ReactNode } from "react";
2
+ import { Pressable, type PressableProps } from "react-native";
3
+ import { useCallback } from "react";
4
+ import { useAui } from "@assistant-ui/store";
5
+
6
+ export type AttachmentRemoveProps = Omit<PressableProps, "onPress"> & {
7
+ children: ReactNode;
8
+ };
9
+
10
+ export const AttachmentRemove = ({
11
+ children,
12
+ ...pressableProps
13
+ }: AttachmentRemoveProps) => {
14
+ const aui = useAui();
15
+
16
+ const handleRemove = useCallback(() => {
17
+ aui.attachment().remove();
18
+ }, [aui]);
19
+
20
+ return (
21
+ <Pressable onPress={handleRemove} {...pressableProps}>
22
+ {children}
23
+ </Pressable>
24
+ );
25
+ };
@@ -0,0 +1,13 @@
1
+ import type { ReactNode } from "react";
2
+ import { View, type ViewProps } from "react-native";
3
+
4
+ export type AttachmentRootProps = ViewProps & {
5
+ children: ReactNode;
6
+ };
7
+
8
+ export const AttachmentRoot = ({
9
+ children,
10
+ ...viewProps
11
+ }: AttachmentRootProps) => {
12
+ return <View {...viewProps}>{children}</View>;
13
+ };
@@ -0,0 +1,13 @@
1
+ import type { FC } from "react";
2
+ import { Text, type TextProps } from "react-native";
3
+ import { useAuiState } from "@assistant-ui/store";
4
+
5
+ export type AttachmentThumbProps = TextProps;
6
+
7
+ export const AttachmentThumb: FC<AttachmentThumbProps> = (props) => {
8
+ const ext = useAuiState((s) => {
9
+ const parts = s.attachment.name.split(".");
10
+ return parts.length > 1 ? parts.pop()! : "";
11
+ });
12
+ return <Text {...props}>.{ext}</Text>;
13
+ };
@@ -0,0 +1,7 @@
1
+ export { AttachmentRoot, type AttachmentRootProps } from "./AttachmentRoot";
2
+ export { AttachmentName, type AttachmentNameProps } from "./AttachmentName";
3
+ export { AttachmentThumb, type AttachmentThumbProps } from "./AttachmentThumb";
4
+ export {
5
+ AttachmentRemove,
6
+ type AttachmentRemoveProps,
7
+ } from "./AttachmentRemove";
@@ -0,0 +1,28 @@
1
+ import { useCallback, type ReactNode } from "react";
2
+ import { Pressable, type PressableProps } from "react-native";
3
+ import { useAuiState, useAui } from "@assistant-ui/store";
4
+
5
+ export type ChainOfThoughtAccordionTriggerProps = Omit<
6
+ PressableProps,
7
+ "onPress"
8
+ > & {
9
+ children: ReactNode;
10
+ };
11
+
12
+ export const ChainOfThoughtAccordionTrigger = ({
13
+ children,
14
+ ...pressableProps
15
+ }: ChainOfThoughtAccordionTriggerProps) => {
16
+ const aui = useAui();
17
+ const collapsed = useAuiState((s) => s.chainOfThought.collapsed);
18
+
19
+ const onPress = useCallback(() => {
20
+ aui.chainOfThought().setCollapsed(!collapsed);
21
+ }, [aui, collapsed]);
22
+
23
+ return (
24
+ <Pressable onPress={onPress} {...pressableProps}>
25
+ {children}
26
+ </Pressable>
27
+ );
28
+ };
@@ -0,0 +1,13 @@
1
+ import type { ReactNode } from "react";
2
+ import { View, type ViewProps } from "react-native";
3
+
4
+ export type ChainOfThoughtRootProps = ViewProps & {
5
+ children: ReactNode;
6
+ };
7
+
8
+ export const ChainOfThoughtRoot = ({
9
+ children,
10
+ ...viewProps
11
+ }: ChainOfThoughtRootProps) => {
12
+ return <View {...viewProps}>{children}</View>;
13
+ };
@@ -0,0 +1,9 @@
1
+ export {
2
+ ChainOfThoughtRoot,
3
+ type ChainOfThoughtRootProps,
4
+ } from "./ChainOfThoughtRoot";
5
+ export {
6
+ ChainOfThoughtAccordionTrigger,
7
+ type ChainOfThoughtAccordionTriggerProps,
8
+ } from "./ChainOfThoughtAccordionTrigger";
9
+ export { ChainOfThoughtPrimitiveParts } from "@assistant-ui/core/react";
@@ -0,0 +1,30 @@
1
+ import type { ReactNode } from "react";
2
+ import { Pressable, type PressableProps } from "react-native";
3
+ import { useComposerAddAttachment } from "../../primitive-hooks/useComposerAddAttachment";
4
+ import { useAuiState } from "@assistant-ui/store";
5
+
6
+ export type ComposerAddAttachmentProps = Omit<PressableProps, "onPress"> & {
7
+ children: ReactNode;
8
+ };
9
+
10
+ /**
11
+ * A button that triggers the attachment adding flow.
12
+ *
13
+ * Note: The actual file picker implementation is platform-specific.
14
+ * This component calls `useComposerAddAttachment()` from your primitive-hooks.
15
+ * You must handle the file selection in your own component using the returned `addAttachment` callback.
16
+ */
17
+ export const ComposerAddAttachment = ({
18
+ children,
19
+ disabled: disabledProp,
20
+ ...pressableProps
21
+ }: ComposerAddAttachmentProps) => {
22
+ const isDisabled = useAuiState((s) => !s.composer.isEditing);
23
+ const { addAttachment: _addAttachment } = useComposerAddAttachment();
24
+
25
+ return (
26
+ <Pressable disabled={disabledProp ?? isDisabled} {...pressableProps}>
27
+ {children}
28
+ </Pressable>
29
+ );
30
+ };
@@ -0,0 +1,25 @@
1
+ import type { ComponentType } from "react";
2
+ import {
3
+ ComposerPrimitiveAttachments,
4
+ ComposerPrimitiveAttachmentByIndex,
5
+ } from "@assistant-ui/core/react";
6
+
7
+ export type AttachmentComponents = {
8
+ Image?: ComponentType | undefined;
9
+ Document?: ComponentType | undefined;
10
+ File?: ComponentType | undefined;
11
+ Attachment?: ComponentType | undefined;
12
+ };
13
+
14
+ export type ComposerAttachmentsProps = {
15
+ components: AttachmentComponents | undefined;
16
+ };
17
+
18
+ export type ComposerAttachmentByIndexProps = {
19
+ index: number;
20
+ components?: AttachmentComponents | undefined;
21
+ };
22
+
23
+ export const ComposerAttachmentByIndex = ComposerPrimitiveAttachmentByIndex;
24
+
25
+ export const ComposerAttachments = ComposerPrimitiveAttachments;
@@ -0,0 +1 @@
1
+ export { ComposerPrimitiveIf as ComposerIf } from "@assistant-ui/core/react";
@@ -1,7 +1,16 @@
1
1
  export { ComposerRoot, type ComposerRootProps } from "./ComposerRoot";
2
+ export {
3
+ ComposerAttachments,
4
+ ComposerAttachmentByIndex,
5
+ } from "./ComposerAttachments";
2
6
  export { ComposerInput, type ComposerInputProps } from "./ComposerInput";
3
7
  export { ComposerSend, type ComposerSendProps } from "./ComposerSend";
4
8
  export { ComposerCancel, type ComposerCancelProps } from "./ComposerCancel";
9
+ export {
10
+ ComposerAddAttachment,
11
+ type ComposerAddAttachmentProps,
12
+ } from "./ComposerAddAttachment";
13
+ export { ComposerIf } from "./ComposerIf";
5
14
  export {
6
15
  EditComposerInput,
7
16
  type EditComposerInputProps,
@@ -0,0 +1,18 @@
1
+ import {
2
+ MessagePrimitiveAttachments,
3
+ MessagePrimitiveAttachmentByIndex,
4
+ } from "@assistant-ui/core/react";
5
+ import type { AttachmentComponents } from "../composer/ComposerAttachments";
6
+
7
+ export type MessageAttachmentsProps = {
8
+ components: AttachmentComponents | undefined;
9
+ };
10
+
11
+ export type MessageAttachmentByIndexProps = {
12
+ index: number;
13
+ components?: AttachmentComponents | undefined;
14
+ };
15
+
16
+ export const MessageAttachmentByIndex = MessagePrimitiveAttachmentByIndex;
17
+
18
+ export const MessageAttachments = MessagePrimitiveAttachments;
@@ -1,10 +1,16 @@
1
- import { type ReactElement, Fragment } from "react";
1
+ import { type ReactElement, Fragment, useMemo } from "react";
2
2
  import { Text } from "react-native";
3
3
  import type {
4
4
  ThreadUserMessagePart,
5
5
  ThreadAssistantMessagePart,
6
+ ToolCallMessagePart,
7
+ DataMessagePart,
6
8
  } from "@assistant-ui/core";
7
- import { useMessage } from "../../hooks/useMessage";
9
+ import { useAui, useAuiState } from "@assistant-ui/store";
10
+ import type {
11
+ ToolCallMessagePartProps,
12
+ DataMessagePartProps,
13
+ } from "../../types";
8
14
 
9
15
  type MessageContentPart = ThreadUserMessagePart | ThreadAssistantMessagePart;
10
16
 
@@ -47,6 +53,63 @@ const DefaultTextRenderer = ({
47
53
  return <Text>{part.text}</Text>;
48
54
  };
49
55
 
56
+ const ToolUIDisplay = ({
57
+ Fallback,
58
+ part,
59
+ index,
60
+ }: {
61
+ Fallback:
62
+ | ((props: { part: ToolCallMessagePart; index: number }) => ReactElement)
63
+ | undefined;
64
+ part: ToolCallMessagePart;
65
+ index: number;
66
+ }) => {
67
+ const aui = useAui();
68
+ const Render = useAuiState((s) => {
69
+ const renders = s.tools.tools[part.toolName];
70
+ if (Array.isArray(renders)) return renders[0];
71
+ return renders;
72
+ });
73
+
74
+ const partMethods = useMemo(
75
+ () => aui.message().part({ index }),
76
+ [aui, index],
77
+ );
78
+
79
+ if (Render) {
80
+ return (
81
+ <Render
82
+ {...(part as ToolCallMessagePartProps)}
83
+ addResult={partMethods.addToolResult}
84
+ resume={partMethods.resumeToolCall}
85
+ />
86
+ );
87
+ }
88
+ if (Fallback) return <Fallback part={part} index={index} />;
89
+ return null;
90
+ };
91
+
92
+ const DataUIDisplay = ({
93
+ Fallback,
94
+ part,
95
+ index,
96
+ }: {
97
+ Fallback:
98
+ | ((props: { part: DataMessagePart; index: number }) => ReactElement)
99
+ | undefined;
100
+ part: DataMessagePart;
101
+ index: number;
102
+ }) => {
103
+ const Render = useAuiState((s) => {
104
+ const renders = s.dataRenderers.renderers[part.name];
105
+ if (Array.isArray(renders)) return renders[0];
106
+ return renders;
107
+ });
108
+ if (Render) return <Render {...(part as DataMessagePartProps)} />;
109
+ if (Fallback) return <Fallback part={part} index={index} />;
110
+ return null;
111
+ };
112
+
50
113
  export const MessageContent = ({
51
114
  renderText,
52
115
  renderToolCall,
@@ -56,7 +119,7 @@ export const MessageContent = ({
56
119
  renderFile,
57
120
  renderData,
58
121
  }: MessageContentProps) => {
59
- const content = useMessage((s) => s.content);
122
+ const content = useAuiState((s) => s.message.content);
60
123
 
61
124
  return (
62
125
  <>
@@ -74,9 +137,14 @@ export const MessageContent = ({
74
137
  </Fragment>
75
138
  );
76
139
  case "tool-call":
77
- if (!renderToolCall) return null;
78
140
  return (
79
- <Fragment key={key}>{renderToolCall({ part, index })}</Fragment>
141
+ <Fragment key={key}>
142
+ <ToolUIDisplay
143
+ Fallback={renderToolCall}
144
+ part={part}
145
+ index={index}
146
+ />
147
+ </Fragment>
80
148
  );
81
149
  case "image":
82
150
  if (!renderImage) return null;
@@ -97,8 +165,15 @@ export const MessageContent = ({
97
165
  if (!renderFile) return null;
98
166
  return <Fragment key={key}>{renderFile({ part, index })}</Fragment>;
99
167
  case "data":
100
- if (!renderData) return null;
101
- return <Fragment key={key}>{renderData({ part, index })}</Fragment>;
168
+ return (
169
+ <Fragment key={key}>
170
+ <DataUIDisplay
171
+ Fallback={renderData}
172
+ part={part}
173
+ index={index}
174
+ />
175
+ </Fragment>
176
+ );
102
177
  default:
103
178
  return null;
104
179
  }
@@ -1,5 +1,5 @@
1
1
  import type { ReactNode } from "react";
2
- import { useMessage } from "../../hooks/useMessage";
2
+ import { useAuiState } from "@assistant-ui/store";
3
3
 
4
4
  export type MessageIfProps = {
5
5
  children: ReactNode;
@@ -16,7 +16,7 @@ export const MessageIf = ({
16
16
  running,
17
17
  last,
18
18
  }: MessageIfProps) => {
19
- const message = useMessage();
19
+ const message = useAuiState((s) => s.message);
20
20
 
21
21
  if (user !== undefined) {
22
22
  if (user !== (message.role === "user")) return null;