@assistant-ui/react 0.1.2 → 0.1.4

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