@assistant-ui/react 0.5.66 → 0.5.68
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/{edge-D7ch2oPK.d.mts → edge-BhYWMe-K.d.mts} +26 -6
- package/dist/{edge-D7ch2oPK.d.ts → edge-BhYWMe-K.d.ts} +26 -6
- package/dist/index.d.mts +485 -663
- package/dist/index.d.ts +485 -663
- package/dist/index.js +1208 -962
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1297 -1051
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -4
package/dist/index.d.mts
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
-
import {
|
2
|
-
export {
|
1
|
+
import { A as Attachment, P as PendingAttachment, T as ThreadMessage, C as CoreMessage, a as AppendMessage, M as ModelConfig, b as ModelConfigProvider, c as ThreadAssistantContentPart, d as MessageStatus, e as ThreadRoundtrip, f as PendingAttachmentStatus, g as CompleteAttachment, h as CompleteAttachmentStatus, i as Tool, j as TextContentPart, I as ImageContentPart, k as ToolCallContentPart, l as CoreToolCallContentPart, U as UIContentPart, m as CreateEdgeRuntimeAPIOptions, n as ThreadUserContentPart, o as ContentPartStatus, p as ToolCallContentPartStatus } from './edge-BhYWMe-K.mjs';
|
2
|
+
export { q as AttachmentStatus, v as CoreAssistantContentPart, y as CoreAssistantMessage, w as CoreSystemMessage, u as CoreUserContentPart, x as CoreUserMessage, E as EdgeRuntimeRequestOptions, s as ThreadAssistantMessage, r as ThreadSystemMessage, t as ThreadUserMessage } from './edge-BhYWMe-K.mjs';
|
3
3
|
import * as react from 'react';
|
4
4
|
import { ComponentType, PropsWithChildren, FC, ComponentPropsWithoutRef, ElementType, ReactNode } from 'react';
|
5
5
|
import { StoreApi, UseBoundStore } from 'zustand';
|
@@ -14,31 +14,27 @@ import * as class_variance_authority_types from 'class-variance-authority/types'
|
|
14
14
|
import 'json-schema';
|
15
15
|
import 'zod';
|
16
16
|
|
17
|
-
type
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
}
|
35
|
-
type
|
36
|
-
|
37
|
-
|
38
|
-
status: ToolCallContentPartStatus;
|
39
|
-
addResult: (result: any) => void;
|
40
|
-
};
|
41
|
-
type ToolCallContentPartComponent<TArgs extends Record<string, unknown> = any, TResult = any> = ComponentType<ToolCallContentPartProps<TArgs, TResult>>;
|
17
|
+
type ComposerRuntimeCore = Readonly<{
|
18
|
+
attachmentAccept: string;
|
19
|
+
attachments: readonly Attachment[];
|
20
|
+
addAttachment: (file: File) => Promise<void>;
|
21
|
+
removeAttachment: (attachmentId: string) => Promise<void>;
|
22
|
+
isEditing: boolean;
|
23
|
+
canCancel: boolean;
|
24
|
+
isEmpty: boolean;
|
25
|
+
text: string;
|
26
|
+
setText: (value: string) => void;
|
27
|
+
/**
|
28
|
+
* @deprecated This method will be removed in 0.6.0. Submit feedback if you need this functionality.
|
29
|
+
*/
|
30
|
+
reset: () => void;
|
31
|
+
send: () => void;
|
32
|
+
cancel: () => void;
|
33
|
+
subscribe: (callback: () => void) => Unsubscribe;
|
34
|
+
}>;
|
35
|
+
type ThreadComposerRuntimeCore = ComposerRuntimeCore & Readonly<{
|
36
|
+
attachments: readonly PendingAttachment[];
|
37
|
+
}>;
|
42
38
|
|
43
39
|
type Unsubscribe = () => void;
|
44
40
|
|
@@ -91,21 +87,6 @@ declare class MessageRepository {
|
|
91
87
|
import({ headId, messages }: ExportedMessageRepository): void;
|
92
88
|
}
|
93
89
|
|
94
|
-
type ThreadComposerRuntimeCore = Readonly<{
|
95
|
-
attachmentAccept: string;
|
96
|
-
attachments: ThreadComposerAttachment[];
|
97
|
-
addAttachment: (file: File) => Promise<void>;
|
98
|
-
removeAttachment: (attachmentId: string) => Promise<void>;
|
99
|
-
canCancel: boolean;
|
100
|
-
isEmpty: boolean;
|
101
|
-
text: string;
|
102
|
-
setText: (value: string) => void;
|
103
|
-
reset: () => void;
|
104
|
-
send: () => void;
|
105
|
-
cancel: () => void;
|
106
|
-
subscribe: (callback: () => void) => Unsubscribe;
|
107
|
-
}>;
|
108
|
-
|
109
90
|
type RuntimeCapabilities = Readonly<{
|
110
91
|
switchToBranch: boolean;
|
111
92
|
edit: boolean;
|
@@ -137,6 +118,8 @@ type ThreadRuntimeCore = Readonly<{
|
|
137
118
|
submitFeedback: (feedback: SubmitFeedbackOptions) => void;
|
138
119
|
getModelConfig: () => ModelConfig;
|
139
120
|
composer: ThreadComposerRuntimeCore;
|
121
|
+
getEditComposer: (messageId: string) => ComposerRuntimeCore | undefined;
|
122
|
+
beginEdit: (messageId: string) => void;
|
140
123
|
capabilities: Readonly<RuntimeCapabilities>;
|
141
124
|
threadId: string;
|
142
125
|
isDisabled: boolean;
|
@@ -188,11 +171,7 @@ type ChatModelAdapter = {
|
|
188
171
|
run: (options: ChatModelRunOptions) => Promise<ChatModelRunResult> | AsyncGenerator<ChatModelRunResult, void>;
|
189
172
|
};
|
190
173
|
|
191
|
-
|
192
|
-
unstable_synchronizer?: ComponentType;
|
193
|
-
};
|
194
|
-
|
195
|
-
declare abstract class BaseAssistantRuntimeCore<TThreadRuntime extends ReactThreadRuntimeCore> implements AssistantRuntimeCore {
|
174
|
+
declare abstract class BaseAssistantRuntimeCore<TThreadRuntime extends ThreadRuntimeCore> implements AssistantRuntimeCore {
|
196
175
|
private _thread;
|
197
176
|
constructor(_thread: TThreadRuntime);
|
198
177
|
get thread(): TThreadRuntime;
|
@@ -209,42 +188,83 @@ type AttachmentAdapter = {
|
|
209
188
|
accept: string;
|
210
189
|
add(state: {
|
211
190
|
file: File;
|
212
|
-
}): Promise<
|
213
|
-
|
214
|
-
|
191
|
+
}): Promise<Omit<PendingAttachment, "status"> & {
|
192
|
+
status?: PendingAttachmentStatus;
|
193
|
+
}>;
|
194
|
+
remove(attachment: Attachment): Promise<void>;
|
195
|
+
send(attachment: PendingAttachment): Promise<Omit<CompleteAttachment, "status"> & {
|
196
|
+
status?: CompleteAttachmentStatus;
|
197
|
+
}>;
|
215
198
|
};
|
216
199
|
|
217
|
-
declare class
|
218
|
-
|
219
|
-
|
200
|
+
declare class SimpleImageAttachmentAdapter implements AttachmentAdapter {
|
201
|
+
accept: string;
|
202
|
+
add(state: {
|
203
|
+
file: File;
|
204
|
+
}): Promise<PendingAttachment>;
|
205
|
+
send(attachment: PendingAttachment): Promise<CompleteAttachment>;
|
206
|
+
remove(): Promise<void>;
|
207
|
+
}
|
208
|
+
|
209
|
+
declare class SimpleTextAttachmentAdapter implements AttachmentAdapter {
|
210
|
+
accept: string;
|
211
|
+
add(state: {
|
212
|
+
file: File;
|
213
|
+
}): Promise<PendingAttachment>;
|
214
|
+
send(attachment: PendingAttachment): Promise<CompleteAttachment>;
|
215
|
+
remove(): Promise<void>;
|
216
|
+
}
|
217
|
+
|
218
|
+
declare class CompositeAttachmentAdapter implements AttachmentAdapter {
|
219
|
+
private _adapters;
|
220
|
+
accept: string;
|
221
|
+
constructor(adapters: AttachmentAdapter[]);
|
222
|
+
add(state: {
|
223
|
+
file: File;
|
224
|
+
}): Promise<Omit<PendingAttachment, "status"> & {
|
225
|
+
status?: PendingAttachmentStatus;
|
226
|
+
}>;
|
227
|
+
send(attachment: PendingAttachment): Promise<Omit<CompleteAttachment, "status"> & {
|
228
|
+
status?: CompleteAttachmentStatus;
|
229
|
+
}>;
|
230
|
+
remove(attachment: Attachment): Promise<void>;
|
231
|
+
}
|
232
|
+
|
233
|
+
declare abstract class BaseComposerRuntimeCore implements ComposerRuntimeCore {
|
234
|
+
readonly isEditing = true;
|
220
235
|
attachmentAccept: string;
|
221
|
-
get isEmpty(): boolean;
|
222
|
-
private _canCancel;
|
223
|
-
get canCancel(): boolean;
|
224
|
-
constructor(runtime: {
|
225
|
-
capabilities: Readonly<RuntimeCapabilities>;
|
226
|
-
messages: ThreadRuntimeCore["messages"];
|
227
|
-
append: (message: AppendMessage) => void;
|
228
|
-
cancelRun: () => void;
|
229
|
-
subscribe: (callback: () => void) => Unsubscribe;
|
230
|
-
});
|
231
|
-
connect(): Unsubscribe;
|
232
|
-
setAttachmentAdapter(adapter: AttachmentAdapter | undefined): boolean;
|
233
236
|
private _attachments;
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
+
protected set attachments(value: readonly Attachment[]);
|
238
|
+
get attachments(): readonly Attachment[];
|
239
|
+
abstract get canCancel(): boolean;
|
240
|
+
get isEmpty(): boolean;
|
237
241
|
private _text;
|
238
242
|
get text(): string;
|
239
243
|
setText(value: string): void;
|
240
244
|
reset(): void;
|
241
245
|
send(): Promise<void>;
|
242
|
-
|
246
|
+
abstract handleSend(message: Omit<AppendMessage, "parentId">): void;
|
247
|
+
abstract cancel(): void;
|
248
|
+
protected _attachmentAdapter?: AttachmentAdapter | undefined;
|
249
|
+
setAttachmentAdapter(adapter: AttachmentAdapter | undefined): void;
|
250
|
+
addAttachment(file: File): Promise<void>;
|
251
|
+
removeAttachment(attachmentId: string): Promise<void>;
|
243
252
|
private _subscriptions;
|
244
|
-
|
253
|
+
protected notifySubscribers(): void;
|
245
254
|
subscribe(callback: () => void): Unsubscribe;
|
246
255
|
}
|
247
256
|
|
257
|
+
declare class DefaultThreadComposerRuntimeCore extends BaseComposerRuntimeCore implements ThreadComposerRuntimeCore {
|
258
|
+
private runtime;
|
259
|
+
private _canCancel;
|
260
|
+
get canCancel(): boolean;
|
261
|
+
get attachments(): readonly PendingAttachment[];
|
262
|
+
constructor(runtime: Omit<ThreadRuntimeCore, "composer">);
|
263
|
+
connect(): Unsubscribe;
|
264
|
+
handleSend(message: Omit<AppendMessage, "parentId">): Promise<void>;
|
265
|
+
cancel(): Promise<void>;
|
266
|
+
}
|
267
|
+
|
248
268
|
type FeedbackAdapterFeedback = {
|
249
269
|
message: ThreadMessage;
|
250
270
|
type: "positive" | "negative";
|
@@ -263,6 +283,21 @@ type LocalRuntimeOptions = {
|
|
263
283
|
} | undefined;
|
264
284
|
};
|
265
285
|
|
286
|
+
declare class DefaultEditComposerRuntimeCore extends BaseComposerRuntimeCore {
|
287
|
+
private runtime;
|
288
|
+
private endEditCallback;
|
289
|
+
get canCancel(): boolean;
|
290
|
+
private _nonTextParts;
|
291
|
+
private _previousText;
|
292
|
+
private _parentId;
|
293
|
+
constructor(runtime: Omit<ThreadRuntimeCore, "composer">, endEditCallback: () => void, { parentId, message }: {
|
294
|
+
parentId: string | null;
|
295
|
+
message: ThreadMessage;
|
296
|
+
});
|
297
|
+
handleSend(message: Omit<AppendMessage, "parentId">): Promise<void>;
|
298
|
+
cancel(): Promise<void>;
|
299
|
+
}
|
300
|
+
|
266
301
|
declare class LocalThreadRuntimeCore implements ThreadRuntimeCore {
|
267
302
|
private configProvider;
|
268
303
|
adapter: ChatModelAdapter;
|
@@ -282,12 +317,15 @@ declare class LocalThreadRuntimeCore implements ThreadRuntimeCore {
|
|
282
317
|
readonly threadId: string;
|
283
318
|
readonly isDisabled = false;
|
284
319
|
get messages(): ThreadMessage[];
|
285
|
-
readonly composer:
|
320
|
+
readonly composer: DefaultThreadComposerRuntimeCore;
|
286
321
|
constructor(configProvider: ModelConfigProvider, adapter: ChatModelAdapter, { initialMessages, ...options }: LocalRuntimeOptions);
|
287
322
|
getModelConfig(): ModelConfig;
|
288
323
|
private _options;
|
289
324
|
get options(): LocalRuntimeOptions;
|
290
325
|
set options({ initialMessages, ...options }: LocalRuntimeOptions);
|
326
|
+
private _editComposers;
|
327
|
+
getEditComposer(messageId: string): DefaultEditComposerRuntimeCore | undefined;
|
328
|
+
beginEdit(messageId: string): void;
|
291
329
|
getBranches(messageId: string): string[];
|
292
330
|
switchToBranch(branchId: string): void;
|
293
331
|
append(message: AppendMessage): Promise<void>;
|
@@ -315,6 +353,23 @@ declare class LocalRuntimeCore extends BaseAssistantRuntimeCore<LocalThreadRunti
|
|
315
353
|
}): void;
|
316
354
|
}
|
317
355
|
|
356
|
+
declare class AssistantRuntime<TThreadRuntime extends ThreadRuntime = ThreadRuntime> implements AssistantRuntimeCore {
|
357
|
+
private _core;
|
358
|
+
constructor(_core: AssistantRuntimeCore, CustomThreadRuntime: new (binding: ThreadRuntimeCoreBinding) => TThreadRuntime);
|
359
|
+
readonly thread: TThreadRuntime;
|
360
|
+
switchToNewThread(): void;
|
361
|
+
switchToThread(threadId: string): void;
|
362
|
+
/**
|
363
|
+
* @deprecated Use `switchToNewThread` instead. This will be removed in 0.6.0.
|
364
|
+
*/
|
365
|
+
switchToThread(threadId: string | null): void;
|
366
|
+
registerModelConfigProvider(provider: ModelConfigProvider): Unsubscribe;
|
367
|
+
/**
|
368
|
+
* @deprecated Thread is now static and never gets updated. This will be removed in 0.6.0.
|
369
|
+
*/
|
370
|
+
subscribe(callback: () => void): Unsubscribe;
|
371
|
+
}
|
372
|
+
|
318
373
|
declare class LocalRuntime extends AssistantRuntime {
|
319
374
|
private core;
|
320
375
|
constructor(core: LocalRuntimeCore);
|
@@ -333,7 +388,7 @@ declare const fromCoreMessages: (message: readonly CoreMessage[]) => ThreadMessa
|
|
333
388
|
declare const fromCoreMessage: (message: CoreMessage, { id, status, attachments, }?: {
|
334
389
|
id?: string | undefined;
|
335
390
|
status?: MessageStatus | undefined;
|
336
|
-
attachments?: readonly
|
391
|
+
attachments?: readonly CompleteAttachment[] | undefined;
|
337
392
|
}) => ThreadMessage;
|
338
393
|
|
339
394
|
declare const toCoreMessages: (message: ThreadMessage[]) => CoreMessage[];
|
@@ -381,42 +436,13 @@ declare class EdgeChatAdapter implements ChatModelAdapter {
|
|
381
436
|
type EdgeRuntimeOptions = EdgeChatAdapterOptions & LocalRuntimeOptions;
|
382
437
|
declare const useEdgeRuntime: ({ initialMessages, maxToolRoundtrips, adapters, ...options }: EdgeRuntimeOptions) => LocalRuntime;
|
383
438
|
|
384
|
-
declare class SimpleImageAttachmentAdapter implements AttachmentAdapter {
|
385
|
-
accept: string;
|
386
|
-
add(state: {
|
387
|
-
file: File;
|
388
|
-
}): Promise<ThreadComposerAttachment>;
|
389
|
-
send(attachment: ThreadComposerAttachment): Promise<MessageAttachment>;
|
390
|
-
remove(): Promise<void>;
|
391
|
-
}
|
392
|
-
|
393
|
-
declare class SimpleTextAttachmentAdapter implements AttachmentAdapter {
|
394
|
-
accept: string;
|
395
|
-
add(state: {
|
396
|
-
file: File;
|
397
|
-
}): Promise<ThreadComposerAttachment>;
|
398
|
-
send(attachment: ThreadComposerAttachment): Promise<MessageAttachment>;
|
399
|
-
remove(): Promise<void>;
|
400
|
-
}
|
401
|
-
|
402
|
-
declare class CompositeAttachmentAdapter implements AttachmentAdapter {
|
403
|
-
private _adapters;
|
404
|
-
accept: string;
|
405
|
-
constructor(adapters: AttachmentAdapter[]);
|
406
|
-
add(state: {
|
407
|
-
file: File;
|
408
|
-
}): Promise<ThreadComposerAttachment>;
|
409
|
-
send(attachment: ThreadComposerAttachment): Promise<MessageAttachment>;
|
410
|
-
remove(attachment: ThreadComposerAttachment): Promise<void>;
|
411
|
-
}
|
412
|
-
|
413
439
|
type ThreadMessageLike = {
|
414
440
|
role: "assistant" | "user" | "system";
|
415
441
|
content: string | (TextContentPart | ImageContentPart | ToolCallContentPart<any, any> | CoreToolCallContentPart<any, any> | UIContentPart)[];
|
416
442
|
id?: string | undefined;
|
417
443
|
createdAt?: Date | undefined;
|
418
444
|
status?: MessageStatus | undefined;
|
419
|
-
attachments?:
|
445
|
+
attachments?: CompleteAttachment[] | undefined;
|
420
446
|
};
|
421
447
|
|
422
448
|
type ExternalStoreMessageConverter<T> = (message: T, idx: number) => ThreadMessageLike;
|
@@ -479,65 +505,90 @@ type SubscribableWithState<TState> = Subscribable & {
|
|
479
505
|
getState: () => TState;
|
480
506
|
};
|
481
507
|
|
482
|
-
type
|
483
|
-
|
484
|
-
|
485
|
-
|
486
|
-
|
487
|
-
|
488
|
-
|
489
|
-
|
490
|
-
|
491
|
-
constructor(contentBinding: ContentPartSnapshotBinding, messageApi: MessageSnapshotBinding, threadApi: ThreadRuntimeCoreBinding);
|
492
|
-
getState(): ContentPartSnapshot | undefined;
|
493
|
-
addToolResult(result: any): void;
|
494
|
-
}
|
495
|
-
|
496
|
-
type MessageState = ThreadMessage & {
|
508
|
+
type ThreadComposerRuntimeCoreBinding = SubscribableWithState<ThreadComposerRuntimeCore | undefined>;
|
509
|
+
type ComposerRuntimeCoreBinding = SubscribableWithState<ComposerRuntimeCore | undefined>;
|
510
|
+
type LegacyEditComposerState = Readonly<{
|
511
|
+
type: "edit";
|
512
|
+
/** @deprecated Use `text` instead. This will be removed in 0.6.0. */
|
513
|
+
value: string;
|
514
|
+
/** @deprecated Use `useComposerRuntime().setText()` instead. This will be removed in 0.6.0. */
|
515
|
+
setValue: (value: string) => void;
|
516
|
+
text: string;
|
497
517
|
/**
|
498
|
-
* @deprecated
|
518
|
+
* @deprecated Use `useComposerRuntime().setText()` instead. This will be removed in 0.6.0.
|
499
519
|
*/
|
500
|
-
|
501
|
-
|
502
|
-
|
520
|
+
setText: (value: string) => void;
|
521
|
+
canCancel: boolean;
|
522
|
+
isEditing: boolean;
|
523
|
+
isEmpty: boolean;
|
503
524
|
/**
|
504
|
-
* @deprecated Use
|
525
|
+
* @deprecated Use useComposerRuntime().beginEdit() instead. This will be removed in 0.6.0.
|
505
526
|
*/
|
506
|
-
|
507
|
-
|
508
|
-
|
509
|
-
|
510
|
-
|
511
|
-
|
512
|
-
|
513
|
-
|
514
|
-
|
515
|
-
|
516
|
-
|
517
|
-
|
518
|
-
|
519
|
-
|
520
|
-
|
521
|
-
|
522
|
-
|
523
|
-
|
524
|
-
|
525
|
-
|
526
|
-
|
527
|
-
|
528
|
-
|
529
|
-
|
530
|
-
|
531
|
-
|
527
|
+
edit: () => void;
|
528
|
+
/**
|
529
|
+
* @deprecated Use `useComposerRuntime().send()` instead. This will be removed in 0.6.0.
|
530
|
+
*/
|
531
|
+
send: () => void;
|
532
|
+
/**
|
533
|
+
* @deprecated Use `useComposerRuntime().cancel()` instead. This will be removed in 0.6.0.
|
534
|
+
*/
|
535
|
+
cancel: () => void;
|
536
|
+
}>;
|
537
|
+
type LegacyThreadComposerState = Readonly<{
|
538
|
+
type: "thread";
|
539
|
+
/** @deprecated Use `text` instead. This will be removed in 0.6.0. */
|
540
|
+
value: string;
|
541
|
+
/** @deprecated Use `useComposerRuntime().setText` instead. This will be removed in 0.6.0. */
|
542
|
+
setValue: (value: string) => void;
|
543
|
+
attachmentAccept: string;
|
544
|
+
attachments: readonly Attachment[];
|
545
|
+
/** @deprecated Use `useComposerRuntime().addAttachment` instead. This will be removed in 0.6.0. */
|
546
|
+
addAttachment: (file: File) => void;
|
547
|
+
/** @deprecated Use `useComposerRuntime().removeAttachment` instead. This will be removed in 0.6.0. */
|
548
|
+
removeAttachment: (attachmentId: string) => void;
|
549
|
+
text: string;
|
550
|
+
/** @deprecated Use `useComposerRuntime().setText` instead. This will be removed in 0.6.0. */
|
551
|
+
setText: (value: string) => void;
|
552
|
+
/** @deprecated Use `useComposerRuntime().reset` instead. This will be removed in 0.6.0. */
|
553
|
+
reset: () => void;
|
554
|
+
canCancel: boolean;
|
555
|
+
isEditing: boolean;
|
532
556
|
isEmpty: boolean;
|
557
|
+
/**
|
558
|
+
* @deprecated Use `useComposerRuntime().send` instead. This will be removed in 0.6.0.
|
559
|
+
**/
|
560
|
+
send: () => void;
|
561
|
+
/** @deprecated Use `useComposerRuntime().cancel` instead. This will be removed in 0.6.0. */
|
562
|
+
cancel: () => void;
|
563
|
+
/** @deprecated This feature is being removed in 0.6.0. Submit feedback if you need it. */
|
564
|
+
focus: () => void;
|
565
|
+
/** @deprecated This feature is being removed in 0.6.0. Submit feedback if you need it. */
|
566
|
+
onFocus: (listener: () => void) => Unsubscribe;
|
567
|
+
}>;
|
568
|
+
type BaseComposerState = {
|
533
569
|
text: string;
|
534
|
-
attachments: readonly ThreadComposerAttachment[];
|
535
570
|
attachmentAccept: string;
|
571
|
+
attachments: readonly Attachment[];
|
536
572
|
canCancel: boolean;
|
537
|
-
|
538
|
-
|
539
|
-
|
540
|
-
|
573
|
+
isEditing: boolean;
|
574
|
+
isEmpty: boolean;
|
575
|
+
};
|
576
|
+
type ThreadComposerState = LegacyThreadComposerState & BaseComposerState & {
|
577
|
+
type: "thread";
|
578
|
+
attachments: readonly PendingAttachment[];
|
579
|
+
};
|
580
|
+
type EditComposerState = LegacyEditComposerState & BaseComposerState & {
|
581
|
+
type: "edit";
|
582
|
+
};
|
583
|
+
type ComposerState = ThreadComposerState | EditComposerState;
|
584
|
+
declare abstract class ComposerRuntime implements ComposerRuntimeCore {
|
585
|
+
protected _core: ComposerRuntimeCoreBinding;
|
586
|
+
abstract get type(): "edit" | "thread";
|
587
|
+
constructor(_core: ComposerRuntimeCoreBinding);
|
588
|
+
/**
|
589
|
+
* @deprecated Use `getState().isEditing` instead. This will be removed in 0.6.0.
|
590
|
+
*/
|
591
|
+
get isEditing(): boolean;
|
541
592
|
/**
|
542
593
|
* @deprecated Use `getState().isEmpty` instead. This will be removed in 0.6.0.
|
543
594
|
*/
|
@@ -557,15 +608,14 @@ declare class ThreadComposerRuntime implements ThreadComposerRuntimeCore {
|
|
557
608
|
/**
|
558
609
|
* @deprecated Use `getState().attachments` instead. This will be removed in 0.6.0.
|
559
610
|
*/
|
560
|
-
get attachments():
|
561
|
-
|
562
|
-
|
563
|
-
|
564
|
-
|
565
|
-
|
566
|
-
canCancel: boolean;
|
567
|
-
}>;
|
611
|
+
get attachments(): readonly Attachment[] | (readonly Attachment[] & readonly PendingAttachment[]);
|
612
|
+
/**
|
613
|
+
* @deprecated Use `getState().text` instead. This will be removed in 0.6.0.
|
614
|
+
*/
|
615
|
+
get value(): string;
|
616
|
+
abstract getState(): ComposerState;
|
568
617
|
setText(text: string): void;
|
618
|
+
setValue(text: string): void;
|
569
619
|
addAttachment(file: File): Promise<void>;
|
570
620
|
removeAttachment(attachmentId: string): Promise<void>;
|
571
621
|
/**
|
@@ -575,6 +625,120 @@ declare class ThreadComposerRuntime implements ThreadComposerRuntimeCore {
|
|
575
625
|
send(): void;
|
576
626
|
cancel(): void;
|
577
627
|
subscribe(callback: () => void): Unsubscribe;
|
628
|
+
abstract unstable_getAttachmentByIndex(idx: number): AttachmentRuntime;
|
629
|
+
}
|
630
|
+
declare class ThreadComposerRuntime extends ComposerRuntime implements ThreadComposerState {
|
631
|
+
get type(): "thread";
|
632
|
+
private _getState;
|
633
|
+
constructor(core: ThreadComposerRuntimeCoreBinding);
|
634
|
+
get attachments(): readonly Attachment[] & readonly PendingAttachment[];
|
635
|
+
getState(): ThreadComposerState;
|
636
|
+
private _focusListeners;
|
637
|
+
focus(): void;
|
638
|
+
onFocus(callback: () => void): () => boolean;
|
639
|
+
unstable_getAttachmentByIndex(idx: number): ThreadComposerAttachmentRuntime;
|
640
|
+
}
|
641
|
+
declare class EditComposerRuntime extends ComposerRuntime implements EditComposerState {
|
642
|
+
private _beginEdit;
|
643
|
+
get type(): "edit";
|
644
|
+
private _getState;
|
645
|
+
constructor(core: ComposerRuntimeCoreBinding, _beginEdit: () => void);
|
646
|
+
getState(): EditComposerState;
|
647
|
+
beginEdit(): void;
|
648
|
+
/**
|
649
|
+
* @deprecated Use `beginEdit()` instead. This will be removed in 0.6.0.
|
650
|
+
*/
|
651
|
+
edit(): void;
|
652
|
+
unstable_getAttachmentByIndex(idx: number): EditComposerAttachmentRuntime;
|
653
|
+
}
|
654
|
+
|
655
|
+
type MessageAttachmentState = CompleteAttachment & {
|
656
|
+
source: "message";
|
657
|
+
/**
|
658
|
+
* @deprecated You can directly access content part fields in the state. Replace `.attachment.type` with `.type` etc. This will be removed in 0.6.0.
|
659
|
+
*/
|
660
|
+
attachment: CompleteAttachment;
|
661
|
+
};
|
662
|
+
type ThreadComposerAttachmentState = PendingAttachment & {
|
663
|
+
source: "thread-composer";
|
664
|
+
/**
|
665
|
+
* @deprecated You can directly access content part fields in the state. Replace `.attachment.type` with `.type` etc. This will be removed in 0.6.0.
|
666
|
+
*/
|
667
|
+
attachment: PendingAttachment;
|
668
|
+
};
|
669
|
+
type EditComposerAttachmentState = Attachment & {
|
670
|
+
source: "edit-composer";
|
671
|
+
/**
|
672
|
+
* @deprecated You can directly access content part fields in the state. Replace `.attachment.type` with `.type` etc. This will be removed in 0.6.0.
|
673
|
+
*/
|
674
|
+
attachment: Attachment;
|
675
|
+
};
|
676
|
+
type AttachmentState = ThreadComposerAttachmentState | EditComposerAttachmentState | MessageAttachmentState;
|
677
|
+
type AttachmentSnapshotBinding<Source extends AttachmentRuntimeSource> = SubscribableWithState<AttachmentState & {
|
678
|
+
source: Source;
|
679
|
+
}>;
|
680
|
+
type AttachmentRuntimeSource = AttachmentState["source"];
|
681
|
+
declare abstract class AttachmentRuntime<Source extends AttachmentRuntimeSource = AttachmentRuntimeSource> {
|
682
|
+
private _core;
|
683
|
+
abstract get source(): Source;
|
684
|
+
constructor(_core: AttachmentSnapshotBinding<Source>);
|
685
|
+
getState(): AttachmentState & {
|
686
|
+
source: Source;
|
687
|
+
};
|
688
|
+
abstract remove(): Promise<void>;
|
689
|
+
subscribe(callback: () => void): Unsubscribe;
|
690
|
+
}
|
691
|
+
declare abstract class ComposerAttachmentRuntime<Source extends "thread-composer" | "edit-composer"> extends AttachmentRuntime<Source> {
|
692
|
+
private _composerApi;
|
693
|
+
constructor(core: AttachmentSnapshotBinding<Source>, _composerApi: ComposerRuntimeCoreBinding);
|
694
|
+
remove(): Promise<void>;
|
695
|
+
}
|
696
|
+
declare class ThreadComposerAttachmentRuntime extends ComposerAttachmentRuntime<"thread-composer"> {
|
697
|
+
get source(): "thread-composer";
|
698
|
+
}
|
699
|
+
declare class EditComposerAttachmentRuntime extends ComposerAttachmentRuntime<"edit-composer"> {
|
700
|
+
get source(): "edit-composer";
|
701
|
+
}
|
702
|
+
declare class MessageAttachmentRuntime extends AttachmentRuntime<"message"> {
|
703
|
+
get source(): "message";
|
704
|
+
constructor(core: AttachmentSnapshotBinding<"message">);
|
705
|
+
remove(): never;
|
706
|
+
}
|
707
|
+
|
708
|
+
type MessageState = ThreadMessage & {
|
709
|
+
/**
|
710
|
+
* @deprecated You can directly access message fields in the state. Replace `.message.content` with `.content` etc. This will be removed in 0.6.0.
|
711
|
+
*/
|
712
|
+
message: ThreadMessage;
|
713
|
+
parentId: string | null;
|
714
|
+
isLast: boolean;
|
715
|
+
/**
|
716
|
+
* @deprecated Use `branchNumber` and `branchCount` instead. This will be removed in 0.6.0.
|
717
|
+
*/
|
718
|
+
branches: readonly string[];
|
719
|
+
branchNumber: number;
|
720
|
+
branchCount: number;
|
721
|
+
};
|
722
|
+
type MessageStateBinding = SubscribableWithState<MessageState>;
|
723
|
+
declare class MessageRuntime {
|
724
|
+
private _core;
|
725
|
+
private _threadBinding;
|
726
|
+
constructor(_core: MessageStateBinding, _threadBinding: ThreadRuntimeCoreBinding);
|
727
|
+
composer: EditComposerRuntime;
|
728
|
+
getState(): MessageState;
|
729
|
+
unstable_edit(message: Omit<AppendMessage, "parentId">): void;
|
730
|
+
reload(): void;
|
731
|
+
speak(): SpeechSynthesisAdapter.Utterance;
|
732
|
+
submitFeedback({ type }: {
|
733
|
+
type: "positive" | "negative";
|
734
|
+
}): void;
|
735
|
+
switchToBranch({ position, branchId, }: {
|
736
|
+
position?: "previous" | "next" | undefined;
|
737
|
+
branchId?: string | undefined;
|
738
|
+
}): void;
|
739
|
+
subscribe(callback: () => void): Unsubscribe;
|
740
|
+
unstable_getContentPartByIndex(idx: number): ContentPartRuntime;
|
741
|
+
unstable_getAttachmentByIndex(idx: number): MessageAttachmentRuntime;
|
578
742
|
}
|
579
743
|
|
580
744
|
type CreateAppendMessage = string | {
|
@@ -589,9 +753,9 @@ type ThreadState = Readonly<{
|
|
589
753
|
isDisabled: boolean;
|
590
754
|
isRunning: boolean;
|
591
755
|
capabilities: RuntimeCapabilities;
|
756
|
+
messages: readonly ThreadMessage[];
|
592
757
|
}>;
|
593
758
|
declare class ThreadRuntime implements ThreadRuntimeCore {
|
594
|
-
private _threadBinding;
|
595
759
|
/**
|
596
760
|
* @deprecated Use `getState().threadId` instead. This will be removed in 0.6.0.
|
597
761
|
*/
|
@@ -617,6 +781,9 @@ declare class ThreadRuntime implements ThreadRuntimeCore {
|
|
617
781
|
attachments: boolean;
|
618
782
|
feedback: boolean;
|
619
783
|
}>;
|
784
|
+
/**
|
785
|
+
* @deprecated Use `getState().messages` instead. This will be removed in 0.6.0.
|
786
|
+
*/
|
620
787
|
get messages(): readonly ThreadMessage[];
|
621
788
|
unstable_getCore(): Readonly<{
|
622
789
|
getBranches: (messageId: string) => readonly string[];
|
@@ -629,6 +796,8 @@ declare class ThreadRuntime implements ThreadRuntimeCore {
|
|
629
796
|
submitFeedback: (feedback: SubmitFeedbackOptions) => void;
|
630
797
|
getModelConfig: () => ModelConfig;
|
631
798
|
composer: ThreadComposerRuntimeCore;
|
799
|
+
getEditComposer: (messageId: string) => ComposerRuntimeCore | undefined;
|
800
|
+
beginEdit: (messageId: string) => void;
|
632
801
|
capabilities: Readonly<RuntimeCapabilities>;
|
633
802
|
threadId: string;
|
634
803
|
isDisabled: boolean;
|
@@ -637,13 +806,15 @@ declare class ThreadRuntime implements ThreadRuntimeCore {
|
|
637
806
|
import(repository: ExportedMessageRepository): void;
|
638
807
|
export(): ExportedMessageRepository;
|
639
808
|
}>;
|
640
|
-
|
809
|
+
private _threadBinding;
|
810
|
+
constructor(threadBinding: ThreadRuntimeCoreBinding);
|
641
811
|
readonly composer: ThreadComposerRuntime;
|
642
812
|
getState(): Readonly<{
|
643
813
|
threadId: string;
|
644
814
|
isDisabled: boolean;
|
645
815
|
isRunning: boolean;
|
646
816
|
capabilities: RuntimeCapabilities;
|
817
|
+
messages: readonly ThreadMessage[];
|
647
818
|
}>;
|
648
819
|
append(message: CreateAppendMessage): void;
|
649
820
|
subscribe(callback: () => void): Unsubscribe;
|
@@ -655,97 +826,99 @@ declare class ThreadRuntime implements ThreadRuntimeCore {
|
|
655
826
|
switchToBranch(branchId: string): void;
|
656
827
|
speak(messageId: string): SpeechSynthesisAdapter.Utterance;
|
657
828
|
submitFeedback(options: SubmitFeedbackOptions): void;
|
829
|
+
/**
|
830
|
+
* @deprecated Use `getMesssageById(id).unstable_getMessageByIndex(idx).composer` instead. This will be removed in 0.6.0.
|
831
|
+
*/
|
832
|
+
getEditComposer(messageId: string): Readonly<{
|
833
|
+
attachmentAccept: string;
|
834
|
+
attachments: readonly Attachment[];
|
835
|
+
addAttachment: (file: File) => Promise<void>;
|
836
|
+
removeAttachment: (attachmentId: string) => Promise<void>;
|
837
|
+
isEditing: boolean;
|
838
|
+
canCancel: boolean;
|
839
|
+
isEmpty: boolean;
|
840
|
+
text: string;
|
841
|
+
setText: (value: string) => void;
|
842
|
+
reset: () => void;
|
843
|
+
send: () => void;
|
844
|
+
cancel: () => void;
|
845
|
+
subscribe: (callback: () => void) => Unsubscribe;
|
846
|
+
}> | undefined;
|
847
|
+
/**
|
848
|
+
* @deprecated Use `getMesssageById(id).unstable_getMessageByIndex(idx).composer.beginEdit()` instead. This will be removed in 0.6.0.
|
849
|
+
*/
|
850
|
+
beginEdit(messageId: string): void;
|
658
851
|
export(): ExportedMessageRepository;
|
659
852
|
import(data: ExportedMessageRepository): void;
|
660
853
|
unstable_getMesssageByIndex(idx: number): MessageRuntime;
|
661
854
|
}
|
662
855
|
|
663
|
-
|
664
|
-
private _core;
|
665
|
-
constructor(_core: AssistantRuntimeCore, CustomThreadRuntime: new (binding: ThreadRuntimeCoreBinding) => TThreadRuntime);
|
666
|
-
readonly thread: TThreadRuntime;
|
667
|
-
switchToNewThread(): void;
|
668
|
-
switchToThread(threadId: string): void;
|
856
|
+
type ContentPartState = (ThreadUserContentPart | ThreadAssistantContentPart) & {
|
669
857
|
/**
|
670
|
-
* @deprecated
|
671
|
-
*/
|
672
|
-
switchToThread(threadId: string | null): void;
|
673
|
-
registerModelConfigProvider(provider: ModelConfigProvider): Unsubscribe;
|
674
|
-
/**
|
675
|
-
* @deprecated Thread is now static and never gets updated. This will be removed in 0.6.0.
|
858
|
+
* @deprecated You can directly access content part fields in the state. Replace `.part.type` with `.type` etc. This will be removed in 0.6.0.
|
676
859
|
*/
|
860
|
+
part: ThreadUserContentPart | ThreadAssistantContentPart;
|
861
|
+
status: ContentPartStatus | ToolCallContentPartStatus;
|
862
|
+
};
|
863
|
+
type ContentPartSnapshotBinding = SubscribableWithState<ContentPartState>;
|
864
|
+
declare class ContentPartRuntime {
|
865
|
+
private contentBinding;
|
866
|
+
private messageApi;
|
867
|
+
private threadApi;
|
868
|
+
constructor(contentBinding: ContentPartSnapshotBinding, messageApi: MessageStateBinding, threadApi: ThreadRuntimeCoreBinding);
|
869
|
+
getState(): ContentPartState;
|
870
|
+
addToolResult(result: any): void;
|
677
871
|
subscribe(callback: () => void): Unsubscribe;
|
678
872
|
}
|
679
873
|
|
680
|
-
type
|
681
|
-
runtime: AssistantRuntime;
|
682
|
-
};
|
683
|
-
declare const AssistantRuntimeProvider: react.NamedExoticComponent<PropsWithChildren<AssistantRuntimeProviderProps>>;
|
684
|
-
|
685
|
-
type TextContentPartProviderProps = {
|
686
|
-
text: string;
|
687
|
-
isRunning?: boolean | undefined;
|
688
|
-
};
|
689
|
-
declare const TextContentPartProvider: FC<PropsWithChildren<TextContentPartProviderProps>>;
|
690
|
-
|
691
|
-
type AssistantToolUIsState = Readonly<{
|
692
|
-
getToolUI: (toolName: string) => ToolCallContentPartComponent | null;
|
693
|
-
setToolUI: (toolName: string, render: ToolCallContentPartComponent) => () => void;
|
694
|
-
}>;
|
695
|
-
|
696
|
-
type ThreadComposerState = Readonly<{
|
697
|
-
type: "thread";
|
698
|
-
/** @deprecated Use `text` instead. This will be removed in 0.6.0. */
|
699
|
-
value: string;
|
700
|
-
/** @deprecated Use `useComposerRuntime().setText` instead. This will be removed in 0.6.0. */
|
701
|
-
setValue: (value: string) => void;
|
702
|
-
attachmentAccept: string;
|
703
|
-
attachments: readonly ThreadComposerAttachment[];
|
704
|
-
/** @deprecated Use `useComposerRuntime().addAttachment` instead. This will be removed in 0.6.0. */
|
705
|
-
addAttachment: (file: File) => void;
|
706
|
-
/** @deprecated Use `useComposerRuntime().removeAttachment` instead. This will be removed in 0.6.0. */
|
707
|
-
removeAttachment: (attachmentId: string) => void;
|
708
|
-
text: string;
|
709
|
-
/** @deprecated Use `useComposerRuntime().setText` instead. This will be removed in 0.6.0. */
|
710
|
-
setText: (value: string) => void;
|
711
|
-
/** @deprecated Use `useComposerRuntime().reset` instead. This will be removed in 0.6.0. */
|
712
|
-
reset: () => void;
|
713
|
-
canCancel: boolean;
|
714
|
-
isEditing: true;
|
715
|
-
isEmpty: boolean;
|
716
|
-
/** @deprecated Use `useComposerRuntime().send` instead. This will be removed in 0.6.0. */
|
717
|
-
send: () => void;
|
718
|
-
/** @deprecated Use `useComposerRuntime().cancel` instead. This will be removed in 0.6.0. */
|
719
|
-
cancel: () => void;
|
720
|
-
focus: () => void;
|
721
|
-
onFocus: (listener: () => void) => Unsubscribe;
|
722
|
-
}>;
|
723
|
-
|
724
|
-
type TextContentPartState = Readonly<{
|
874
|
+
type EmptyContentPartProps = {
|
725
875
|
status: ContentPartStatus;
|
876
|
+
};
|
877
|
+
type EmptyContentPartComponent = ComponentType<EmptyContentPartProps>;
|
878
|
+
type TextContentPartProps = ContentPartState & TextContentPart & {
|
879
|
+
/**
|
880
|
+
* @deprecated You can directly access content part fields in the state. Replace `.part.type` with `.type` etc. This will be removed in 0.6.0.
|
881
|
+
*/
|
726
882
|
part: TextContentPart;
|
727
|
-
}
|
728
|
-
type
|
729
|
-
|
730
|
-
|
731
|
-
|
883
|
+
};
|
884
|
+
type TextContentPartComponent = ComponentType<TextContentPartProps>;
|
885
|
+
type ImageContentPartProps = ContentPartState & ImageContentPart & {
|
886
|
+
/**
|
887
|
+
* @deprecated You can directly access content part fields in the state. Replace `.part.type` with `.type` etc. This will be removed in 0.6.0.
|
888
|
+
*/
|
889
|
+
part: ImageContentPart;
|
890
|
+
};
|
891
|
+
type ImageContentPartComponent = ComponentType<ImageContentPartProps>;
|
892
|
+
type UIContentPartProps = ContentPartState & UIContentPart & {
|
893
|
+
/**
|
894
|
+
* @deprecated You can directly access content part fields in the state. Replace `.part.type` with `.type` etc. This will be removed in 0.6.0.
|
895
|
+
*/
|
896
|
+
part: UIContentPart;
|
897
|
+
};
|
898
|
+
type UIContentPartComponent = ComponentType<UIContentPartProps>;
|
899
|
+
type ToolCallContentPartProps<TArgs extends Record<string, unknown> = any, TResult = unknown> = ContentPartState & ToolCallContentPart<TArgs, TResult> & {
|
900
|
+
/**
|
901
|
+
* @deprecated You can directly access content part fields in the state. Replace `.part.type` with `.type` etc. This will be removed in 0.6.0.
|
902
|
+
*/
|
903
|
+
part: ToolCallContentPart<TArgs, TResult>;
|
904
|
+
addResult: (result: any) => void;
|
905
|
+
};
|
906
|
+
type ToolCallContentPartComponent<TArgs extends Record<string, unknown> = any, TResult = any> = ComponentType<ToolCallContentPartProps<TArgs, TResult>>;
|
732
907
|
|
733
|
-
type
|
908
|
+
type AssistantRuntimeProviderProps = {
|
909
|
+
runtime: AssistantRuntime;
|
910
|
+
};
|
911
|
+
declare const AssistantRuntimeProvider: react.NamedExoticComponent<PropsWithChildren<AssistantRuntimeProviderProps>>;
|
734
912
|
|
735
|
-
type
|
736
|
-
type: "edit";
|
737
|
-
/** @deprecated Use `text` instead. This will be removed in 0.6.0. */
|
738
|
-
value: string;
|
739
|
-
/** @deprecated Use `setText` instead. This will be removed in 0.6.0. */
|
740
|
-
setValue: (value: string) => void;
|
913
|
+
type TextContentPartProviderProps = {
|
741
914
|
text: string;
|
742
|
-
|
743
|
-
|
744
|
-
|
745
|
-
|
746
|
-
|
747
|
-
|
748
|
-
|
915
|
+
isRunning?: boolean | undefined;
|
916
|
+
};
|
917
|
+
declare const TextContentPartProvider: FC<PropsWithChildren<TextContentPartProviderProps>>;
|
918
|
+
|
919
|
+
type AssistantToolUIsState = Readonly<{
|
920
|
+
getToolUI: (toolName: string) => ToolCallContentPartComponent | null;
|
921
|
+
setToolUI: (toolName: string, render: ToolCallContentPartComponent) => () => void;
|
749
922
|
}>;
|
750
923
|
|
751
924
|
type MessageUtilsState = Readonly<{
|
@@ -766,6 +939,8 @@ type ThreadViewportState = Readonly<{
|
|
766
939
|
onScrollToBottom: (callback: () => void) => Unsubscribe;
|
767
940
|
}>;
|
768
941
|
|
942
|
+
type ReadonlyStore<T> = Omit<StoreApi<T>, "setState" | "destroy">;
|
943
|
+
|
769
944
|
type AssistantContextValue = {
|
770
945
|
useToolUIs: UseBoundStore<ReadonlyStore<AssistantToolUIsState>>;
|
771
946
|
useAssistantRuntime: UseBoundStore<ReadonlyStore<AssistantRuntime>>;
|
@@ -928,6 +1103,7 @@ declare const useThread: {
|
|
928
1103
|
attachments: boolean;
|
929
1104
|
feedback: boolean;
|
930
1105
|
}>;
|
1106
|
+
messages: readonly ThreadMessage[];
|
931
1107
|
}>;
|
932
1108
|
<TSelected>(selector: (state: Readonly<{
|
933
1109
|
threadId: string;
|
@@ -943,6 +1119,7 @@ declare const useThread: {
|
|
943
1119
|
attachments: boolean;
|
944
1120
|
feedback: boolean;
|
945
1121
|
}>;
|
1122
|
+
messages: readonly ThreadMessage[];
|
946
1123
|
}>) => TSelected): TSelected;
|
947
1124
|
(options: {
|
948
1125
|
optional: true;
|
@@ -960,6 +1137,7 @@ declare const useThread: {
|
|
960
1137
|
attachments: boolean;
|
961
1138
|
feedback: boolean;
|
962
1139
|
}>;
|
1140
|
+
messages: readonly ThreadMessage[];
|
963
1141
|
}> | null;
|
964
1142
|
<TSelected>(options: {
|
965
1143
|
optional: true;
|
@@ -977,6 +1155,7 @@ declare const useThread: {
|
|
977
1155
|
attachments: boolean;
|
978
1156
|
feedback: boolean;
|
979
1157
|
}>;
|
1158
|
+
messages: readonly ThreadMessage[];
|
980
1159
|
}>) => TSelected;
|
981
1160
|
}): TSelected | null;
|
982
1161
|
};
|
@@ -995,6 +1174,7 @@ declare const useThreadStore: {
|
|
995
1174
|
attachments: boolean;
|
996
1175
|
feedback: boolean;
|
997
1176
|
}>;
|
1177
|
+
messages: readonly ThreadMessage[];
|
998
1178
|
}>>;
|
999
1179
|
(options: {
|
1000
1180
|
optional: true;
|
@@ -1012,8 +1192,12 @@ declare const useThreadStore: {
|
|
1012
1192
|
attachments: boolean;
|
1013
1193
|
feedback: boolean;
|
1014
1194
|
}>;
|
1195
|
+
messages: readonly ThreadMessage[];
|
1015
1196
|
}>> | null;
|
1016
1197
|
};
|
1198
|
+
/**
|
1199
|
+
* @deprecated Use `useThread().messages` instead. This will be removed in 0.6.0.
|
1200
|
+
*/
|
1017
1201
|
declare const useThreadMessages: {
|
1018
1202
|
(): readonly ThreadMessage[];
|
1019
1203
|
<TSelected>(selector: (state: readonly ThreadMessage[]) => TSelected): TSelected;
|
@@ -1025,6 +1209,9 @@ declare const useThreadMessages: {
|
|
1025
1209
|
selector?: (state: readonly ThreadMessage[]) => TSelected;
|
1026
1210
|
}): TSelected | null;
|
1027
1211
|
};
|
1212
|
+
/**
|
1213
|
+
* @deprecated Use `useThreadRuntime().getState().messages` instead. This will be removed in 0.6.0.
|
1214
|
+
*/
|
1028
1215
|
declare const useThreadMessagesStore: {
|
1029
1216
|
(): ReadonlyStore<readonly ThreadMessage[]>;
|
1030
1217
|
(options: {
|
@@ -1032,129 +1219,21 @@ declare const useThreadMessagesStore: {
|
|
1032
1219
|
}): ReadonlyStore<readonly ThreadMessage[]> | null;
|
1033
1220
|
};
|
1034
1221
|
declare const useThreadComposer: {
|
1035
|
-
():
|
1036
|
-
|
1037
|
-
value: string;
|
1038
|
-
setValue: (value: string) => void;
|
1039
|
-
attachmentAccept: string;
|
1040
|
-
attachments: readonly ThreadComposerAttachment[];
|
1041
|
-
addAttachment: (file: File) => void;
|
1042
|
-
removeAttachment: (attachmentId: string) => void;
|
1043
|
-
text: string;
|
1044
|
-
setText: (value: string) => void;
|
1045
|
-
reset: () => void;
|
1046
|
-
canCancel: boolean;
|
1047
|
-
isEditing: true;
|
1048
|
-
isEmpty: boolean;
|
1049
|
-
send: () => void;
|
1050
|
-
cancel: () => void;
|
1051
|
-
focus: () => void;
|
1052
|
-
onFocus: (listener: () => void) => Unsubscribe;
|
1053
|
-
}>;
|
1054
|
-
<TSelected>(selector: (state: Readonly<{
|
1055
|
-
type: "thread";
|
1056
|
-
value: string;
|
1057
|
-
setValue: (value: string) => void;
|
1058
|
-
attachmentAccept: string;
|
1059
|
-
attachments: readonly ThreadComposerAttachment[];
|
1060
|
-
addAttachment: (file: File) => void;
|
1061
|
-
removeAttachment: (attachmentId: string) => void;
|
1062
|
-
text: string;
|
1063
|
-
setText: (value: string) => void;
|
1064
|
-
reset: () => void;
|
1065
|
-
canCancel: boolean;
|
1066
|
-
isEditing: true;
|
1067
|
-
isEmpty: boolean;
|
1068
|
-
send: () => void;
|
1069
|
-
cancel: () => void;
|
1070
|
-
focus: () => void;
|
1071
|
-
onFocus: (listener: () => void) => Unsubscribe;
|
1072
|
-
}>) => TSelected): TSelected;
|
1222
|
+
(): ThreadComposerState;
|
1223
|
+
<TSelected>(selector: (state: ThreadComposerState) => TSelected): TSelected;
|
1073
1224
|
(options: {
|
1074
1225
|
optional: true;
|
1075
|
-
}):
|
1076
|
-
type: "thread";
|
1077
|
-
value: string;
|
1078
|
-
setValue: (value: string) => void;
|
1079
|
-
attachmentAccept: string;
|
1080
|
-
attachments: readonly ThreadComposerAttachment[];
|
1081
|
-
addAttachment: (file: File) => void;
|
1082
|
-
removeAttachment: (attachmentId: string) => void;
|
1083
|
-
text: string;
|
1084
|
-
setText: (value: string) => void;
|
1085
|
-
reset: () => void;
|
1086
|
-
canCancel: boolean;
|
1087
|
-
isEditing: true;
|
1088
|
-
isEmpty: boolean;
|
1089
|
-
send: () => void;
|
1090
|
-
cancel: () => void;
|
1091
|
-
focus: () => void;
|
1092
|
-
onFocus: (listener: () => void) => Unsubscribe;
|
1093
|
-
}> | null;
|
1226
|
+
}): ThreadComposerState | null;
|
1094
1227
|
<TSelected>(options: {
|
1095
1228
|
optional: true;
|
1096
|
-
selector?: (state:
|
1097
|
-
type: "thread";
|
1098
|
-
value: string;
|
1099
|
-
setValue: (value: string) => void;
|
1100
|
-
attachmentAccept: string;
|
1101
|
-
attachments: readonly ThreadComposerAttachment[];
|
1102
|
-
addAttachment: (file: File) => void;
|
1103
|
-
removeAttachment: (attachmentId: string) => void;
|
1104
|
-
text: string;
|
1105
|
-
setText: (value: string) => void;
|
1106
|
-
reset: () => void;
|
1107
|
-
canCancel: boolean;
|
1108
|
-
isEditing: true;
|
1109
|
-
isEmpty: boolean;
|
1110
|
-
send: () => void;
|
1111
|
-
cancel: () => void;
|
1112
|
-
focus: () => void;
|
1113
|
-
onFocus: (listener: () => void) => Unsubscribe;
|
1114
|
-
}>) => TSelected;
|
1229
|
+
selector?: (state: ThreadComposerState) => TSelected;
|
1115
1230
|
}): TSelected | null;
|
1116
1231
|
};
|
1117
1232
|
declare const useThreadComposerStore: {
|
1118
|
-
(): ReadonlyStore<
|
1119
|
-
type: "thread";
|
1120
|
-
value: string;
|
1121
|
-
setValue: (value: string) => void;
|
1122
|
-
attachmentAccept: string;
|
1123
|
-
attachments: readonly ThreadComposerAttachment[];
|
1124
|
-
addAttachment: (file: File) => void;
|
1125
|
-
removeAttachment: (attachmentId: string) => void;
|
1126
|
-
text: string;
|
1127
|
-
setText: (value: string) => void;
|
1128
|
-
reset: () => void;
|
1129
|
-
canCancel: boolean;
|
1130
|
-
isEditing: true;
|
1131
|
-
isEmpty: boolean;
|
1132
|
-
send: () => void;
|
1133
|
-
cancel: () => void;
|
1134
|
-
focus: () => void;
|
1135
|
-
onFocus: (listener: () => void) => Unsubscribe;
|
1136
|
-
}>>;
|
1233
|
+
(): ReadonlyStore<ThreadComposerState>;
|
1137
1234
|
(options: {
|
1138
1235
|
optional: true;
|
1139
|
-
}): ReadonlyStore<
|
1140
|
-
type: "thread";
|
1141
|
-
value: string;
|
1142
|
-
setValue: (value: string) => void;
|
1143
|
-
attachmentAccept: string;
|
1144
|
-
attachments: readonly ThreadComposerAttachment[];
|
1145
|
-
addAttachment: (file: File) => void;
|
1146
|
-
removeAttachment: (attachmentId: string) => void;
|
1147
|
-
text: string;
|
1148
|
-
setText: (value: string) => void;
|
1149
|
-
reset: () => void;
|
1150
|
-
canCancel: boolean;
|
1151
|
-
isEditing: true;
|
1152
|
-
isEmpty: boolean;
|
1153
|
-
send: () => void;
|
1154
|
-
cancel: () => void;
|
1155
|
-
focus: () => void;
|
1156
|
-
onFocus: (listener: () => void) => Unsubscribe;
|
1157
|
-
}>> | null;
|
1236
|
+
}): ReadonlyStore<ThreadComposerState> | null;
|
1158
1237
|
};
|
1159
1238
|
declare const useThreadViewport: {
|
1160
1239
|
(): Readonly<{
|
@@ -1313,96 +1392,25 @@ declare const useMessageUtilsStore: {
|
|
1313
1392
|
}>> | null;
|
1314
1393
|
};
|
1315
1394
|
declare const useEditComposer: {
|
1316
|
-
():
|
1317
|
-
|
1318
|
-
value: string;
|
1319
|
-
setValue: (value: string) => void;
|
1320
|
-
text: string;
|
1321
|
-
setText: (value: string) => void;
|
1322
|
-
canCancel: boolean;
|
1323
|
-
isEditing: boolean;
|
1324
|
-
isEmpty: boolean;
|
1325
|
-
edit: () => void;
|
1326
|
-
send: () => void;
|
1327
|
-
cancel: () => void;
|
1328
|
-
}>;
|
1329
|
-
<TSelected>(selector: (state: Readonly<{
|
1330
|
-
type: "edit";
|
1331
|
-
value: string;
|
1332
|
-
setValue: (value: string) => void;
|
1333
|
-
text: string;
|
1334
|
-
setText: (value: string) => void;
|
1335
|
-
canCancel: boolean;
|
1336
|
-
isEditing: boolean;
|
1337
|
-
isEmpty: boolean;
|
1338
|
-
edit: () => void;
|
1339
|
-
send: () => void;
|
1340
|
-
cancel: () => void;
|
1341
|
-
}>) => TSelected): TSelected;
|
1395
|
+
(): EditComposerState;
|
1396
|
+
<TSelected>(selector: (state: EditComposerState) => TSelected): TSelected;
|
1342
1397
|
(options: {
|
1343
1398
|
optional: true;
|
1344
|
-
}):
|
1345
|
-
type: "edit";
|
1346
|
-
value: string;
|
1347
|
-
setValue: (value: string) => void;
|
1348
|
-
text: string;
|
1349
|
-
setText: (value: string) => void;
|
1350
|
-
canCancel: boolean;
|
1351
|
-
isEditing: boolean;
|
1352
|
-
isEmpty: boolean;
|
1353
|
-
edit: () => void;
|
1354
|
-
send: () => void;
|
1355
|
-
cancel: () => void;
|
1356
|
-
}> | null;
|
1399
|
+
}): EditComposerState | null;
|
1357
1400
|
<TSelected>(options: {
|
1358
1401
|
optional: true;
|
1359
|
-
selector?: (state:
|
1360
|
-
type: "edit";
|
1361
|
-
value: string;
|
1362
|
-
setValue: (value: string) => void;
|
1363
|
-
text: string;
|
1364
|
-
setText: (value: string) => void;
|
1365
|
-
canCancel: boolean;
|
1366
|
-
isEditing: boolean;
|
1367
|
-
isEmpty: boolean;
|
1368
|
-
edit: () => void;
|
1369
|
-
send: () => void;
|
1370
|
-
cancel: () => void;
|
1371
|
-
}>) => TSelected;
|
1402
|
+
selector?: (state: EditComposerState) => TSelected;
|
1372
1403
|
}): TSelected | null;
|
1373
1404
|
};
|
1374
1405
|
declare const useEditComposerStore: {
|
1375
|
-
(): ReadonlyStore<
|
1376
|
-
type: "edit";
|
1377
|
-
value: string;
|
1378
|
-
setValue: (value: string) => void;
|
1379
|
-
text: string;
|
1380
|
-
setText: (value: string) => void;
|
1381
|
-
canCancel: boolean;
|
1382
|
-
isEditing: boolean;
|
1383
|
-
isEmpty: boolean;
|
1384
|
-
edit: () => void;
|
1385
|
-
send: () => void;
|
1386
|
-
cancel: () => void;
|
1387
|
-
}>>;
|
1406
|
+
(): ReadonlyStore<EditComposerState>;
|
1388
1407
|
(options: {
|
1389
1408
|
optional: true;
|
1390
|
-
}): ReadonlyStore<
|
1391
|
-
type: "edit";
|
1392
|
-
value: string;
|
1393
|
-
setValue: (value: string) => void;
|
1394
|
-
text: string;
|
1395
|
-
setText: (value: string) => void;
|
1396
|
-
canCancel: boolean;
|
1397
|
-
isEditing: boolean;
|
1398
|
-
isEmpty: boolean;
|
1399
|
-
edit: () => void;
|
1400
|
-
send: () => void;
|
1401
|
-
cancel: () => void;
|
1402
|
-
}>> | null;
|
1409
|
+
}): ReadonlyStore<EditComposerState> | null;
|
1403
1410
|
};
|
1404
1411
|
|
1405
1412
|
type ContentPartContextValue = {
|
1413
|
+
useContentPartRuntime: UseBoundStore<ReadonlyStore<ContentPartRuntime>>;
|
1406
1414
|
useContentPart: UseBoundStore<ReadonlyStore<ContentPartState>>;
|
1407
1415
|
};
|
1408
1416
|
declare const useContentPartContext: {
|
@@ -1413,244 +1421,58 @@ declare const useContentPartContext: {
|
|
1413
1421
|
optional?: boolean | undefined;
|
1414
1422
|
} | undefined): ContentPartContextValue | null;
|
1415
1423
|
};
|
1424
|
+
declare function useContentPartRuntime(options?: {
|
1425
|
+
optional?: false | undefined;
|
1426
|
+
}): ContentPartRuntime;
|
1427
|
+
declare function useContentPartRuntime(options?: {
|
1428
|
+
optional?: boolean | undefined;
|
1429
|
+
}): ContentPartRuntime | null;
|
1416
1430
|
declare const useContentPart: {
|
1417
|
-
():
|
1418
|
-
|
1419
|
-
part: TextContentPart | ImageContentPart | UIContentPart | ToolCallContentPart;
|
1420
|
-
}>;
|
1421
|
-
<TSelected>(selector: (state: Readonly<{
|
1422
|
-
status: ContentPartStatus | ToolCallContentPartStatus;
|
1423
|
-
part: TextContentPart | ImageContentPart | UIContentPart | ToolCallContentPart;
|
1424
|
-
}>) => TSelected): TSelected;
|
1431
|
+
(): ContentPartState;
|
1432
|
+
<TSelected>(selector: (state: ContentPartState) => TSelected): TSelected;
|
1425
1433
|
(options: {
|
1426
1434
|
optional: true;
|
1427
|
-
}):
|
1428
|
-
status: ContentPartStatus | ToolCallContentPartStatus;
|
1429
|
-
part: TextContentPart | ImageContentPart | UIContentPart | ToolCallContentPart;
|
1430
|
-
}> | null;
|
1435
|
+
}): ContentPartState | null;
|
1431
1436
|
<TSelected>(options: {
|
1432
1437
|
optional: true;
|
1433
|
-
selector?: (state:
|
1434
|
-
status: ContentPartStatus | ToolCallContentPartStatus;
|
1435
|
-
part: TextContentPart | ImageContentPart | UIContentPart | ToolCallContentPart;
|
1436
|
-
}>) => TSelected;
|
1438
|
+
selector?: (state: ContentPartState) => TSelected;
|
1437
1439
|
}): TSelected | null;
|
1438
1440
|
};
|
1439
1441
|
declare const useContentPartStore: {
|
1440
|
-
(): ReadonlyStore<
|
1441
|
-
status: ContentPartStatus | ToolCallContentPartStatus;
|
1442
|
-
part: TextContentPart | ImageContentPart | UIContentPart | ToolCallContentPart;
|
1443
|
-
}>>;
|
1442
|
+
(): ReadonlyStore<ContentPartState>;
|
1444
1443
|
(options: {
|
1445
1444
|
optional: true;
|
1446
|
-
}): ReadonlyStore<
|
1447
|
-
status: ContentPartStatus | ToolCallContentPartStatus;
|
1448
|
-
part: TextContentPart | ImageContentPart | UIContentPart | ToolCallContentPart;
|
1449
|
-
}>> | null;
|
1445
|
+
}): ReadonlyStore<ContentPartState> | null;
|
1450
1446
|
};
|
1451
1447
|
|
1452
1448
|
type ComposerContextValue = {
|
1453
|
-
useComposer: ReadonlyStore<
|
1449
|
+
useComposer: UseBoundStore<ReadonlyStore<ComposerState>>;
|
1454
1450
|
type: "edit" | "new";
|
1455
1451
|
};
|
1456
1452
|
declare const useComposerContext: () => ComposerContextValue;
|
1457
1453
|
declare const useComposer: {
|
1458
|
-
():
|
1459
|
-
|
1460
|
-
value: string;
|
1461
|
-
setValue: (value: string) => void;
|
1462
|
-
text: string;
|
1463
|
-
setText: (value: string) => void;
|
1464
|
-
canCancel: boolean;
|
1465
|
-
isEditing: boolean;
|
1466
|
-
isEmpty: boolean;
|
1467
|
-
edit: () => void;
|
1468
|
-
send: () => void;
|
1469
|
-
cancel: () => void;
|
1470
|
-
}> | Readonly<{
|
1471
|
-
type: "thread";
|
1472
|
-
value: string;
|
1473
|
-
setValue: (value: string) => void;
|
1474
|
-
attachmentAccept: string;
|
1475
|
-
attachments: readonly ThreadComposerAttachment[];
|
1476
|
-
addAttachment: (file: File) => void;
|
1477
|
-
removeAttachment: (attachmentId: string) => void;
|
1478
|
-
text: string;
|
1479
|
-
setText: (value: string) => void;
|
1480
|
-
reset: () => void;
|
1481
|
-
canCancel: boolean;
|
1482
|
-
isEditing: true;
|
1483
|
-
isEmpty: boolean;
|
1484
|
-
send: () => void;
|
1485
|
-
cancel: () => void;
|
1486
|
-
focus: () => void;
|
1487
|
-
onFocus: (listener: () => void) => Unsubscribe;
|
1488
|
-
}>;
|
1489
|
-
<TSelected>(selector: (state: Readonly<{
|
1490
|
-
type: "edit";
|
1491
|
-
value: string;
|
1492
|
-
setValue: (value: string) => void;
|
1493
|
-
text: string;
|
1494
|
-
setText: (value: string) => void;
|
1495
|
-
canCancel: boolean;
|
1496
|
-
isEditing: boolean;
|
1497
|
-
isEmpty: boolean;
|
1498
|
-
edit: () => void;
|
1499
|
-
send: () => void;
|
1500
|
-
cancel: () => void;
|
1501
|
-
}> | Readonly<{
|
1502
|
-
type: "thread";
|
1503
|
-
value: string;
|
1504
|
-
setValue: (value: string) => void;
|
1505
|
-
attachmentAccept: string;
|
1506
|
-
attachments: readonly ThreadComposerAttachment[];
|
1507
|
-
addAttachment: (file: File) => void;
|
1508
|
-
removeAttachment: (attachmentId: string) => void;
|
1509
|
-
text: string;
|
1510
|
-
setText: (value: string) => void;
|
1511
|
-
reset: () => void;
|
1512
|
-
canCancel: boolean;
|
1513
|
-
isEditing: true;
|
1514
|
-
isEmpty: boolean;
|
1515
|
-
send: () => void;
|
1516
|
-
cancel: () => void;
|
1517
|
-
focus: () => void;
|
1518
|
-
onFocus: (listener: () => void) => Unsubscribe;
|
1519
|
-
}>) => TSelected): TSelected;
|
1454
|
+
(): ComposerState;
|
1455
|
+
<TSelected>(selector: (state: ComposerState) => TSelected): TSelected;
|
1520
1456
|
(options: {
|
1521
1457
|
optional: true;
|
1522
|
-
}):
|
1523
|
-
type: "edit";
|
1524
|
-
value: string;
|
1525
|
-
setValue: (value: string) => void;
|
1526
|
-
text: string;
|
1527
|
-
setText: (value: string) => void;
|
1528
|
-
canCancel: boolean;
|
1529
|
-
isEditing: boolean;
|
1530
|
-
isEmpty: boolean;
|
1531
|
-
edit: () => void;
|
1532
|
-
send: () => void;
|
1533
|
-
cancel: () => void;
|
1534
|
-
}> | Readonly<{
|
1535
|
-
type: "thread";
|
1536
|
-
value: string;
|
1537
|
-
setValue: (value: string) => void;
|
1538
|
-
attachmentAccept: string;
|
1539
|
-
attachments: readonly ThreadComposerAttachment[];
|
1540
|
-
addAttachment: (file: File) => void;
|
1541
|
-
removeAttachment: (attachmentId: string) => void;
|
1542
|
-
text: string;
|
1543
|
-
setText: (value: string) => void;
|
1544
|
-
reset: () => void;
|
1545
|
-
canCancel: boolean;
|
1546
|
-
isEditing: true;
|
1547
|
-
isEmpty: boolean;
|
1548
|
-
send: () => void;
|
1549
|
-
cancel: () => void;
|
1550
|
-
focus: () => void;
|
1551
|
-
onFocus: (listener: () => void) => Unsubscribe;
|
1552
|
-
}> | null;
|
1458
|
+
}): ComposerState | null;
|
1553
1459
|
<TSelected>(options: {
|
1554
1460
|
optional: true;
|
1555
|
-
selector?: (state:
|
1556
|
-
type: "edit";
|
1557
|
-
value: string;
|
1558
|
-
setValue: (value: string) => void;
|
1559
|
-
text: string;
|
1560
|
-
setText: (value: string) => void;
|
1561
|
-
canCancel: boolean;
|
1562
|
-
isEditing: boolean;
|
1563
|
-
isEmpty: boolean;
|
1564
|
-
edit: () => void;
|
1565
|
-
send: () => void;
|
1566
|
-
cancel: () => void;
|
1567
|
-
}> | Readonly<{
|
1568
|
-
type: "thread";
|
1569
|
-
value: string;
|
1570
|
-
setValue: (value: string) => void;
|
1571
|
-
attachmentAccept: string;
|
1572
|
-
attachments: readonly ThreadComposerAttachment[];
|
1573
|
-
addAttachment: (file: File) => void;
|
1574
|
-
removeAttachment: (attachmentId: string) => void;
|
1575
|
-
text: string;
|
1576
|
-
setText: (value: string) => void;
|
1577
|
-
reset: () => void;
|
1578
|
-
canCancel: boolean;
|
1579
|
-
isEditing: true;
|
1580
|
-
isEmpty: boolean;
|
1581
|
-
send: () => void;
|
1582
|
-
cancel: () => void;
|
1583
|
-
focus: () => void;
|
1584
|
-
onFocus: (listener: () => void) => Unsubscribe;
|
1585
|
-
}>) => TSelected;
|
1461
|
+
selector?: (state: ComposerState) => TSelected;
|
1586
1462
|
}): TSelected | null;
|
1587
1463
|
};
|
1588
1464
|
declare const useComposerStore: {
|
1589
|
-
(): ReadonlyStore<
|
1590
|
-
type: "edit";
|
1591
|
-
value: string;
|
1592
|
-
setValue: (value: string) => void;
|
1593
|
-
text: string;
|
1594
|
-
setText: (value: string) => void;
|
1595
|
-
canCancel: boolean;
|
1596
|
-
isEditing: boolean;
|
1597
|
-
isEmpty: boolean;
|
1598
|
-
edit: () => void;
|
1599
|
-
send: () => void;
|
1600
|
-
cancel: () => void;
|
1601
|
-
}> | Readonly<{
|
1602
|
-
type: "thread";
|
1603
|
-
value: string;
|
1604
|
-
setValue: (value: string) => void;
|
1605
|
-
attachmentAccept: string;
|
1606
|
-
attachments: readonly ThreadComposerAttachment[];
|
1607
|
-
addAttachment: (file: File) => void;
|
1608
|
-
removeAttachment: (attachmentId: string) => void;
|
1609
|
-
text: string;
|
1610
|
-
setText: (value: string) => void;
|
1611
|
-
reset: () => void;
|
1612
|
-
canCancel: boolean;
|
1613
|
-
isEditing: true;
|
1614
|
-
isEmpty: boolean;
|
1615
|
-
send: () => void;
|
1616
|
-
cancel: () => void;
|
1617
|
-
focus: () => void;
|
1618
|
-
onFocus: (listener: () => void) => Unsubscribe;
|
1619
|
-
}>>;
|
1465
|
+
(): ReadonlyStore<ComposerState>;
|
1620
1466
|
(options: {
|
1621
1467
|
optional: true;
|
1622
|
-
}): ReadonlyStore<
|
1623
|
-
type: "edit";
|
1624
|
-
value: string;
|
1625
|
-
setValue: (value: string) => void;
|
1626
|
-
text: string;
|
1627
|
-
setText: (value: string) => void;
|
1628
|
-
canCancel: boolean;
|
1629
|
-
isEditing: boolean;
|
1630
|
-
isEmpty: boolean;
|
1631
|
-
edit: () => void;
|
1632
|
-
send: () => void;
|
1633
|
-
cancel: () => void;
|
1634
|
-
}> | Readonly<{
|
1635
|
-
type: "thread";
|
1636
|
-
value: string;
|
1637
|
-
setValue: (value: string) => void;
|
1638
|
-
attachmentAccept: string;
|
1639
|
-
attachments: readonly ThreadComposerAttachment[];
|
1640
|
-
addAttachment: (file: File) => void;
|
1641
|
-
removeAttachment: (attachmentId: string) => void;
|
1642
|
-
text: string;
|
1643
|
-
setText: (value: string) => void;
|
1644
|
-
reset: () => void;
|
1645
|
-
canCancel: boolean;
|
1646
|
-
isEditing: true;
|
1647
|
-
isEmpty: boolean;
|
1648
|
-
send: () => void;
|
1649
|
-
cancel: () => void;
|
1650
|
-
focus: () => void;
|
1651
|
-
onFocus: (listener: () => void) => Unsubscribe;
|
1652
|
-
}>> | null;
|
1468
|
+
}): ReadonlyStore<ComposerState> | null;
|
1653
1469
|
};
|
1470
|
+
declare function useComposerRuntime(options?: {
|
1471
|
+
optional?: false | undefined;
|
1472
|
+
}): ComposerRuntime;
|
1473
|
+
declare function useComposerRuntime(options?: {
|
1474
|
+
optional?: boolean | undefined;
|
1475
|
+
}): ComposerRuntime | null;
|
1654
1476
|
|
1655
1477
|
declare const useAppendMessage: () => (message: CreateAppendMessage) => void;
|
1656
1478
|
|
@@ -1724,20 +1546,20 @@ declare const useComposerSend: () => (() => void) | null;
|
|
1724
1546
|
|
1725
1547
|
declare const useComposerAddAttachment: () => (() => void) | null;
|
1726
1548
|
|
1727
|
-
declare const useContentPartDisplay: () =>
|
1728
|
-
|
1729
|
-
|
1730
|
-
}
|
1549
|
+
declare const useContentPartDisplay: () => UIContentPart & {
|
1550
|
+
part: ThreadUserContentPart | ThreadAssistantContentPart;
|
1551
|
+
status: ContentPartStatus | ToolCallContentPartStatus;
|
1552
|
+
};
|
1731
1553
|
|
1732
|
-
declare const useContentPartImage: () =>
|
1733
|
-
|
1734
|
-
|
1735
|
-
}
|
1554
|
+
declare const useContentPartImage: () => ImageContentPart & {
|
1555
|
+
part: ThreadUserContentPart | ThreadAssistantContentPart;
|
1556
|
+
status: ContentPartStatus | ToolCallContentPartStatus;
|
1557
|
+
};
|
1736
1558
|
|
1737
|
-
declare const useContentPartText: () =>
|
1738
|
-
|
1739
|
-
|
1740
|
-
}
|
1559
|
+
declare const useContentPartText: () => TextContentPart & {
|
1560
|
+
part: ThreadUserContentPart | ThreadAssistantContentPart;
|
1561
|
+
status: ContentPartStatus | ToolCallContentPartStatus;
|
1562
|
+
};
|
1741
1563
|
|
1742
1564
|
type MessageIfFilters = {
|
1743
1565
|
user: boolean | undefined;
|
@@ -2463,7 +2285,9 @@ declare class ProxyConfigProvider implements ModelConfigProvider {
|
|
2463
2285
|
registerModelConfigProvider(provider: ModelConfigProvider): () => void;
|
2464
2286
|
}
|
2465
2287
|
|
2466
|
-
declare const
|
2288
|
+
declare const generateId: (size?: number) => string;
|
2289
|
+
|
2290
|
+
declare const useSmooth: (state: ContentPartState & TextContentPart, smooth?: boolean) => ContentPartState & TextContentPart;
|
2467
2291
|
|
2468
2292
|
declare const withSmoothContextProvider: <C extends ComponentType<any>>(Component: C) => C;
|
2469
2293
|
declare const useSmoothStatus: {
|
@@ -2522,21 +2346,19 @@ declare const useSmoothStatus: {
|
|
2522
2346
|
}): TSelected | null;
|
2523
2347
|
};
|
2524
2348
|
|
2525
|
-
declare const generateId: (size?: number) => string;
|
2526
|
-
|
2527
2349
|
type internal_AssistantRuntime<TThreadRuntime extends ThreadRuntime = ThreadRuntime> = AssistantRuntime<TThreadRuntime>;
|
2528
2350
|
declare const internal_AssistantRuntime: typeof AssistantRuntime;
|
2529
|
-
type internal_BaseAssistantRuntimeCore<TThreadRuntime extends
|
2351
|
+
type internal_BaseAssistantRuntimeCore<TThreadRuntime extends ThreadRuntimeCore> = BaseAssistantRuntimeCore<TThreadRuntime>;
|
2530
2352
|
declare const internal_BaseAssistantRuntimeCore: typeof BaseAssistantRuntimeCore;
|
2531
|
-
type
|
2532
|
-
declare const
|
2353
|
+
type internal_DefaultThreadComposerRuntimeCore = DefaultThreadComposerRuntimeCore;
|
2354
|
+
declare const internal_DefaultThreadComposerRuntimeCore: typeof DefaultThreadComposerRuntimeCore;
|
2533
2355
|
type internal_MessageRepository = MessageRepository;
|
2534
2356
|
declare const internal_MessageRepository: typeof MessageRepository;
|
2535
2357
|
type internal_ProxyConfigProvider = ProxyConfigProvider;
|
2536
2358
|
declare const internal_ProxyConfigProvider: typeof ProxyConfigProvider;
|
2537
|
-
type internal_ReactThreadRuntimeCore = ReactThreadRuntimeCore;
|
2538
2359
|
type internal_ThreadRuntime = ThreadRuntime;
|
2539
2360
|
declare const internal_ThreadRuntime: typeof ThreadRuntime;
|
2361
|
+
type internal_ThreadRuntimeCore = ThreadRuntimeCore;
|
2540
2362
|
type internal_ThreadRuntimeCoreBinding = ThreadRuntimeCoreBinding;
|
2541
2363
|
declare const internal_TooltipIconButton: typeof TooltipIconButton;
|
2542
2364
|
declare const internal_generateId: typeof generateId;
|
@@ -2544,7 +2366,7 @@ declare const internal_useSmooth: typeof useSmooth;
|
|
2544
2366
|
declare const internal_useSmoothStatus: typeof useSmoothStatus;
|
2545
2367
|
declare const internal_withSmoothContextProvider: typeof withSmoothContextProvider;
|
2546
2368
|
declare namespace internal {
|
2547
|
-
export { internal_AssistantRuntime as AssistantRuntime, internal_BaseAssistantRuntimeCore as BaseAssistantRuntimeCore,
|
2369
|
+
export { internal_AssistantRuntime as AssistantRuntime, internal_BaseAssistantRuntimeCore as BaseAssistantRuntimeCore, internal_DefaultThreadComposerRuntimeCore as DefaultThreadComposerRuntimeCore, internal_MessageRepository as MessageRepository, internal_ProxyConfigProvider as ProxyConfigProvider, internal_ThreadRuntime as ThreadRuntime, type internal_ThreadRuntimeCore as ThreadRuntimeCore, type internal_ThreadRuntimeCoreBinding as ThreadRuntimeCoreBinding, internal_TooltipIconButton as TooltipIconButton, internal_generateId as generateId, internal_useSmooth as useSmooth, internal_useSmoothStatus as useSmoothStatus, internal_withSmoothContextProvider as withSmoothContextProvider };
|
2548
2370
|
}
|
2549
2371
|
|
2550
|
-
export { index$6 as ActionBarPrimitive, type ActionBarPrimitiveCopyProps, type ActionBarPrimitiveEditProps, type ActionBarPrimitiveFeedbackNegativeProps, type ActionBarPrimitiveFeedbackPositiveProps, type ActionBarPrimitiveReloadProps, type ActionBarPrimitiveRootProps, type ActionBarPrimitiveSpeakProps, type ActionBarPrimitiveStopSpeakingProps, type AddToolResultOptions, AppendMessage, _default$b as AssistantActionBar, type AssistantContextValue, _default$a as AssistantMessage, type AssistantMessageConfig, type AssistantMessageContentProps, _default$9 as AssistantModal, index$5 as AssistantModalPrimitive, type AssistantModalPrimitiveContentProps, type AssistantModalPrimitiveRootProps, type AssistantModalPrimitiveTriggerProps, AssistantRuntime, AssistantRuntimeProvider, type AssistantTool, type AssistantToolProps, type AssistantToolUI, type AssistantToolUIProps, type AssistantToolUIsState, type AttachmentAdapter, _default$8 as BranchPicker, index$4 as BranchPickerPrimitive, type BranchPickerPrimitiveCountProps, type BranchPickerPrimitiveNextProps, type BranchPickerPrimitiveNumberProps, type BranchPickerPrimitivePreviousProps, type BranchPickerPrimitiveRootProps, type ChatModelAdapter, type ChatModelRunOptions, type ChatModelRunResult, type ChatModelRunUpdate, _default$7 as Composer, _default$6 as ComposerAttachment, type ComposerContextValue, type ComposerInputProps, index$3 as ComposerPrimitive, type ComposerPrimitiveCancelProps, type ComposerPrimitiveIfProps, type ComposerPrimitiveInputProps, type ComposerPrimitiveRootProps, type ComposerPrimitiveSendProps, CompositeAttachmentAdapter, exports as ContentPart, type ContentPartContextValue, index$2 as ContentPartPrimitive, type ContentPartPrimitiveDisplayProps, type ContentPartPrimitiveImageProps, type ContentPartPrimitiveInProgressProps, type ContentPartPrimitiveTextProps, ContentPartRuntime,
|
2372
|
+
export { index$6 as ActionBarPrimitive, type ActionBarPrimitiveCopyProps, type ActionBarPrimitiveEditProps, type ActionBarPrimitiveFeedbackNegativeProps, type ActionBarPrimitiveFeedbackPositiveProps, type ActionBarPrimitiveReloadProps, type ActionBarPrimitiveRootProps, type ActionBarPrimitiveSpeakProps, type ActionBarPrimitiveStopSpeakingProps, type AddToolResultOptions, AppendMessage, _default$b as AssistantActionBar, type AssistantContextValue, _default$a as AssistantMessage, type AssistantMessageConfig, type AssistantMessageContentProps, _default$9 as AssistantModal, index$5 as AssistantModalPrimitive, type AssistantModalPrimitiveContentProps, type AssistantModalPrimitiveRootProps, type AssistantModalPrimitiveTriggerProps, AssistantRuntime, AssistantRuntimeProvider, type AssistantTool, type AssistantToolProps, type AssistantToolUI, type AssistantToolUIProps, type AssistantToolUIsState, Attachment, type AttachmentAdapter, _default$8 as BranchPicker, index$4 as BranchPickerPrimitive, type BranchPickerPrimitiveCountProps, type BranchPickerPrimitiveNextProps, type BranchPickerPrimitiveNumberProps, type BranchPickerPrimitivePreviousProps, type BranchPickerPrimitiveRootProps, type ChatModelAdapter, type ChatModelRunOptions, type ChatModelRunResult, type ChatModelRunUpdate, CompleteAttachment, _default$7 as Composer, _default$6 as ComposerAttachment, type ComposerContextValue, type ComposerInputProps, index$3 as ComposerPrimitive, type ComposerPrimitiveCancelProps, type ComposerPrimitiveIfProps, type ComposerPrimitiveInputProps, type ComposerPrimitiveRootProps, type ComposerPrimitiveSendProps, ComposerRuntime, type ComposerState, CompositeAttachmentAdapter, exports as ContentPart, type ContentPartContextValue, index$2 as ContentPartPrimitive, type ContentPartPrimitiveDisplayProps, type ContentPartPrimitiveImageProps, type ContentPartPrimitiveInProgressProps, type ContentPartPrimitiveTextProps, ContentPartRuntime, CoreMessage, type DangerousInBrowserRuntimeOptions, EdgeChatAdapter, type EdgeRuntimeOptions, _default$5 as EditComposer, EditComposerRuntime, type EditComposerState, type EmptyContentPartComponent, type EmptyContentPartProps, type ExternalStoreAdapter, type ExternalStoreMessageConverter, internal as INTERNAL, ImageContentPart, type ImageContentPartComponent, type ImageContentPartProps, type LocalRuntimeOptions, type MessageContextValue, index$1 as MessagePrimitive, type MessagePrimitiveContentProps, type MessagePrimitiveIfProps, type MessagePrimitiveInProgressProps, type MessagePrimitiveRootProps, MessageRuntime, type MessageState, MessageStatus, type MessageUtilsState, ModelConfig, ModelConfigProvider, PendingAttachment, SimpleImageAttachmentAdapter, SimpleTextAttachmentAdapter, SpeechSynthesisAdapter, StreamUtils, type StringsConfig, type SubmitFeedbackOptions, type SuggestionConfig, TextContentPart, type TextContentPartComponent, type TextContentPartProps, TextContentPartProvider, _default$4 as Thread, ThreadAssistantContentPart, ThreadComposerRuntime, type ThreadConfig, ThreadConfigProvider, type ThreadConfigProviderProps, type ThreadContextValue, ThreadMessage, type ThreadMessageLike, index as ThreadPrimitive, type ThreadPrimitiveEmptyProps, type ThreadPrimitiveIfProps, type ThreadPrimitiveMessagesProps, type ThreadPrimitiveRootProps, type ThreadPrimitiveScrollToBottomProps, type ThreadPrimitiveSuggestionProps, type ThreadPrimitiveViewportProps, type ThreadRootProps, ThreadRuntime, type ThreadState, ThreadUserContentPart, type ThreadViewportState, _default as ThreadWelcome, type ThreadWelcomeConfig, type ThreadWelcomeMessageProps, type ThreadWelcomeSuggestionProps, Tool, ToolCallContentPart, type ToolCallContentPartComponent, type ToolCallContentPartProps, UIContentPart, type UIContentPartComponent, type UIContentPartProps, type Unsubscribe, type UseActionBarCopyProps, _default$2 as UserActionBar, _default$3 as UserMessage, _default$1 as UserMessageAttachment, type UserMessageConfig, type UserMessageContentProps, WebSpeechSynthesisAdapter, fromCoreMessage, fromCoreMessages, fromLanguageModelMessages, fromLanguageModelTools, getExternalStoreMessage, makeAssistantTool, makeAssistantToolUI, streamUtils, subscribeToMainThread, toCoreMessage, toCoreMessages, toLanguageModelMessages, toLanguageModelTools, useActionBarCopy, useActionBarEdit, useActionBarFeedbackNegative, useActionBarFeedbackPositive, useActionBarReload, useActionBarSpeak, useActionBarStopSpeaking, useAppendMessage, useAssistantActions, useAssistantActionsStore, useAssistantContext, useAssistantInstructions, useAssistantRuntime, useAssistantRuntimeStore, useAssistantTool, useAssistantToolUI, useBranchPickerCount, useBranchPickerNext, useBranchPickerNumber, useBranchPickerPrevious, useComposer, useComposerAddAttachment, useComposerCancel, useComposerContext, useComposerIf, useComposerRuntime, useComposerSend, useComposerStore, useContentPart, useContentPartContext, useContentPartDisplay, useContentPartImage, useContentPartRuntime, useContentPartStore, useContentPartText, useDangerousInBrowserRuntime, useEdgeRuntime, useEditComposer, useEditComposerStore, useExternalMessageConverter, useExternalStoreRuntime, useLocalRuntime, useMessage, useMessageContext, useMessageIf, useMessageRuntime, useMessageStore, useMessageUtils, useMessageUtilsStore, useSwitchToNewThread, useThread, useThreadActions, useThreadActionsStore, useThreadComposer, useThreadComposerStore, useThreadConfig, useThreadContext, useThreadEmpty, useThreadIf, useThreadMessages, useThreadMessagesStore, useThreadRuntime, useThreadRuntimeStore, useThreadScrollToBottom, useThreadStore, useThreadSuggestion, useThreadViewport, useThreadViewportStore, useToolUIs, useToolUIsStore };
|