@assistant-ui/react 0.1.1 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (53) hide show
  1. package/package.json +6 -15
  2. package/dist/AssistantRuntime-BM_jVV3g.d.mts +0 -23
  3. package/dist/AssistantRuntime-CBMSAJqH.d.mts +0 -23
  4. package/dist/AssistantRuntime-C_BvM7ZT.d.ts +0 -23
  5. package/dist/AssistantRuntime-DELpXWfG.d.ts +0 -23
  6. package/dist/ModelConfigTypes-B9UY4zxv.d.mts +0 -55
  7. package/dist/ModelConfigTypes-B9UY4zxv.d.ts +0 -55
  8. package/dist/ModelConfigTypes-BF5HxVrH.d.mts +0 -55
  9. package/dist/ModelConfigTypes-BF5HxVrH.d.ts +0 -55
  10. package/dist/ModelConfigTypes-Cf3yjaDu.d.mts +0 -55
  11. package/dist/ModelConfigTypes-Cf3yjaDu.d.ts +0 -55
  12. package/dist/ModelConfigTypes-CzmXY3sn.d.mts +0 -55
  13. package/dist/ModelConfigTypes-CzmXY3sn.d.ts +0 -55
  14. package/dist/Thread-BMASJT4a.d.ts +0 -15
  15. package/dist/Thread-UEVsUmvl.d.mts +0 -15
  16. package/dist/chunk-3XZUKECF.mjs +0 -207
  17. package/dist/chunk-3XZUKECF.mjs.map +0 -1
  18. package/dist/chunk-4DQ2CIAD.mjs +0 -69
  19. package/dist/chunk-4DQ2CIAD.mjs.map +0 -1
  20. package/dist/chunk-5YONSDN4.mjs +0 -200
  21. package/dist/chunk-5YONSDN4.mjs.map +0 -1
  22. package/dist/chunk-CY4TTHR7.mjs +0 -76
  23. package/dist/chunk-CY4TTHR7.mjs.map +0 -1
  24. package/dist/chunk-DKAWDNW5.mjs +0 -22
  25. package/dist/chunk-DKAWDNW5.mjs.map +0 -1
  26. package/dist/chunk-GQKH2ADD.mjs +0 -165
  27. package/dist/chunk-GQKH2ADD.mjs.map +0 -1
  28. package/dist/chunk-J5LGTIGS.mjs +0 -10
  29. package/dist/chunk-J5LGTIGS.mjs.map +0 -1
  30. package/dist/chunk-NSBOH42A.mjs +0 -200
  31. package/dist/chunk-NSBOH42A.mjs.map +0 -1
  32. package/dist/chunk-X4HBDEFP.mjs +0 -30
  33. package/dist/chunk-X4HBDEFP.mjs.map +0 -1
  34. package/dist/experimental.d.mts +0 -86
  35. package/dist/experimental.d.ts +0 -86
  36. package/dist/experimental.js +0 -123
  37. package/dist/experimental.js.map +0 -1
  38. package/dist/experimental.mjs +0 -34
  39. package/dist/experimental.mjs.map +0 -1
  40. package/dist/index.d.mts +0 -289
  41. package/dist/index.d.ts +0 -289
  42. package/dist/index.js +0 -1500
  43. package/dist/index.js.map +0 -1
  44. package/dist/index.mjs +0 -1245
  45. package/dist/index.mjs.map +0 -1
  46. package/dist/internal-dlLjX30u.d.mts +0 -75
  47. package/dist/internal-dlLjX30u.d.ts +0 -75
  48. package/dist/internal.d.mts +0 -25
  49. package/dist/internal.d.ts +0 -25
  50. package/dist/internal.js +0 -225
  51. package/dist/internal.js.map +0 -1
  52. package/dist/internal.mjs +0 -10
  53. package/dist/internal.mjs.map +0 -1
package/dist/index.d.ts DELETED
@@ -1,289 +0,0 @@
1
- import * as react from 'react';
2
- import { FC, ReactNode, PropsWithChildren, ComponentType } from 'react';
3
- import { TextareaAutosizeProps } from 'react-textarea-autosize';
4
- import { T as TextContentPart, I as ImageContentPart, U as UIContentPart, a as ToolCallContentPart, M as ModelConfigProvider, b as ThreadMessage, c as ModelConfig, A as AssistantContentPart, d as AppendMessage } from './ModelConfigTypes-CzmXY3sn.js';
5
- export { h as AppendContentPart, e as AssistantMessage, g as UserContentPart, f as UserMessage } from './ModelConfigTypes-CzmXY3sn.js';
6
- import { T as ThreadState, U as Unsubscribe } from './Thread-BMASJT4a.js';
7
- import 'zod';
8
-
9
- declare const useCopyMessage: ({ copiedDuration }: {
10
- copiedDuration?: number | undefined;
11
- }) => (() => void) | null;
12
-
13
- declare const useReloadMessage: () => (() => void) | null;
14
-
15
- declare const useBeginMessageEdit: () => (() => void) | null;
16
-
17
- declare const useGoToNextBranch: () => (() => void) | null;
18
-
19
- declare const useGoToPreviousBranch: () => (() => void) | null;
20
-
21
- declare const ThreadRoot: react.ForwardRefExoticComponent<Pick<Omit<react.DetailedHTMLProps<react.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
22
- ref?: ((instance: HTMLDivElement | null) => void) | react.RefObject<HTMLDivElement> | null | undefined;
23
- } & {
24
- asChild?: boolean;
25
- }, "key" | keyof react.HTMLAttributes<HTMLDivElement> | "asChild"> & react.RefAttributes<HTMLDivElement>>;
26
-
27
- type ThreadEmptyProps = {
28
- children: ReactNode;
29
- };
30
- declare const ThreadEmpty: FC<ThreadEmptyProps>;
31
-
32
- type RequireAtLeastOne<T, Keys extends keyof T = keyof T> = Pick<T, Exclude<keyof T, Keys>> & {
33
- [K in Keys]-?: Required<Pick<T, K>> & Partial<Pick<T, Exclude<Keys, K>>>;
34
- }[Keys];
35
-
36
- type ThreadIfFilters = {
37
- empty: boolean | undefined;
38
- running: boolean | undefined;
39
- };
40
- type ThreadIfProps = PropsWithChildren<RequireAtLeastOne<ThreadIfFilters>>;
41
- declare const ThreadIf: FC<ThreadIfProps>;
42
-
43
- declare const ThreadViewport: react.ForwardRefExoticComponent<Pick<Omit<react.DetailedHTMLProps<react.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
44
- ref?: ((instance: HTMLDivElement | null) => void) | react.RefObject<HTMLDivElement> | null | undefined;
45
- } & {
46
- asChild?: boolean;
47
- }, "key" | keyof react.HTMLAttributes<HTMLDivElement> | "asChild"> & {
48
- autoScroll?: boolean;
49
- } & react.RefAttributes<HTMLDivElement>>;
50
-
51
- type ThreadMessagesProps = {
52
- components: {
53
- Message: ComponentType;
54
- UserMessage?: ComponentType;
55
- EditComposer?: ComponentType;
56
- AssistantMessage?: ComponentType;
57
- } | {
58
- Message?: ComponentType;
59
- UserMessage: ComponentType;
60
- EditComposer?: ComponentType;
61
- AssistantMessage: ComponentType;
62
- };
63
- };
64
- declare const ThreadMessages: FC<ThreadMessagesProps>;
65
-
66
- declare const ThreadScrollToBottom: react.ForwardRefExoticComponent<Pick<Omit<react.DetailedHTMLProps<react.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref"> & {
67
- ref?: ((instance: HTMLButtonElement | null) => void) | react.RefObject<HTMLButtonElement> | null | undefined;
68
- } & {
69
- asChild?: boolean;
70
- }, "key" | "asChild" | keyof react.ButtonHTMLAttributes<HTMLButtonElement>> & react.RefAttributes<HTMLButtonElement>>;
71
-
72
- declare const ThreadSuggestion: react.ForwardRefExoticComponent<Pick<Omit<react.DetailedHTMLProps<react.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref"> & {
73
- ref?: ((instance: HTMLButtonElement | null) => void) | react.RefObject<HTMLButtonElement> | null | undefined;
74
- } & {
75
- asChild?: boolean;
76
- }, "key" | "asChild" | keyof react.ButtonHTMLAttributes<HTMLButtonElement>> & {
77
- prompt: string;
78
- method: "replace";
79
- autoSend?: boolean;
80
- } & react.RefAttributes<HTMLButtonElement>>;
81
-
82
- declare namespace index$5 {
83
- export { ThreadEmpty as Empty, ThreadIf as If, ThreadMessages as Messages, ThreadRoot as Root, ThreadScrollToBottom as ScrollToBottom, ThreadSuggestion as Suggestion, ThreadViewport as Viewport };
84
- }
85
-
86
- declare const ComposerRoot: react.ForwardRefExoticComponent<Pick<Omit<react.DetailedHTMLProps<react.FormHTMLAttributes<HTMLFormElement>, HTMLFormElement>, "ref"> & {
87
- ref?: ((instance: HTMLFormElement | null) => void) | react.RefObject<HTMLFormElement> | null | undefined;
88
- } & {
89
- asChild?: boolean;
90
- }, "key" | "asChild" | keyof react.FormHTMLAttributes<HTMLFormElement>> & react.RefAttributes<HTMLFormElement>>;
91
-
92
- declare const ComposerInput: react.ForwardRefExoticComponent<TextareaAutosizeProps & {
93
- asChild?: boolean;
94
- } & react.RefAttributes<HTMLTextAreaElement>>;
95
-
96
- declare const ComposerSend: react.ForwardRefExoticComponent<Pick<Omit<react.DetailedHTMLProps<react.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref"> & {
97
- ref?: ((instance: HTMLButtonElement | null) => void) | react.RefObject<HTMLButtonElement> | null | undefined;
98
- } & {
99
- asChild?: boolean;
100
- }, "key" | "asChild" | keyof react.ButtonHTMLAttributes<HTMLButtonElement>> & react.RefAttributes<HTMLButtonElement>>;
101
-
102
- declare const ComposerCancel: react.ForwardRefExoticComponent<Pick<Omit<react.DetailedHTMLProps<react.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref"> & {
103
- ref?: ((instance: HTMLButtonElement | null) => void) | react.RefObject<HTMLButtonElement> | null | undefined;
104
- } & {
105
- asChild?: boolean;
106
- }, "key" | "asChild" | keyof react.ButtonHTMLAttributes<HTMLButtonElement>> & react.RefAttributes<HTMLButtonElement>>;
107
-
108
- type ComposerIfFilters = {
109
- editing: boolean | undefined;
110
- };
111
- type ComposerIfProps = PropsWithChildren<RequireAtLeastOne<ComposerIfFilters>>;
112
- declare const ComposerIf: FC<ComposerIfProps>;
113
-
114
- declare namespace index$4 {
115
- export { ComposerCancel as Cancel, ComposerIf as If, ComposerInput as Input, ComposerRoot as Root, ComposerSend as Send };
116
- }
117
-
118
- declare const MessageRoot: react.ForwardRefExoticComponent<Pick<Omit<react.DetailedHTMLProps<react.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
119
- ref?: ((instance: HTMLDivElement | null) => void) | react.RefObject<HTMLDivElement> | null | undefined;
120
- } & {
121
- asChild?: boolean;
122
- }, "key" | keyof react.HTMLAttributes<HTMLDivElement> | "asChild"> & react.RefAttributes<HTMLDivElement>>;
123
-
124
- type MessageIfFilters = {
125
- user: boolean | undefined;
126
- assistant: boolean | undefined;
127
- hasBranches: boolean | undefined;
128
- copied: boolean | undefined;
129
- lastOrHover: boolean | undefined;
130
- };
131
- type MessageIfProps = RequireAtLeastOne<MessageIfFilters> & {
132
- children: ReactNode;
133
- };
134
- declare const MessageIf: FC<MessageIfProps>;
135
-
136
- type MessageContentProps = {
137
- components?: {
138
- Text?: ComponentType<{
139
- part: TextContentPart;
140
- }>;
141
- Image?: ComponentType<{
142
- part: ImageContentPart;
143
- }>;
144
- UI?: ComponentType<{
145
- part: UIContentPart;
146
- }>;
147
- tools?: {
148
- by_name?: Record<string, ComponentType<{
149
- part: ToolCallContentPart;
150
- }>>;
151
- Fallback?: ComponentType<{
152
- part: ToolCallContentPart;
153
- }>;
154
- };
155
- };
156
- };
157
- declare const MessageContent: FC<MessageContentProps>;
158
-
159
- declare const MessageInProgress: react.ForwardRefExoticComponent<Pick<Omit<react.DetailedHTMLProps<react.HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "ref"> & {
160
- ref?: ((instance: HTMLSpanElement | null) => void) | react.RefObject<HTMLSpanElement> | null | undefined;
161
- } & {
162
- asChild?: boolean;
163
- }, "key" | "asChild" | keyof react.HTMLAttributes<HTMLSpanElement>> & react.RefAttributes<HTMLSpanElement>>;
164
-
165
- declare namespace index$3 {
166
- export { MessageContent as Content, MessageIf as If, MessageInProgress as InProgress, MessageRoot as Root };
167
- }
168
-
169
- declare const BranchPickerNext: react.ForwardRefExoticComponent<Pick<Omit<react.DetailedHTMLProps<react.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref"> & {
170
- ref?: ((instance: HTMLButtonElement | null) => void) | react.RefObject<HTMLButtonElement> | null | undefined;
171
- } & {
172
- asChild?: boolean;
173
- }, "key" | "asChild" | keyof react.ButtonHTMLAttributes<HTMLButtonElement>> & react.RefAttributes<HTMLButtonElement>>;
174
-
175
- declare const BranchPickerPrevious: react.ForwardRefExoticComponent<Pick<Omit<react.DetailedHTMLProps<react.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref"> & {
176
- ref?: ((instance: HTMLButtonElement | null) => void) | react.RefObject<HTMLButtonElement> | null | undefined;
177
- } & {
178
- asChild?: boolean;
179
- }, "key" | "asChild" | keyof react.ButtonHTMLAttributes<HTMLButtonElement>> & react.RefAttributes<HTMLButtonElement>>;
180
-
181
- declare const BranchPickerCount: FC;
182
-
183
- declare const BranchPickerNumber: FC;
184
-
185
- declare const BranchPickerRoot: react.ForwardRefExoticComponent<Pick<Omit<react.DetailedHTMLProps<react.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
186
- ref?: ((instance: HTMLDivElement | null) => void) | react.RefObject<HTMLDivElement> | null | undefined;
187
- } & {
188
- asChild?: boolean;
189
- }, "key" | keyof react.HTMLAttributes<HTMLDivElement> | "asChild"> & {
190
- hideWhenSingleBranch?: boolean;
191
- } & react.RefAttributes<HTMLDivElement>>;
192
-
193
- declare namespace index$2 {
194
- export { BranchPickerCount as Count, BranchPickerNext as Next, BranchPickerNumber as Number, BranchPickerPrevious as Previous, BranchPickerRoot as Root };
195
- }
196
-
197
- declare const ActionBarRoot: react.ForwardRefExoticComponent<Pick<Omit<react.DetailedHTMLProps<react.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
198
- ref?: ((instance: HTMLDivElement | null) => void) | react.RefObject<HTMLDivElement> | null | undefined;
199
- } & {
200
- asChild?: boolean;
201
- }, "key" | keyof react.HTMLAttributes<HTMLDivElement> | "asChild"> & {
202
- hideWhenRunning?: boolean;
203
- autohide?: "always" | "not-last" | "never";
204
- autohideFloat?: "always" | "single-branch" | "never";
205
- } & react.RefAttributes<HTMLDivElement>>;
206
-
207
- type ActionBarCopyProps = {
208
- copiedDuration?: number;
209
- };
210
- declare const ActionBarCopy: react.ForwardRefExoticComponent<Pick<Omit<react.DetailedHTMLProps<react.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref"> & {
211
- ref?: ((instance: HTMLButtonElement | null) => void) | react.RefObject<HTMLButtonElement> | null | undefined;
212
- } & {
213
- asChild?: boolean;
214
- }, "key" | "asChild" | keyof react.ButtonHTMLAttributes<HTMLButtonElement>> & ActionBarCopyProps & react.RefAttributes<HTMLButtonElement>>;
215
-
216
- declare const ActionBarReload: react.ForwardRefExoticComponent<Pick<Omit<react.DetailedHTMLProps<react.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref"> & {
217
- ref?: ((instance: HTMLButtonElement | null) => void) | react.RefObject<HTMLButtonElement> | null | undefined;
218
- } & {
219
- asChild?: boolean;
220
- }, "key" | "asChild" | keyof react.ButtonHTMLAttributes<HTMLButtonElement>> & react.RefAttributes<HTMLButtonElement>>;
221
-
222
- declare const ActionBarEdit: react.ForwardRefExoticComponent<Pick<Omit<react.DetailedHTMLProps<react.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref"> & {
223
- ref?: ((instance: HTMLButtonElement | null) => void) | react.RefObject<HTMLButtonElement> | null | undefined;
224
- } & {
225
- asChild?: boolean;
226
- }, "key" | "asChild" | keyof react.ButtonHTMLAttributes<HTMLButtonElement>> & react.RefAttributes<HTMLButtonElement>>;
227
-
228
- declare namespace index$1 {
229
- export { ActionBarCopy as Copy, ActionBarEdit as Edit, ActionBarReload as Reload, ActionBarRoot as Root };
230
- }
231
-
232
- declare const ContentPartInProgressIndicator: FC;
233
-
234
- declare namespace index {
235
- export { ContentPartInProgressIndicator as InProgressIndicator };
236
- }
237
-
238
- type ThreadRuntime = Readonly<ThreadState & {
239
- subscribe: (callback: () => void) => Unsubscribe;
240
- }>;
241
-
242
- type AssistantRuntime = ThreadRuntime & {
243
- registerModelConfigProvider: (provider: ModelConfigProvider) => Unsubscribe;
244
- };
245
-
246
- type ReactThreadRuntime = ThreadRuntime & {
247
- unstable_synchronizer?: ComponentType;
248
- };
249
-
250
- type ChatModelRunResult = {
251
- content: AssistantContentPart[];
252
- };
253
- type ChatModelRunOptions = {
254
- messages: ThreadMessage[];
255
- abortSignal: AbortSignal;
256
- config: ModelConfig;
257
- onUpdate: (result: ChatModelRunResult) => void;
258
- };
259
- type ChatModelAdapter = {
260
- run: (options: ChatModelRunOptions) => Promise<ChatModelRunResult>;
261
- };
262
-
263
- declare class LocalRuntime implements AssistantRuntime {
264
- adapter: ChatModelAdapter;
265
- private _subscriptions;
266
- private _configProviders;
267
- private abortController;
268
- private repository;
269
- get messages(): ThreadMessage[];
270
- get isRunning(): boolean;
271
- constructor(adapter: ChatModelAdapter);
272
- getBranches(messageId: string): string[];
273
- switchToBranch(branchId: string): void;
274
- append(message: AppendMessage): Promise<void>;
275
- startRun(parentId: string | null): Promise<void>;
276
- cancelRun(): void;
277
- private notifySubscribers;
278
- subscribe(callback: () => void): Unsubscribe;
279
- registerModelConfigProvider(provider: ModelConfigProvider): () => boolean;
280
- }
281
-
282
- declare const useLocalRuntime: (adapter: ChatModelAdapter) => LocalRuntime;
283
-
284
- type AssistantRuntimeProviderProps = {
285
- runtime: AssistantRuntime;
286
- };
287
- declare const AssistantRuntimeProvider: react.NamedExoticComponent<PropsWithChildren<AssistantRuntimeProviderProps>>;
288
-
289
- export { index$1 as ActionBarPrimitive, AppendMessage, AssistantContentPart, type AssistantRuntime, AssistantRuntimeProvider, index$2 as BranchPickerPrimitive, type ChatModelAdapter, type ChatModelRunOptions, index$4 as ComposerPrimitive, index as ContentPartPrimitive, index$3 as MessagePrimitive, type ReactThreadRuntime, TextContentPart, ThreadMessage, index$5 as ThreadPrimitive, type ThreadRuntime, Unsubscribe, useBeginMessageEdit, useCopyMessage, useGoToNextBranch, useGoToPreviousBranch, useLocalRuntime, useReloadMessage };