@assistant-ui/react 0.5.60 → 0.5.62

Sign up to get free protection for your applications and to get access to all the features.
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
+ import { C as ContentPartStatus, T as TextContentPart, I as ImageContentPart, U as UIContentPart, a as ToolCallContentPart, b as ToolCallContentPartStatus, c as ThreadMessage, d as CoreMessage, e as ThreadComposerAttachment, A as AppendMessage, M as ModelConfig, f as ModelConfigProvider, g as ThreadAssistantContentPart, h as MessageStatus, i as ThreadRoundtrip, j as MessageAttachment, k as Tool, l as CoreToolCallContentPart, m as CreateEdgeRuntimeAPIOptions, n as ThreadUserContentPart } from './edge-D7ch2oPK.js';
2
+ export { s as CoreAssistantContentPart, v as CoreAssistantMessage, t as CoreSystemMessage, r as CoreUserContentPart, u as CoreUserMessage, E as EdgeRuntimeRequestOptions, p as ThreadAssistantMessage, o as ThreadSystemMessage, q as ThreadUserMessage } from './edge-D7ch2oPK.js';
1
3
  import * as react from 'react';
2
4
  import { ComponentType, PropsWithChildren, FC, ComponentPropsWithoutRef, ElementType, ReactNode } from 'react';
3
- import { C as ContentPartStatus, T as TextContentPart, I as ImageContentPart, U as UIContentPart, a as ToolCallContentPart, b as ToolCallContentPartStatus, c as ThreadAssistantContentPart, M as MessageStatus, d as ThreadRoundtrip, e as ThreadMessage, f as ModelConfig, g as ModelConfigProvider, h as CoreMessage, i as ThreadComposerAttachment, j as MessageAttachment, A as AppendMessage, k as Tool, l as CoreToolCallContentPart, m as CreateEdgeRuntimeAPIOptions } from './edge-eV0d_Sqj.js';
4
- export { s as CoreAssistantContentPart, v as CoreAssistantMessage, t as CoreSystemMessage, r as CoreUserContentPart, u as CoreUserMessage, E as EdgeRuntimeRequestOptions, p as ThreadAssistantMessage, o as ThreadSystemMessage, n as ThreadUserContentPart, q as ThreadUserMessage } from './edge-eV0d_Sqj.js';
5
5
  import { StoreApi, UseBoundStore } from 'zustand';
6
6
  import { Primitive } from '@radix-ui/react-primitive';
7
7
  import * as PopoverPrimitive from '@radix-ui/react-popover';
@@ -44,11 +44,131 @@ type Unsubscribe = () => void;
44
44
 
45
45
  type ReadonlyStore<T> = Omit<StoreApi<T>, "setState" | "destroy">;
46
46
 
47
- type ReactThreadRuntime = ThreadRuntime & {
48
- unstable_synchronizer?: ComponentType;
47
+ type ThreadState$1 = Readonly<{
48
+ capabilities: Readonly<RuntimeCapabilities>;
49
+ threadId: string;
50
+ isRunning: boolean;
51
+ isDisabled: boolean;
52
+ }>;
53
+ type RuntimeCapabilities = {
54
+ switchToBranch: boolean;
55
+ edit: boolean;
56
+ reload: boolean;
57
+ cancel: boolean;
58
+ unstable_copy: boolean;
59
+ speak: boolean;
60
+ attachments: boolean;
61
+ feedback: boolean;
62
+ };
63
+
64
+ declare namespace SpeechSynthesisAdapter {
65
+ type Status = {
66
+ type: "starting" | "running";
67
+ } | {
68
+ type: "ended";
69
+ reason: "finished" | "cancelled" | "error";
70
+ error?: unknown;
71
+ };
72
+ type Utterance = {
73
+ status: Status;
74
+ cancel: () => void;
75
+ onEnd: (callback: () => void) => Unsubscribe;
76
+ };
77
+ }
78
+ type SpeechSynthesisAdapter = {
79
+ speak: (message: ThreadMessage) => SpeechSynthesisAdapter.Utterance;
80
+ };
81
+
82
+ declare class WebSpeechSynthesisAdapter implements SpeechSynthesisAdapter {
83
+ speak(message: ThreadMessage): SpeechSynthesisAdapter.Utterance;
84
+ }
85
+
86
+ interface ExportedMessageRepository {
87
+ headId?: string | null;
88
+ messages: Array<{
89
+ message: ThreadMessage;
90
+ parentId: string | null;
91
+ }>;
92
+ }
93
+ declare class MessageRepository {
94
+ private messages;
95
+ private head;
96
+ private root;
97
+ private performOp;
98
+ getMessages(): ThreadMessage[];
99
+ addOrUpdateMessage(parentId: string | null, message: ThreadMessage): void;
100
+ getMessage(messageId: string): {
101
+ parentId: string | null;
102
+ message: ThreadMessage;
103
+ };
104
+ appendOptimisticMessage(parentId: string | null, message: CoreMessage): string;
105
+ deleteMessage(messageId: string, replacementId?: string | null | undefined): void;
106
+ getBranches(messageId: string): string[];
107
+ switchToBranch(messageId: string): void;
108
+ resetHead(messageId: string | null): void;
109
+ export(): ExportedMessageRepository;
110
+ import({ headId, messages }: ExportedMessageRepository): void;
111
+ }
112
+
113
+ type ThreadComposerRuntimeCore = Readonly<{
114
+ attachmentAccept: string;
115
+ attachments: ThreadComposerAttachment[];
116
+ addAttachment: (file: File) => Promise<void>;
117
+ removeAttachment: (attachmentId: string) => Promise<void>;
118
+ isEmpty: boolean;
119
+ text: string;
120
+ setText: (value: string) => void;
121
+ reset: () => void;
122
+ send: () => void;
123
+ subscribe: (callback: () => void) => Unsubscribe;
124
+ }>;
125
+
126
+ type AddToolResultOptions = {
127
+ messageId: string;
128
+ toolName: string;
129
+ toolCallId: string;
130
+ result: any;
49
131
  };
132
+ type SubmitFeedbackOptions = {
133
+ messageId: string;
134
+ type: "negative" | "positive";
135
+ };
136
+ type ThreadRuntimeCore = Readonly<{
137
+ getBranches: (messageId: string) => readonly string[];
138
+ switchToBranch: (branchId: string) => void;
139
+ append: (message: AppendMessage) => void;
140
+ startRun: (parentId: string | null) => void;
141
+ cancelRun: () => void;
142
+ addToolResult: (options: AddToolResultOptions) => void;
143
+ speak: (messageId: string) => SpeechSynthesisAdapter.Utterance;
144
+ submitFeedback: (feedback: SubmitFeedbackOptions) => void;
145
+ getModelConfig: () => ModelConfig;
146
+ composer: ThreadComposerRuntimeCore;
147
+ capabilities: Readonly<RuntimeCapabilities>;
148
+ threadId: string;
149
+ isDisabled: boolean;
150
+ messages: readonly ThreadMessage[];
151
+ subscribe: (callback: () => void) => Unsubscribe;
152
+ import(repository: ExportedMessageRepository): void;
153
+ export(): ExportedMessageRepository;
154
+ }>;
50
155
 
51
- declare const subscribeToMainThread: (runtime: ThreadRuntimeWithSubscribe, callback: () => void) => () => void;
156
+ type AssistantRuntimeCore = {
157
+ readonly thread: ThreadRuntimeCore;
158
+ switchToNewThread: () => void;
159
+ switchToThread(threadId: string): void;
160
+ /**
161
+ * @deprecated Use `switchToNewThread` instead. This will be removed in 0.6.0.
162
+ */
163
+ switchToThread(threadId: string | null): void;
164
+ registerModelConfigProvider: (provider: ModelConfigProvider) => Unsubscribe;
165
+ subscribe: (callback: () => void) => Unsubscribe;
166
+ };
167
+
168
+ /**
169
+ * @deprecated Use `runtime.thread.subscribe` instead. This will be removed in 0.6.0.
170
+ */
171
+ declare const subscribeToMainThread: (runtime: AssistantRuntimeCore, callback: () => void) => () => void;
52
172
 
53
173
  type ChatModelRunUpdate = {
54
174
  content: ThreadAssistantContentPart[];
@@ -75,7 +195,11 @@ type ChatModelAdapter = {
75
195
  run: (options: ChatModelRunOptions) => Promise<ChatModelRunResult> | AsyncGenerator<ChatModelRunResult, void>;
76
196
  };
77
197
 
78
- declare abstract class BaseAssistantRuntime<TThreadRuntime extends ReactThreadRuntime> implements AssistantRuntime {
198
+ type ReactThreadRuntimeCore = ThreadRuntimeCore & {
199
+ unstable_synchronizer?: ComponentType;
200
+ };
201
+
202
+ declare abstract class BaseAssistantRuntimeCore<TThreadRuntime extends ReactThreadRuntimeCore> implements AssistantRuntimeCore {
79
203
  private _thread;
80
204
  constructor(_thread: TThreadRuntime);
81
205
  get thread(): TThreadRuntime;
@@ -88,33 +212,6 @@ declare abstract class BaseAssistantRuntime<TThreadRuntime extends ReactThreadRu
88
212
  private subscriptionHandler;
89
213
  }
90
214
 
91
- interface ExportedMessageRepository {
92
- headId?: string | null;
93
- messages: Array<{
94
- message: ThreadMessage;
95
- parentId: string | null;
96
- }>;
97
- }
98
- declare class MessageRepository {
99
- private messages;
100
- private head;
101
- private root;
102
- private performOp;
103
- getMessages(): ThreadMessage[];
104
- addOrUpdateMessage(parentId: string | null, message: ThreadMessage): void;
105
- getMessage(messageId: string): {
106
- parentId: string | null;
107
- message: ThreadMessage;
108
- };
109
- appendOptimisticMessage(parentId: string | null, message: CoreMessage): string;
110
- deleteMessage(messageId: string, replacementId?: string | null | undefined): void;
111
- getBranches(messageId: string): string[];
112
- switchToBranch(messageId: string): void;
113
- resetHead(messageId: string | null): void;
114
- export(): ExportedMessageRepository;
115
- import({ headId, messages }: ExportedMessageRepository): void;
116
- }
117
-
118
215
  type AttachmentAdapter = {
119
216
  accept: string;
120
217
  add(state: {
@@ -124,16 +221,15 @@ type AttachmentAdapter = {
124
221
  send(attachment: ThreadComposerAttachment): Promise<MessageAttachment>;
125
222
  };
126
223
 
127
- declare class ThreadRuntimeComposer implements ThreadRuntime.Composer {
224
+ declare class BaseThreadComposerRuntimeCore implements ThreadComposerRuntimeCore {
128
225
  private runtime;
129
- private notifySubscribers;
130
226
  private _attachmentAdapter?;
131
227
  attachmentAccept: string;
132
228
  get isEmpty(): boolean;
133
229
  constructor(runtime: {
134
- messages: ThreadRuntime["messages"];
230
+ messages: ThreadRuntimeCore["messages"];
135
231
  append: (message: AppendMessage) => void;
136
- }, notifySubscribers: () => void);
232
+ });
137
233
  setAttachmentAdapter(adapter: AttachmentAdapter | undefined): boolean;
138
234
  private _attachments;
139
235
  get attachments(): ThreadComposerAttachment[];
@@ -144,6 +240,9 @@ declare class ThreadRuntimeComposer implements ThreadRuntime.Composer {
144
240
  setText(value: string): void;
145
241
  reset(): void;
146
242
  send(): Promise<void>;
243
+ private _subscriptions;
244
+ private notifySubscribers;
245
+ subscribe(callback: () => void): Unsubscribe;
147
246
  }
148
247
 
149
248
  type FeedbackAdapterFeedback = {
@@ -154,24 +253,6 @@ type FeedbackAdapter = {
154
253
  submit: (feedback: FeedbackAdapterFeedback) => void;
155
254
  };
156
255
 
157
- declare namespace SpeechSynthesisAdapter {
158
- type Status = {
159
- type: "starting" | "running";
160
- } | {
161
- type: "ended";
162
- reason: "finished" | "cancelled" | "error";
163
- error?: unknown;
164
- };
165
- type Utterance = {
166
- status: Status;
167
- cancel: () => void;
168
- onEnd: (callback: () => void) => Unsubscribe;
169
- };
170
- }
171
- type SpeechSynthesisAdapter = {
172
- speak: (message: ThreadMessage) => SpeechSynthesisAdapter.Utterance;
173
- };
174
-
175
256
  type LocalRuntimeOptions = {
176
257
  initialMessages?: readonly CoreMessage[] | undefined;
177
258
  maxToolRoundtrips?: number | undefined;
@@ -182,33 +263,7 @@ type LocalRuntimeOptions = {
182
263
  } | undefined;
183
264
  };
184
265
 
185
- declare class WebSpeechSynthesisAdapter implements SpeechSynthesisAdapter {
186
- speak(message: ThreadMessage): SpeechSynthesisAdapter.Utterance;
187
- }
188
-
189
- type AddToolResultOptions = {
190
- messageId: string;
191
- toolName: string;
192
- toolCallId: string;
193
- result: any;
194
- };
195
- type SubmitFeedbackOptions = {
196
- messageId: string;
197
- type: "negative" | "positive";
198
- };
199
- type ThreadActionsState = Readonly<{
200
- getBranches: (messageId: string) => readonly string[];
201
- switchToBranch: (branchId: string) => void;
202
- append: (message: AppendMessage) => void;
203
- startRun: (parentId: string | null) => void;
204
- cancelRun: () => void;
205
- addToolResult: (options: AddToolResultOptions) => void;
206
- speak: (messageId: string) => SpeechSynthesisAdapter.Utterance;
207
- submitFeedback: (feedback: SubmitFeedbackOptions) => void;
208
- getModelConfig: () => ModelConfig;
209
- }>;
210
-
211
- declare class LocalThreadRuntime implements ThreadRuntime {
266
+ declare class LocalThreadRuntimeCore implements ThreadRuntimeCore {
212
267
  private configProvider;
213
268
  adapter: ChatModelAdapter;
214
269
  private _subscriptions;
@@ -227,7 +282,7 @@ declare class LocalThreadRuntime implements ThreadRuntime {
227
282
  readonly threadId: string;
228
283
  readonly isDisabled = false;
229
284
  get messages(): ThreadMessage[];
230
- readonly composer: ThreadRuntimeComposer;
285
+ readonly composer: BaseThreadComposerRuntimeCore;
231
286
  constructor(configProvider: ModelConfigProvider, adapter: ChatModelAdapter, { initialMessages, ...options }: LocalRuntimeOptions);
232
287
  getModelConfig(): ModelConfig;
233
288
  private _options;
@@ -249,19 +304,22 @@ declare class LocalThreadRuntime implements ThreadRuntime {
249
304
  import(data: ExportedMessageRepository): void;
250
305
  }
251
306
 
252
- declare class LocalRuntime extends BaseAssistantRuntime<LocalThreadRuntime> {
307
+ declare class LocalRuntimeCore extends BaseAssistantRuntimeCore<LocalThreadRuntimeCore> {
253
308
  private readonly _proxyConfigProvider;
254
309
  constructor(adapter: ChatModelAdapter, options: LocalRuntimeOptions);
255
- set adapter(adapter: ChatModelAdapter);
256
- set options(options: LocalRuntimeOptions);
257
310
  registerModelConfigProvider(provider: ModelConfigProvider): () => void;
258
- switchToNewThread(): LocalThreadRuntime;
311
+ switchToNewThread(): void;
259
312
  switchToThread(threadId: string | null): void;
260
313
  reset({ initialMessages, }?: {
261
314
  initialMessages?: readonly CoreMessage[] | undefined;
262
315
  }): void;
263
316
  }
264
317
 
318
+ declare class LocalRuntime extends AssistantRuntime {
319
+ private core;
320
+ constructor(core: LocalRuntimeCore);
321
+ reset(options?: Parameters<LocalRuntimeCore["reset"]>[0]): void;
322
+ }
265
323
  declare const useLocalRuntime: (adapter: ChatModelAdapter, options?: LocalRuntimeOptions) => LocalRuntime;
266
324
 
267
325
  declare function toLanguageModelMessages(message: readonly CoreMessage[] | readonly ThreadMessage[]): LanguageModelV1Message[];
@@ -361,34 +419,240 @@ type ThreadMessageLike = {
361
419
  attachments?: MessageAttachment[] | undefined;
362
420
  };
363
421
 
364
- type ExternalStoreMessageConverter<T> = (message: T, idx: number) => ThreadMessageLike;
365
- type ExternalStoreMessageConverterAdapter<T> = {
366
- convertMessage: ExternalStoreMessageConverter<T>;
367
- };
368
- type ExternalStoreAdapterBase<T> = {
369
- threadId?: string | undefined;
370
- isDisabled?: boolean | undefined;
371
- isRunning?: boolean | undefined;
372
- messages: T[];
373
- setMessages?: ((messages: T[]) => void) | undefined;
374
- onNew: (message: AppendMessage) => Promise<void>;
375
- onEdit?: ((message: AppendMessage) => Promise<void>) | undefined;
376
- onReload?: ((parentId: string | null) => Promise<void>) | undefined;
377
- onCancel?: (() => Promise<void>) | undefined;
378
- onAddToolResult?: ((options: AddToolResultOptions) => Promise<void> | void) | undefined;
379
- onSwitchToThread?: ((threadId: string) => Promise<void> | void) | undefined;
380
- onSwitchToNewThread?: (() => Promise<void> | void) | undefined;
381
- onSpeak?: ((message: ThreadMessage) => SpeechSynthesisAdapter.Utterance) | undefined;
382
- convertMessage?: ExternalStoreMessageConverter<T> | undefined;
383
- adapters?: {
384
- attachments?: AttachmentAdapter | undefined;
385
- feedback?: FeedbackAdapter | undefined;
386
- };
387
- unstable_capabilities?: {
388
- copy?: boolean | undefined;
389
- } | undefined;
390
- };
391
- type ExternalStoreAdapter<T = ThreadMessage> = ExternalStoreAdapterBase<T> & (T extends ThreadMessage ? object : ExternalStoreMessageConverterAdapter<T>);
422
+ type ExternalStoreMessageConverter<T> = (message: T, idx: number) => ThreadMessageLike;
423
+ type ExternalStoreMessageConverterAdapter<T> = {
424
+ convertMessage: ExternalStoreMessageConverter<T>;
425
+ };
426
+ type ExternalStoreAdapterBase<T> = {
427
+ threadId?: string | undefined;
428
+ isDisabled?: boolean | undefined;
429
+ isRunning?: boolean | undefined;
430
+ messages: T[];
431
+ setMessages?: ((messages: T[]) => void) | undefined;
432
+ onNew: (message: AppendMessage) => Promise<void>;
433
+ onEdit?: ((message: AppendMessage) => Promise<void>) | undefined;
434
+ onReload?: ((parentId: string | null) => Promise<void>) | undefined;
435
+ onCancel?: (() => Promise<void>) | undefined;
436
+ onAddToolResult?: ((options: AddToolResultOptions) => Promise<void> | void) | undefined;
437
+ onSwitchToThread?: ((threadId: string) => Promise<void> | void) | undefined;
438
+ onSwitchToNewThread?: (() => Promise<void> | void) | undefined;
439
+ onSpeak?: ((message: ThreadMessage) => SpeechSynthesisAdapter.Utterance) | undefined;
440
+ convertMessage?: ExternalStoreMessageConverter<T> | undefined;
441
+ adapters?: {
442
+ attachments?: AttachmentAdapter | undefined;
443
+ feedback?: FeedbackAdapter | undefined;
444
+ };
445
+ unstable_capabilities?: {
446
+ copy?: boolean | undefined;
447
+ } | undefined;
448
+ };
449
+ type ExternalStoreAdapter<T = ThreadMessage> = ExternalStoreAdapterBase<T> & (T extends ThreadMessage ? object : ExternalStoreMessageConverterAdapter<T>);
450
+
451
+ declare const useExternalStoreRuntime: <T>(store: ExternalStoreAdapter<T>) => AssistantRuntime<ThreadRuntime>;
452
+
453
+ declare const getExternalStoreMessage: <T>(message: ThreadMessage) => T | undefined;
454
+
455
+ declare namespace useExternalMessageConverter {
456
+ type Message = ThreadMessageLike | {
457
+ role: "tool";
458
+ toolCallId: string;
459
+ toolName?: string | undefined;
460
+ result: any;
461
+ };
462
+ type Callback<T> = (message: T) => Message | Message[];
463
+ }
464
+ declare const useExternalMessageConverter: <T extends WeakKey>({ callback, messages, isRunning, }: {
465
+ callback: useExternalMessageConverter.Callback<T>;
466
+ messages: T[];
467
+ isRunning: boolean;
468
+ }) => ThreadMessage[];
469
+
470
+ type DangerousInBrowserAdapterOptions = CreateEdgeRuntimeAPIOptions;
471
+
472
+ type DangerousInBrowserRuntimeOptions = DangerousInBrowserAdapterOptions & LocalRuntimeOptions;
473
+ declare const useDangerousInBrowserRuntime: ({ initialMessages, ...options }: DangerousInBrowserRuntimeOptions) => LocalRuntime;
474
+
475
+ type Subscribable = {
476
+ subscribe: (callback: () => void) => Unsubscribe;
477
+ };
478
+ type SubscribableWithState<TState> = Subscribable & {
479
+ getState: () => TState;
480
+ };
481
+
482
+ type ContentPartSnapshot = {
483
+ part: ThreadUserContentPart | ThreadAssistantContentPart;
484
+ status: ContentPartStatus | ToolCallContentPartStatus;
485
+ };
486
+ type ContentPartSnapshotBinding = SubscribableWithState<ContentPartSnapshot | undefined>;
487
+ declare class ContentPartRuntime {
488
+ private contentBinding;
489
+ private messageApi;
490
+ private threadApi;
491
+ constructor(contentBinding: ContentPartSnapshotBinding, messageApi: MessageSnapshotBinding, threadApi: ThreadRuntimeCoreBinding);
492
+ getState(): ContentPartSnapshot | undefined;
493
+ addToolResult(result: any): void;
494
+ }
495
+
496
+ type MessageSnapshot = {
497
+ message: ThreadMessage;
498
+ parentId: string | null;
499
+ isLast: boolean;
500
+ /**
501
+ * @deprecated Use `branchNumber` and `branchCount` instead. This will be removed in 0.6.0.
502
+ */
503
+ branches: readonly string[];
504
+ branchNumber: number;
505
+ branchCount: number;
506
+ };
507
+ type MessageSnapshotBinding = SubscribableWithState<MessageSnapshot>;
508
+ type MessageState$1 = ThreadMessage & MessageSnapshot & {
509
+ /**
510
+ * @deprecated You can directly access message fields in the state. Replace `.message.content` with `.content` etc. This will be removed in 0.6.0.
511
+ */
512
+ message: ThreadMessage;
513
+ };
514
+ declare const MessageState$1: new (snapshot: MessageSnapshot) => MessageState$1;
515
+ declare class MessageRuntime {
516
+ private _core;
517
+ private _threadBinding;
518
+ constructor(_core: MessageSnapshotBinding, _threadBinding: ThreadRuntimeCoreBinding);
519
+ getState(): MessageState$1;
520
+ edit(message: Omit<AppendMessage, "parentId">): void;
521
+ reload(): void;
522
+ speak(): void;
523
+ submitFeedback({ type }: {
524
+ type: "positive" | "negative";
525
+ }): void;
526
+ switchToBranch({ position, branchId, }: {
527
+ position?: "previous" | "next" | undefined;
528
+ branchId?: string | undefined;
529
+ }): void;
530
+ subscribe(callback: () => void): Unsubscribe;
531
+ getContentPartByIdx(idx: number): ContentPartRuntime;
532
+ }
533
+
534
+ type ThreadComposerRuntimeCoreBinding = SubscribableWithState<ThreadComposerRuntimeCore>;
535
+ declare class ComposerState {
536
+ private _composerBinding;
537
+ constructor(_composerBinding: ThreadComposerRuntimeCoreBinding);
538
+ get isEmpty(): boolean;
539
+ get text(): string;
540
+ get attachmentAccept(): string;
541
+ get attachments(): ThreadComposerAttachment[];
542
+ }
543
+ declare class ThreadComposerRuntime implements ThreadComposerRuntimeCore {
544
+ private _core;
545
+ constructor(_core: ThreadComposerRuntimeCoreBinding);
546
+ /**
547
+ * @deprecated Use `getState().isEmpty` instead. This will be removed in 0.6.0.
548
+ */
549
+ get isEmpty(): boolean;
550
+ /**
551
+ * @deprecated Use `getState().text` instead. This will be removed in 0.6.0.
552
+ */
553
+ get text(): string;
554
+ /**
555
+ * @deprecated Use `getState().attachmentAccept` instead. This will be removed in 0.6.0.
556
+ */
557
+ get attachmentAccept(): string;
558
+ /**
559
+ * @deprecated Use `getState().attachments` instead. This will be removed in 0.6.0.
560
+ */
561
+ get attachments(): ThreadComposerAttachment[];
562
+ private _state;
563
+ getState(): ComposerState;
564
+ setText(text: string): void;
565
+ addAttachment(file: File): Promise<void>;
566
+ removeAttachment(attachmentId: string): Promise<void>;
567
+ /**
568
+ * @deprecated This method will be removed in 0.6.0. Submit feedback if you need this functionality.
569
+ */
570
+ reset(): void;
571
+ send(): void;
572
+ subscribe(callback: () => void): Unsubscribe;
573
+ }
574
+
575
+ type ThreadRuntimeCoreBinding = SubscribableWithState<ThreadRuntimeCore>;
576
+ declare class ThreadState {
577
+ private _core;
578
+ constructor(_core: ThreadRuntimeCore);
579
+ get threadId(): string;
580
+ get isDisabled(): boolean;
581
+ get isRunning(): boolean;
582
+ get capabilities(): Readonly<RuntimeCapabilities>;
583
+ }
584
+ declare class ThreadRuntime implements ThreadRuntimeCore {
585
+ private _threadBinding;
586
+ /**
587
+ * @deprecated Use `getState().threadId` instead. This will be removed in 0.6.0.
588
+ */
589
+ get threadId(): string;
590
+ /**
591
+ * @deprecated Use `getState().isDisabled` instead. This will be removed in 0.6.0.
592
+ */
593
+ get isDisabled(): boolean;
594
+ /**
595
+ * @deprecated Use `getState().isRunning` instead. This will be removed in 0.6.0.
596
+ */
597
+ get isRunning(): boolean;
598
+ /**
599
+ * @deprecated Use `getState().capabilities` instead. This will be removed in 0.6.0.
600
+ */
601
+ get capabilities(): Readonly<RuntimeCapabilities>;
602
+ get messages(): readonly ThreadMessage[];
603
+ unstable_getCore(): Readonly<{
604
+ getBranches: (messageId: string) => readonly string[];
605
+ switchToBranch: (branchId: string) => void;
606
+ append: (message: AppendMessage) => void;
607
+ startRun: (parentId: string | null) => void;
608
+ cancelRun: () => void;
609
+ addToolResult: (options: AddToolResultOptions) => void;
610
+ speak: (messageId: string) => SpeechSynthesisAdapter.Utterance;
611
+ submitFeedback: (feedback: SubmitFeedbackOptions) => void;
612
+ getModelConfig: () => ModelConfig;
613
+ composer: ThreadComposerRuntimeCore;
614
+ capabilities: Readonly<RuntimeCapabilities>;
615
+ threadId: string;
616
+ isDisabled: boolean;
617
+ messages: readonly ThreadMessage[];
618
+ subscribe: (callback: () => void) => Unsubscribe;
619
+ import(repository: ExportedMessageRepository): void;
620
+ export(): ExportedMessageRepository;
621
+ }>;
622
+ constructor(_threadBinding: ThreadRuntimeCoreBinding);
623
+ readonly composer: ThreadComposerRuntime;
624
+ getState(): ThreadState;
625
+ append(message: AppendMessage): void;
626
+ subscribe(callback: () => void): Unsubscribe;
627
+ getBranches(messageId: string): readonly string[];
628
+ getModelConfig(): ModelConfig;
629
+ startRun(parentId: string | null): void;
630
+ cancelRun(): void;
631
+ addToolResult(options: AddToolResultOptions): void;
632
+ switchToBranch(branchId: string): void;
633
+ speak(messageId: string): SpeechSynthesisAdapter.Utterance;
634
+ submitFeedback(options: SubmitFeedbackOptions): void;
635
+ export(): ExportedMessageRepository;
636
+ import(data: ExportedMessageRepository): void;
637
+ unstable_getMesssageByIndex(idx: number): MessageRuntime;
638
+ }
639
+
640
+ declare class AssistantRuntime<TThreadRuntime extends ThreadRuntime = ThreadRuntime> implements AssistantRuntimeCore {
641
+ private _core;
642
+ constructor(_core: AssistantRuntimeCore, CustomThreadRuntime: new (binding: ThreadRuntimeCoreBinding) => TThreadRuntime);
643
+ readonly thread: TThreadRuntime;
644
+ switchToNewThread(): void;
645
+ switchToThread(threadId: string): void;
646
+ /**
647
+ * @deprecated Use `switchToNewThread` instead. This will be removed in 0.6.0.
648
+ */
649
+ switchToThread(threadId: string | null): void;
650
+ registerModelConfigProvider(provider: ModelConfigProvider): Unsubscribe;
651
+ /**
652
+ * @deprecated Thread is now static and never gets updated. This will be removed in 0.6.0.
653
+ */
654
+ subscribe(callback: () => void): Unsubscribe;
655
+ }
392
656
 
393
657
  declare class ProxyConfigProvider implements ModelConfigProvider {
394
658
  private _providers;
@@ -488,149 +752,27 @@ declare const TooltipIconButton: react.ForwardRefExoticComponent<Omit<Omit<react
488
752
 
489
753
  declare const generateId: (size?: number) => string;
490
754
 
491
- type internal_BaseAssistantRuntime<TThreadRuntime extends ReactThreadRuntime> = BaseAssistantRuntime<TThreadRuntime>;
492
- declare const internal_BaseAssistantRuntime: typeof BaseAssistantRuntime;
755
+ type internal_AssistantRuntime<TThreadRuntime extends ThreadRuntime = ThreadRuntime> = AssistantRuntime<TThreadRuntime>;
756
+ declare const internal_AssistantRuntime: typeof AssistantRuntime;
757
+ type internal_BaseAssistantRuntimeCore<TThreadRuntime extends ReactThreadRuntimeCore> = BaseAssistantRuntimeCore<TThreadRuntime>;
758
+ declare const internal_BaseAssistantRuntimeCore: typeof BaseAssistantRuntimeCore;
493
759
  type internal_MessageRepository = MessageRepository;
494
760
  declare const internal_MessageRepository: typeof MessageRepository;
495
761
  type internal_ProxyConfigProvider = ProxyConfigProvider;
496
762
  declare const internal_ProxyConfigProvider: typeof ProxyConfigProvider;
497
- type internal_ThreadRuntimeComposer = ThreadRuntimeComposer;
498
- declare const internal_ThreadRuntimeComposer: typeof ThreadRuntimeComposer;
763
+ type internal_ReactThreadRuntimeCore = ReactThreadRuntimeCore;
764
+ type internal_ThreadRuntime = ThreadRuntime;
765
+ declare const internal_ThreadRuntime: typeof ThreadRuntime;
766
+ type internal_ThreadRuntimeCoreBinding = ThreadRuntimeCoreBinding;
499
767
  declare const internal_TooltipIconButton: typeof TooltipIconButton;
500
768
  declare const internal_generateId: typeof generateId;
501
769
  declare const internal_useSmooth: typeof useSmooth;
502
770
  declare const internal_useSmoothStatus: typeof useSmoothStatus;
503
771
  declare const internal_withSmoothContextProvider: typeof withSmoothContextProvider;
504
772
  declare namespace internal {
505
- export { internal_BaseAssistantRuntime as BaseAssistantRuntime, internal_MessageRepository as MessageRepository, internal_ProxyConfigProvider as ProxyConfigProvider, internal_ThreadRuntimeComposer as ThreadRuntimeComposer, internal_TooltipIconButton as TooltipIconButton, internal_generateId as generateId, internal_useSmooth as useSmooth, internal_useSmoothStatus as useSmoothStatus, internal_withSmoothContextProvider as withSmoothContextProvider };
506
- }
507
-
508
- type ConverterCallback<TIn> = (cache: ThreadMessage | undefined, message: TIn, idx: number) => ThreadMessage;
509
- declare class ThreadMessageConverter {
510
- private readonly cache;
511
- convertMessages<TIn extends WeakKey>(messages: TIn[], converter: ConverterCallback<TIn>): ThreadMessage[];
512
- }
513
-
514
- declare class ExternalStoreThreadRuntime implements ReactThreadRuntime {
515
- private configProvider;
516
- private _subscriptions;
517
- private repository;
518
- private assistantOptimisticId;
519
- private _capabilities;
520
- get capabilities(): RuntimeCapabilities;
521
- threadId: string;
522
- messages: ThreadMessage[];
523
- isDisabled: boolean;
524
- converter: ThreadMessageConverter;
525
- private _store;
526
- readonly composer: ThreadRuntimeComposer;
527
- constructor(configProvider: ModelConfigProvider, store: ExternalStoreAdapter<any>);
528
- get store(): ExternalStoreAdapter<any>;
529
- set store(store: ExternalStoreAdapter<any>);
530
- getModelConfig(): ModelConfig;
531
- private notifySubscribers;
532
- getBranches(messageId: string): string[];
533
- switchToBranch(branchId: string): void;
534
- append(message: AppendMessage): Promise<void>;
535
- startRun(parentId: string | null): Promise<void>;
536
- cancelRun(): void;
537
- addToolResult(options: AddToolResultOptions): void;
538
- speak(messageId: string): SpeechSynthesisAdapter.Utterance;
539
- submitFeedback({ messageId, type }: SubmitFeedbackOptions): void;
540
- subscribe(callback: () => void): Unsubscribe;
541
- private updateMessages;
542
- }
543
-
544
- declare class ExternalStoreRuntime extends BaseAssistantRuntime<ExternalStoreThreadRuntime> {
545
- private readonly _proxyConfigProvider;
546
- constructor(store: ExternalStoreAdapter<any>);
547
- get store(): ExternalStoreAdapter<any>;
548
- set store(store: ExternalStoreAdapter<any>);
549
- getModelConfig(): ModelConfig;
550
- registerModelConfigProvider(provider: ModelConfigProvider): () => void;
551
- switchToNewThread(): Promise<void>;
552
- switchToThread(threadId: string | null): Promise<void>;
773
+ export { internal_AssistantRuntime as AssistantRuntime, internal_BaseAssistantRuntimeCore as BaseAssistantRuntimeCore, BaseThreadComposerRuntimeCore as BaseThreadRuntimeComposerCore, internal_MessageRepository as MessageRepository, internal_ProxyConfigProvider as ProxyConfigProvider, type internal_ReactThreadRuntimeCore as ReactThreadRuntimeCore, internal_ThreadRuntime as ThreadRuntime, 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 };
553
774
  }
554
775
 
555
- declare const useExternalStoreRuntime: <T>(store: ExternalStoreAdapter<T>) => ExternalStoreRuntime;
556
-
557
- declare const getExternalStoreMessage: <T>(message: ThreadMessage) => T | undefined;
558
-
559
- declare namespace useExternalMessageConverter {
560
- type Message = ThreadMessageLike | {
561
- role: "tool";
562
- toolCallId: string;
563
- toolName?: string | undefined;
564
- result: any;
565
- };
566
- type Callback<T> = (message: T) => Message | Message[];
567
- }
568
- declare const useExternalMessageConverter: <T extends WeakKey>({ callback, messages, isRunning, }: {
569
- callback: useExternalMessageConverter.Callback<T>;
570
- messages: T[];
571
- isRunning: boolean;
572
- }) => ThreadMessage[];
573
-
574
- type DangerousInBrowserAdapterOptions = CreateEdgeRuntimeAPIOptions;
575
-
576
- type DangerousInBrowserRuntimeOptions = DangerousInBrowserAdapterOptions & LocalRuntimeOptions;
577
- declare const useDangerousInBrowserRuntime: ({ initialMessages, ...options }: DangerousInBrowserRuntimeOptions) => LocalRuntime;
578
-
579
- type ThreadRuntimeStore = ThreadRuntime;
580
-
581
- type ThreadState = Readonly<{
582
- capabilities: Readonly<RuntimeCapabilities>;
583
- threadId: string;
584
- isRunning: boolean;
585
- isDisabled: boolean;
586
- }>;
587
- type RuntimeCapabilities = {
588
- switchToBranch: boolean;
589
- edit: boolean;
590
- reload: boolean;
591
- cancel: boolean;
592
- unstable_copy: boolean;
593
- speak: boolean;
594
- attachments: boolean;
595
- feedback: boolean;
596
- };
597
-
598
- type ThreadRuntime = ThreadActionsState & Readonly<{
599
- composer: ThreadRuntime.Composer;
600
- capabilities: Readonly<RuntimeCapabilities>;
601
- threadId: string;
602
- isDisabled: boolean;
603
- messages: readonly ThreadMessage[];
604
- subscribe: (callback: () => void) => Unsubscribe;
605
- }>;
606
- declare namespace ThreadRuntime {
607
- type Composer = Readonly<{
608
- attachmentAccept: string;
609
- attachments: ThreadComposerAttachment[];
610
- addAttachment: (file: File) => Promise<void>;
611
- removeAttachment: (attachmentId: string) => Promise<void>;
612
- isEmpty: boolean;
613
- text: string;
614
- setText: (value: string) => void;
615
- reset: () => void;
616
- send: () => void;
617
- }>;
618
- }
619
-
620
- type ThreadRuntimeWithSubscribe = {
621
- readonly thread: ThreadRuntime;
622
- subscribe: (callback: () => void) => Unsubscribe;
623
- };
624
- type AssistantRuntime = ThreadRuntimeWithSubscribe & {
625
- switchToNewThread: () => void;
626
- /**
627
- * @deprecated Use `switchToNewThread` instead. This will be removed in 0.6.0.
628
- */
629
- switchToThread(threadId: null): void;
630
- switchToThread(threadId: string): void;
631
- registerModelConfigProvider: (provider: ModelConfigProvider) => Unsubscribe;
632
- };
633
-
634
776
  type AssistantRuntimeProviderProps = {
635
777
  runtime: AssistantRuntime;
636
778
  };
@@ -642,16 +784,6 @@ type TextContentPartProviderProps = {
642
784
  };
643
785
  declare const TextContentPartProvider: FC<PropsWithChildren<TextContentPartProviderProps>>;
644
786
 
645
- type AssistantActionsState = Readonly<{
646
- /**
647
- * @deprecated Use `switchToNewThread` instead. This will be removed in 0.6.0.
648
- */
649
- switchToThread(threadId: null): void;
650
- switchToThread(threadId: string): void;
651
- switchToNewThread: () => void;
652
- registerModelConfigProvider: (provider: ModelConfigProvider) => Unsubscribe;
653
- }>;
654
-
655
787
  type AssistantToolUIsState = Readonly<{
656
788
  getToolUI: (toolName: string) => ToolCallContentPartComponent | null;
657
789
  setToolUI: (toolName: string, render: ToolCallContentPartComponent) => () => void;
@@ -660,7 +792,10 @@ type AssistantToolUIsState = Readonly<{
660
792
  type AssistantContextValue = {
661
793
  useToolUIs: UseBoundStore<ReadonlyStore<AssistantToolUIsState>>;
662
794
  useAssistantRuntime: UseBoundStore<ReadonlyStore<AssistantRuntime>>;
663
- useAssistantActions: UseBoundStore<ReadonlyStore<AssistantActionsState>>;
795
+ /**
796
+ * @deprecated Use `useAssistantRuntime` instead. This will be removed in 0.6.0.
797
+ */
798
+ useAssistantActions: UseBoundStore<ReadonlyStore<AssistantRuntime>>;
664
799
  };
665
800
  declare const useAssistantContext: {
666
801
  (options?: {
@@ -670,22 +805,43 @@ declare const useAssistantContext: {
670
805
  optional?: boolean | undefined;
671
806
  } | undefined): AssistantContextValue | null;
672
807
  };
673
- declare const useAssistantRuntime: {
674
- (): AssistantRuntime;
675
- <TSelected>(selector: (state: AssistantRuntime) => TSelected): TSelected;
808
+ declare function useAssistantRuntime(options?: {
809
+ optional?: false | undefined;
810
+ }): AssistantRuntime;
811
+ declare function useAssistantRuntime(options?: {
812
+ optional?: boolean | undefined;
813
+ }): AssistantRuntime | null;
814
+ /**
815
+ * @deprecated Use `useAssistantRuntime` instead. This will be removed in 0.6.0.
816
+ */
817
+ declare const useAssistantActionsStore: {
818
+ (): ReadonlyStore<AssistantRuntime<ThreadRuntime>>;
819
+ (options: {
820
+ optional: true;
821
+ }): ReadonlyStore<AssistantRuntime<ThreadRuntime>> | null;
822
+ };
823
+ /**
824
+ * @deprecated Use `useAssistantRuntime` instead. This will be removed in 0.6.0.
825
+ */
826
+ declare const useAssistantActions: {
827
+ (): AssistantRuntime<ThreadRuntime>;
828
+ <TSelected>(selector: (state: AssistantRuntime<ThreadRuntime>) => TSelected): TSelected;
676
829
  (options: {
677
830
  optional: true;
678
- }): AssistantRuntime | null;
831
+ }): AssistantRuntime<ThreadRuntime> | null;
679
832
  <TSelected>(options: {
680
833
  optional: true;
681
- selector?: (state: AssistantRuntime) => TSelected;
834
+ selector?: (state: AssistantRuntime<ThreadRuntime>) => TSelected;
682
835
  }): TSelected | null;
683
836
  };
837
+ /**
838
+ * @deprecated Use `useAssistantRuntime` instead. This will be removed in 0.6.0.
839
+ */
684
840
  declare const useAssistantRuntimeStore: {
685
- (): ReadonlyStore<AssistantRuntime>;
841
+ (): ReadonlyStore<AssistantRuntime<ThreadRuntime>>;
686
842
  (options: {
687
843
  optional: true;
688
- }): ReadonlyStore<AssistantRuntime> | null;
844
+ }): ReadonlyStore<AssistantRuntime<ThreadRuntime>> | null;
689
845
  };
690
846
  declare const useToolUIs: {
691
847
  (): Readonly<{
@@ -722,53 +878,6 @@ declare const useToolUIsStore: {
722
878
  setToolUI: (toolName: string, render: ToolCallContentPartComponent) => () => void;
723
879
  }>> | null;
724
880
  };
725
- declare const useAssistantActions: {
726
- (): Readonly<{
727
- switchToThread(threadId: null): void;
728
- switchToThread(threadId: string): void;
729
- switchToNewThread: () => void;
730
- registerModelConfigProvider: (provider: ModelConfigProvider) => Unsubscribe;
731
- }>;
732
- <TSelected>(selector: (state: Readonly<{
733
- switchToThread(threadId: null): void;
734
- switchToThread(threadId: string): void;
735
- switchToNewThread: () => void;
736
- registerModelConfigProvider: (provider: ModelConfigProvider) => Unsubscribe;
737
- }>) => TSelected): TSelected;
738
- (options: {
739
- optional: true;
740
- }): Readonly<{
741
- switchToThread(threadId: null): void;
742
- switchToThread(threadId: string): void;
743
- switchToNewThread: () => void;
744
- registerModelConfigProvider: (provider: ModelConfigProvider) => Unsubscribe;
745
- }> | null;
746
- <TSelected>(options: {
747
- optional: true;
748
- selector?: (state: Readonly<{
749
- switchToThread(threadId: null): void;
750
- switchToThread(threadId: string): void;
751
- switchToNewThread: () => void;
752
- registerModelConfigProvider: (provider: ModelConfigProvider) => Unsubscribe;
753
- }>) => TSelected;
754
- }): TSelected | null;
755
- };
756
- declare const useAssistantActionsStore: {
757
- (): ReadonlyStore<Readonly<{
758
- switchToThread(threadId: null): void;
759
- switchToThread(threadId: string): void;
760
- switchToNewThread: () => void;
761
- registerModelConfigProvider: (provider: ModelConfigProvider) => Unsubscribe;
762
- }>>;
763
- (options: {
764
- optional: true;
765
- }): ReadonlyStore<Readonly<{
766
- switchToThread(threadId: null): void;
767
- switchToThread(threadId: string): void;
768
- switchToNewThread: () => void;
769
- registerModelConfigProvider: (provider: ModelConfigProvider) => Unsubscribe;
770
- }>> | null;
771
- };
772
881
 
773
882
  type ThreadViewportState = Readonly<{
774
883
  isAtBottom: boolean;
@@ -779,10 +888,13 @@ type ThreadViewportState = Readonly<{
779
888
  type ThreadMessagesState = readonly ThreadMessage[];
780
889
 
781
890
  type ThreadContextValue = {
782
- useThread: UseBoundStore<ReadonlyStore<ThreadState>>;
783
- useThreadRuntime: UseBoundStore<ReadonlyStore<ThreadRuntimeStore>>;
891
+ useThread: UseBoundStore<ReadonlyStore<ThreadState$1>>;
892
+ /**
893
+ * @deprecated Use `useThreadRuntime` instead. This will be removed in 0.6.0.
894
+ */
895
+ useThreadActions: UseBoundStore<ReadonlyStore<ThreadRuntime>>;
896
+ useThreadRuntime: UseBoundStore<ReadonlyStore<ThreadRuntime>>;
784
897
  useThreadMessages: UseBoundStore<ReadonlyStore<ThreadMessagesState>>;
785
- useThreadActions: UseBoundStore<ReadonlyStore<ThreadActionsState>>;
786
898
  useComposer: UseBoundStore<ReadonlyStore<ThreadComposerState>>;
787
899
  useViewport: UseBoundStore<ReadonlyStore<ThreadViewportState>>;
788
900
  };
@@ -794,7 +906,25 @@ declare const useThreadContext: {
794
906
  optional?: boolean | undefined;
795
907
  } | undefined): ThreadContextValue | null;
796
908
  };
797
- declare const useThreadRuntime: {
909
+ declare function useThreadRuntime(options?: {
910
+ optional?: false | undefined;
911
+ }): ThreadRuntime;
912
+ declare function useThreadRuntime(options?: {
913
+ optional?: boolean | undefined;
914
+ }): ThreadRuntime | null;
915
+ /**
916
+ * @deprecated Use `useThreadRuntime` instead. This will be removed in 0.6.0.
917
+ */
918
+ declare const useThreadActionsStore: {
919
+ (): ReadonlyStore<ThreadRuntime>;
920
+ (options: {
921
+ optional: true;
922
+ }): ReadonlyStore<ThreadRuntime> | null;
923
+ };
924
+ /**
925
+ * @deprecated Use `useThreadRuntime` instead. This will be removed in 0.6.0.
926
+ */
927
+ declare const useThreadActions: {
798
928
  (): ThreadRuntime;
799
929
  <TSelected>(selector: (state: ThreadRuntime) => TSelected): TSelected;
800
930
  (options: {
@@ -805,6 +935,9 @@ declare const useThreadRuntime: {
805
935
  selector?: (state: ThreadRuntime) => TSelected;
806
936
  }): TSelected | null;
807
937
  };
938
+ /**
939
+ * @deprecated Use `useThreadRuntime` instead. This will be removed in 0.6.0.
940
+ */
808
941
  declare const useThreadRuntimeStore: {
809
942
  (): ReadonlyStore<ThreadRuntime>;
810
943
  (options: {
@@ -875,83 +1008,6 @@ declare const useThreadMessagesStore: {
875
1008
  optional: true;
876
1009
  }): ReadonlyStore<ThreadMessagesState> | null;
877
1010
  };
878
- declare const useThreadActions: {
879
- (): Readonly<{
880
- getBranches: (messageId: string) => readonly string[];
881
- switchToBranch: (branchId: string) => void;
882
- append: (message: AppendMessage) => void;
883
- startRun: (parentId: string | null) => void;
884
- cancelRun: () => void;
885
- addToolResult: (options: AddToolResultOptions) => void;
886
- speak: (messageId: string) => SpeechSynthesisAdapter.Utterance;
887
- submitFeedback: (feedback: SubmitFeedbackOptions) => void;
888
- getModelConfig: () => ModelConfig;
889
- }>;
890
- <TSelected>(selector: (state: Readonly<{
891
- getBranches: (messageId: string) => readonly string[];
892
- switchToBranch: (branchId: string) => void;
893
- append: (message: AppendMessage) => void;
894
- startRun: (parentId: string | null) => void;
895
- cancelRun: () => void;
896
- addToolResult: (options: AddToolResultOptions) => void;
897
- speak: (messageId: string) => SpeechSynthesisAdapter.Utterance;
898
- submitFeedback: (feedback: SubmitFeedbackOptions) => void;
899
- getModelConfig: () => ModelConfig;
900
- }>) => TSelected): TSelected;
901
- (options: {
902
- optional: true;
903
- }): Readonly<{
904
- getBranches: (messageId: string) => readonly string[];
905
- switchToBranch: (branchId: string) => void;
906
- append: (message: AppendMessage) => void;
907
- startRun: (parentId: string | null) => void;
908
- cancelRun: () => void;
909
- addToolResult: (options: AddToolResultOptions) => void;
910
- speak: (messageId: string) => SpeechSynthesisAdapter.Utterance;
911
- submitFeedback: (feedback: SubmitFeedbackOptions) => void;
912
- getModelConfig: () => ModelConfig;
913
- }> | null;
914
- <TSelected>(options: {
915
- optional: true;
916
- selector?: (state: Readonly<{
917
- getBranches: (messageId: string) => readonly string[];
918
- switchToBranch: (branchId: string) => void;
919
- append: (message: AppendMessage) => void;
920
- startRun: (parentId: string | null) => void;
921
- cancelRun: () => void;
922
- addToolResult: (options: AddToolResultOptions) => void;
923
- speak: (messageId: string) => SpeechSynthesisAdapter.Utterance;
924
- submitFeedback: (feedback: SubmitFeedbackOptions) => void;
925
- getModelConfig: () => ModelConfig;
926
- }>) => TSelected;
927
- }): TSelected | null;
928
- };
929
- declare const useThreadActionsStore: {
930
- (): ReadonlyStore<Readonly<{
931
- getBranches: (messageId: string) => readonly string[];
932
- switchToBranch: (branchId: string) => void;
933
- append: (message: AppendMessage) => void;
934
- startRun: (parentId: string | null) => void;
935
- cancelRun: () => void;
936
- addToolResult: (options: AddToolResultOptions) => void;
937
- speak: (messageId: string) => SpeechSynthesisAdapter.Utterance;
938
- submitFeedback: (feedback: SubmitFeedbackOptions) => void;
939
- getModelConfig: () => ModelConfig;
940
- }>>;
941
- (options: {
942
- optional: true;
943
- }): ReadonlyStore<Readonly<{
944
- getBranches: (messageId: string) => readonly string[];
945
- switchToBranch: (branchId: string) => void;
946
- append: (message: AppendMessage) => void;
947
- startRun: (parentId: string | null) => void;
948
- cancelRun: () => void;
949
- addToolResult: (options: AddToolResultOptions) => void;
950
- speak: (messageId: string) => SpeechSynthesisAdapter.Utterance;
951
- submitFeedback: (feedback: SubmitFeedbackOptions) => void;
952
- getModelConfig: () => ModelConfig;
953
- }>> | null;
954
- };
955
1011
  declare const useThreadComposer: {
956
1012
  (): Readonly<{
957
1013
  type: "thread";
@@ -2432,4 +2488,4 @@ declare const exports: {
2432
2488
  Text: FC;
2433
2489
  };
2434
2490
 
2435
- 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 AssistantActionsState, type AssistantContextValue, _default$a as AssistantMessage, type AssistantMessageConfig, type AssistantMessageContentProps, _default$9 as AssistantModal, index$5 as AssistantModalPrimitive, type AssistantModalPrimitiveContentProps, type AssistantModalPrimitiveRootProps, type AssistantModalPrimitiveTriggerProps, type 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, type ContentPartState, CoreMessage, type DangerousInBrowserRuntimeOptions, EdgeChatAdapter, type EdgeRuntimeOptions, _default$5 as EditComposer, type EditComposerState, type EmptyContentPartComponent, type EmptyContentPartProps, type ExternalStoreAdapter, type ExternalStoreMessageConverter, ExternalStoreRuntime, internal as INTERNAL, ImageContentPart, type ImageContentPartComponent, type ImageContentPartProps, type LocalRuntimeOptions, type MessageContextValue, index$1 as MessagePrimitive, type MessagePrimitiveContentProps, type MessagePrimitiveIfProps, type MessagePrimitiveInProgressProps, type MessagePrimitiveRootProps, type MessageState, MessageStatus, type MessageUtilsState, ModelConfig, ModelConfigProvider, type ReactThreadRuntime, SimpleImageAttachmentAdapter, SimpleTextAttachmentAdapter, SpeechSynthesisAdapter, StreamUtils, type StringsConfig, type SuggestionConfig, TextContentPart, type TextContentPartComponent, type TextContentPartProps, TextContentPartProvider, _default$4 as Thread, type ThreadActionsState, ThreadAssistantContentPart, type ThreadComposerState, type ThreadConfig, ThreadConfigProvider, type ThreadConfigProviderProps, type ThreadContextValue, ThreadMessage, type ThreadMessageLike, type ThreadMessagesState, index as ThreadPrimitive, type ThreadPrimitiveEmptyProps, type ThreadPrimitiveIfProps, type ThreadPrimitiveMessagesProps, type ThreadPrimitiveRootProps, type ThreadPrimitiveScrollToBottomProps, type ThreadPrimitiveSuggestionProps, type ThreadPrimitiveViewportProps, type ThreadRootProps, ThreadRuntime, type ThreadState, 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, useComposerSend, useComposerStore, useContentPart, useContentPartContext, useContentPartDisplay, useContentPartImage, useContentPartStore, useContentPartText, useDangerousInBrowserRuntime, useEdgeRuntime, useEditComposer, useEditComposerStore, useExternalMessageConverter, useExternalStoreRuntime, useLocalRuntime, useMessage, useMessageContext, useMessageIf, useMessageStore, useMessageUtils, useMessageUtilsStore, useSwitchToNewThread, useThread, useThreadActions, useThreadActionsStore, useThreadComposer, useThreadComposerStore, useThreadConfig, useThreadContext, useThreadEmpty, useThreadIf, useThreadMessages, useThreadMessagesStore, useThreadRuntime, useThreadRuntimeStore, useThreadScrollToBottom, useThreadStore, useThreadSuggestion, useThreadViewport, useThreadViewportStore, useToolUIs, useToolUIsStore };
2491
+ 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, type ContentPartState, CoreMessage, type DangerousInBrowserRuntimeOptions, EdgeChatAdapter, type EdgeRuntimeOptions, _default$5 as EditComposer, 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, SimpleImageAttachmentAdapter, SimpleTextAttachmentAdapter, SpeechSynthesisAdapter, StreamUtils, type StringsConfig, type SubmitFeedbackOptions, type SuggestionConfig, TextContentPart, type TextContentPartComponent, type TextContentPartProps, TextContentPartProvider, _default$4 as Thread, ThreadAssistantContentPart, ThreadComposerRuntime, type ThreadComposerState, type ThreadConfig, ThreadConfigProvider, type ThreadConfigProviderProps, type ThreadContextValue, ThreadMessage, type ThreadMessageLike, type ThreadMessagesState, index as ThreadPrimitive, type ThreadPrimitiveEmptyProps, type ThreadPrimitiveIfProps, type ThreadPrimitiveMessagesProps, type ThreadPrimitiveRootProps, type ThreadPrimitiveScrollToBottomProps, type ThreadPrimitiveSuggestionProps, type ThreadPrimitiveViewportProps, type ThreadRootProps, ThreadRuntime, type ThreadState$1 as 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, useComposerSend, useComposerStore, useContentPart, useContentPartContext, useContentPartDisplay, useContentPartImage, useContentPartStore, useContentPartText, useDangerousInBrowserRuntime, useEdgeRuntime, useEditComposer, useEditComposerStore, useExternalMessageConverter, useExternalStoreRuntime, useLocalRuntime, useMessage, useMessageContext, useMessageIf, useMessageStore, useMessageUtils, useMessageUtilsStore, useSwitchToNewThread, useThread, useThreadActions, useThreadActionsStore, useThreadComposer, useThreadComposerStore, useThreadConfig, useThreadContext, useThreadEmpty, useThreadIf, useThreadMessages, useThreadMessagesStore, useThreadRuntime, useThreadRuntimeStore, useThreadScrollToBottom, useThreadStore, useThreadSuggestion, useThreadViewport, useThreadViewportStore, useToolUIs, useToolUIsStore };