@assistant-ui/react 0.5.82 → 0.5.83
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/{edge-8bY1SEQ-.d.mts → edge-B3YIacNl.d.mts} +1 -1
- package/dist/{edge-8bY1SEQ-.d.ts → edge-B3YIacNl.d.ts} +1 -1
- package/dist/index.d.mts +1758 -725
- package/dist/index.d.ts +1758 -725
- package/dist/index.js +467 -237
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +399 -169
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
-
import { A as Attachment$1, U as Unsubscribe, 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 ThreadStep, f as PendingAttachmentStatus, g as CompleteAttachment, h as CompleteAttachmentStatus, i as
|
2
|
-
export { r as AttachmentStatus, w as CoreAssistantContentPart, z as CoreAssistantMessage, x as CoreSystemMessage, v as CoreUserContentPart, y as CoreUserMessage, E as EdgeRuntimeRequestOptions, t as ThreadAssistantMessage, s as ThreadSystemMessage, u as ThreadUserMessage } from './edge-
|
1
|
+
import { A as Attachment$1, U as Unsubscribe, 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 ThreadStep, f as PendingAttachmentStatus, g as CompleteAttachment, h as CompleteAttachmentStatus, i as TextContentPart, j as Tool, I as ImageContentPart, k as ToolCallContentPart, l as CoreToolCallContentPart, m as UIContentPart, n as CreateEdgeRuntimeAPIOptions, o as ThreadUserContentPart, p as ContentPartStatus, q as ToolCallContentPartStatus } from './edge-B3YIacNl.mjs';
|
2
|
+
export { r as AttachmentStatus, w as CoreAssistantContentPart, z as CoreAssistantMessage, x as CoreSystemMessage, v as CoreUserContentPart, y as CoreUserMessage, E as EdgeRuntimeRequestOptions, t as ThreadAssistantMessage, s as ThreadSystemMessage, u as ThreadUserMessage } from './edge-B3YIacNl.mjs';
|
3
3
|
import * as react from 'react';
|
4
4
|
import { ComponentType, PropsWithChildren, FC, ElementRef, ComponentPropsWithoutRef, ElementType, ReactNode } from 'react';
|
5
5
|
import { StoreApi, UseBoundStore } from 'zustand';
|
@@ -115,7 +115,7 @@ type SpeechState = Readonly<{
|
|
115
115
|
type SubmittedFeedback = Readonly<{
|
116
116
|
type: "negative" | "positive";
|
117
117
|
}>;
|
118
|
-
type ThreadRuntimeEventType = "switched-to" | "run-start" | "model-config-update";
|
118
|
+
type ThreadRuntimeEventType = "switched-to" | "switched-away" | "run-start" | "model-config-update";
|
119
119
|
type ThreadRuntimeCore = Readonly<{
|
120
120
|
getMessageById: (messageId: string) => {
|
121
121
|
parentId: string | null;
|
@@ -148,16 +148,26 @@ type ThreadRuntimeCore = Readonly<{
|
|
148
148
|
unstable_on(event: ThreadRuntimeEventType, callback: () => void): Unsubscribe;
|
149
149
|
}>;
|
150
150
|
|
151
|
-
type
|
152
|
-
|
153
|
-
|
151
|
+
type ThreadManagerMetadata = {
|
152
|
+
threadId: string;
|
153
|
+
title?: string;
|
154
|
+
};
|
155
|
+
type ThreadManagerRuntimeCore = {
|
156
|
+
mainThread: ThreadRuntimeCore;
|
157
|
+
threads: readonly ThreadManagerMetadata[];
|
158
|
+
archivedThreads: readonly ThreadManagerMetadata[];
|
154
159
|
switchToThread(threadId: string): void;
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
160
|
+
switchToNewThread(): void;
|
161
|
+
rename(threadId: string, newTitle: string): Promise<void>;
|
162
|
+
archive(threadId: string): Promise<void>;
|
163
|
+
unarchive(threadId: string): Promise<void>;
|
164
|
+
delete(threadId: string): Promise<void>;
|
165
|
+
subscribe(callback: () => void): Unsubscribe;
|
166
|
+
};
|
167
|
+
|
168
|
+
type AssistantRuntimeCore = {
|
169
|
+
readonly threadManager: ThreadManagerRuntimeCore;
|
159
170
|
registerModelConfigProvider: (provider: ModelConfigProvider) => Unsubscribe;
|
160
|
-
subscribe: (callback: () => void) => Unsubscribe;
|
161
171
|
};
|
162
172
|
|
163
173
|
/**
|
@@ -194,26 +204,21 @@ type ChatModelAdapter = {
|
|
194
204
|
run: (options: ChatModelRunOptions) => Promise<ChatModelRunResult> | AsyncGenerator<ChatModelRunResult, void>;
|
195
205
|
};
|
196
206
|
|
197
|
-
declare
|
198
|
-
private
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
abstract switchToThread(threadId: string | null): void;
|
205
|
-
private _subscriptions;
|
206
|
-
subscribe(callback: () => void): Unsubscribe;
|
207
|
-
private subscriptionHandler;
|
207
|
+
declare class ProxyConfigProvider implements ModelConfigProvider {
|
208
|
+
private _providers;
|
209
|
+
getModelConfig(): ModelConfig;
|
210
|
+
registerModelConfigProvider(provider: ModelConfigProvider): () => void;
|
211
|
+
private _subscribers;
|
212
|
+
notifySubscribers(): void;
|
213
|
+
subscribe(callback: () => void): () => boolean;
|
208
214
|
}
|
209
215
|
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
};
|
216
|
+
declare abstract class BaseAssistantRuntimeCore implements AssistantRuntimeCore {
|
217
|
+
protected readonly _proxyConfigProvider: ProxyConfigProvider;
|
218
|
+
abstract get threadManager(): ThreadManagerRuntimeCore;
|
219
|
+
constructor();
|
220
|
+
registerModelConfigProvider(provider: ModelConfigProvider): Unsubscribe;
|
221
|
+
}
|
217
222
|
|
218
223
|
type AttachmentAdapter = {
|
219
224
|
accept: string;
|
@@ -228,18 +233,30 @@ type AttachmentAdapter = {
|
|
228
233
|
}>;
|
229
234
|
};
|
230
235
|
|
231
|
-
type
|
232
|
-
|
236
|
+
type FeedbackAdapterFeedback = {
|
237
|
+
message: ThreadMessage;
|
238
|
+
type: "positive" | "negative";
|
239
|
+
};
|
240
|
+
type FeedbackAdapter = {
|
241
|
+
submit: (feedback: FeedbackAdapterFeedback) => void;
|
242
|
+
};
|
243
|
+
|
244
|
+
type LocalRuntimeOptionsBase = {
|
233
245
|
maxSteps?: number | undefined;
|
234
246
|
/**
|
235
247
|
* @deprecated Use `maxSteps` (which is `maxToolRoundtrips` + 1; if you set `maxToolRoundtrips` to 2, set `maxSteps` to 3) instead. This field will be removed in v0.6.
|
236
248
|
*/
|
237
249
|
maxToolRoundtrips?: number | undefined;
|
238
|
-
adapters
|
250
|
+
adapters: {
|
251
|
+
chatModel: ChatModelAdapter;
|
239
252
|
attachments?: AttachmentAdapter | undefined;
|
240
253
|
speech?: SpeechSynthesisAdapter | undefined;
|
241
254
|
feedback?: FeedbackAdapter | undefined;
|
242
|
-
}
|
255
|
+
};
|
256
|
+
};
|
257
|
+
type LocalRuntimeOptions = Omit<LocalRuntimeOptionsBase, "adapters"> & {
|
258
|
+
initialMessages?: readonly CoreMessage[] | undefined;
|
259
|
+
adapters?: Omit<LocalRuntimeOptionsBase["adapters"], "chatModel"> | undefined;
|
243
260
|
};
|
244
261
|
|
245
262
|
declare class SimpleImageAttachmentAdapter implements AttachmentAdapter {
|
@@ -381,11 +398,11 @@ declare abstract class BaseThreadRuntimeCore implements ThreadRuntimeCore {
|
|
381
398
|
export(): ExportedMessageRepository;
|
382
399
|
import(data: ExportedMessageRepository): void;
|
383
400
|
private _eventSubscribers;
|
384
|
-
unstable_on(event: ThreadRuntimeEventType, callback: () => void):
|
401
|
+
unstable_on(event: ThreadRuntimeEventType, callback: () => void): Unsubscribe;
|
385
402
|
}
|
386
403
|
|
387
404
|
declare class LocalThreadRuntimeCore extends BaseThreadRuntimeCore implements ThreadRuntimeCore {
|
388
|
-
|
405
|
+
readonly threadId: string;
|
389
406
|
readonly capabilities: {
|
390
407
|
switchToBranch: boolean;
|
391
408
|
edit: boolean;
|
@@ -397,19 +414,18 @@ declare class LocalThreadRuntimeCore extends BaseThreadRuntimeCore implements Th
|
|
397
414
|
feedback: boolean;
|
398
415
|
};
|
399
416
|
private abortController;
|
400
|
-
readonly threadId: string;
|
401
417
|
readonly isDisabled = false;
|
402
418
|
readonly suggestions: readonly ThreadSuggestion[];
|
403
419
|
get adapters(): {
|
420
|
+
chatModel: ChatModelAdapter;
|
404
421
|
attachments?: AttachmentAdapter | undefined;
|
405
422
|
speech?: SpeechSynthesisAdapter | undefined;
|
406
423
|
feedback?: FeedbackAdapter | undefined;
|
407
|
-
}
|
408
|
-
constructor(configProvider: ModelConfigProvider,
|
424
|
+
};
|
425
|
+
constructor(configProvider: ModelConfigProvider, threadId: string, options: LocalRuntimeOptionsBase);
|
409
426
|
private _options;
|
410
|
-
get options(): LocalRuntimeOptions;
|
411
427
|
get extras(): undefined;
|
412
|
-
|
428
|
+
setOptions(options: LocalRuntimeOptionsBase): void;
|
413
429
|
append(message: AppendMessage): Promise<void>;
|
414
430
|
startRun(parentId: string | null): Promise<void>;
|
415
431
|
private performRoundtrip;
|
@@ -417,158 +433,40 @@ declare class LocalThreadRuntimeCore extends BaseThreadRuntimeCore implements Th
|
|
417
433
|
addToolResult({ messageId, toolCallId, result, }: AddToolResultOptions): void;
|
418
434
|
}
|
419
435
|
|
420
|
-
|
421
|
-
|
422
|
-
|
423
|
-
|
424
|
-
|
425
|
-
|
426
|
-
|
427
|
-
|
428
|
-
|
429
|
-
|
430
|
-
|
431
|
-
type AssistantRuntime = {
|
432
|
-
thread: ThreadRuntime;
|
433
|
-
switchToNewThread(): void;
|
436
|
+
type LocalThreadFactory = (threadId: string, data: ExportedMessageRepository) => LocalThreadRuntimeCore;
|
437
|
+
declare class LocalThreadManagerRuntimeCore implements ThreadManagerRuntimeCore {
|
438
|
+
private _threadFactory;
|
439
|
+
private _threadData;
|
440
|
+
private _threads;
|
441
|
+
private _archivedThreads;
|
442
|
+
get threads(): readonly ThreadManagerMetadata[];
|
443
|
+
get archivedThreads(): readonly ThreadManagerMetadata[];
|
444
|
+
private _mainThread;
|
445
|
+
get mainThread(): LocalThreadRuntimeCore;
|
446
|
+
constructor(_threadFactory: LocalThreadFactory);
|
434
447
|
switchToThread(threadId: string): void;
|
435
|
-
/**
|
436
|
-
* @deprecated Use `switchToNewThread` instead. This will be removed in 0.6.0.
|
437
|
-
*/
|
438
|
-
switchToThread(threadId: string | null): void;
|
439
|
-
registerModelConfigProvider(provider: ModelConfigProvider): Unsubscribe;
|
440
|
-
/**
|
441
|
-
* @deprecated Thread is now static and never gets updated. This will be removed in 0.6.0.
|
442
|
-
*/
|
443
|
-
subscribe(callback: () => void): Unsubscribe;
|
444
|
-
};
|
445
|
-
declare class AssistantRuntimeImpl implements Omit<AssistantRuntimeCore, "thread">, AssistantRuntime {
|
446
|
-
private readonly _core;
|
447
|
-
private readonly _thread;
|
448
|
-
protected constructor(_core: AssistantRuntimeCore, _thread: ThreadRuntime);
|
449
|
-
get thread(): ThreadRuntime;
|
450
448
|
switchToNewThread(): void;
|
451
|
-
|
452
|
-
|
453
|
-
|
454
|
-
|
455
|
-
|
456
|
-
|
457
|
-
|
458
|
-
* @deprecated Thread is now static and never gets updated. This will be removed in 0.6.0.
|
459
|
-
*/
|
449
|
+
private _performThreadSwitch;
|
450
|
+
private _performMoveOp;
|
451
|
+
rename(threadId: string, newTitle: string): Promise<void>;
|
452
|
+
archive(threadId: string): Promise<void>;
|
453
|
+
unarchive(threadId: string): Promise<void>;
|
454
|
+
delete(threadId: string): Promise<void>;
|
455
|
+
private _subscriptions;
|
460
456
|
subscribe(callback: () => void): Unsubscribe;
|
461
|
-
|
462
|
-
static create(_core: AssistantRuntimeCore, CustomThreadRuntime?: new (binding: ThreadRuntimeCoreBinding) => ThreadRuntime): AssistantRuntime;
|
463
|
-
}
|
464
|
-
|
465
|
-
type LocalRuntime = AssistantRuntime & {
|
466
|
-
reset: (options?: Parameters<LocalRuntimeCore["reset"]>[0]) => void;
|
467
|
-
};
|
468
|
-
declare const useLocalRuntime: (adapter: ChatModelAdapter, options?: LocalRuntimeOptions) => LocalRuntime;
|
469
|
-
|
470
|
-
declare function toLanguageModelMessages(message: readonly CoreMessage[] | readonly ThreadMessage[]): LanguageModelV1Message[];
|
471
|
-
|
472
|
-
type fromLanguageModelMessagesOptions = {
|
473
|
-
mergeSteps: boolean;
|
474
|
-
};
|
475
|
-
declare const fromLanguageModelMessages: (lm: LanguageModelV1Message[], { mergeSteps }: fromLanguageModelMessagesOptions) => CoreMessage[];
|
476
|
-
|
477
|
-
declare const fromCoreMessages: (message: readonly CoreMessage[]) => ThreadMessage[];
|
478
|
-
declare const fromCoreMessage: (message: CoreMessage, { id, status, attachments, }?: {
|
479
|
-
id?: string | undefined;
|
480
|
-
status?: MessageStatus | undefined;
|
481
|
-
attachments?: readonly CompleteAttachment[] | undefined;
|
482
|
-
}) => ThreadMessage;
|
483
|
-
|
484
|
-
declare const toCoreMessages: (message: ThreadMessage[]) => CoreMessage[];
|
485
|
-
declare const toCoreMessage: (message: ThreadMessage) => CoreMessage;
|
486
|
-
|
487
|
-
declare const fromLanguageModelTools: (tools: LanguageModelV1FunctionTool[]) => Record<string, Tool<any, any>>;
|
488
|
-
|
489
|
-
declare const toLanguageModelTools: (tools: Record<string, Tool<any, any>>) => LanguageModelV1FunctionTool[];
|
490
|
-
|
491
|
-
declare class PipeableTransformStream<I, O> extends TransformStream<I, O> {
|
492
|
-
constructor(transform: (readable: ReadableStream<I>) => ReadableStream<O>);
|
493
|
-
}
|
494
|
-
|
495
|
-
type StreamPart<T extends Record<string, unknown>> = {
|
496
|
-
[K in keyof T]: {
|
497
|
-
type: K;
|
498
|
-
value: T[K];
|
499
|
-
};
|
500
|
-
}[keyof T];
|
501
|
-
|
502
|
-
declare function streamPartDecoderStream<T extends Record<string, unknown>>(): PipeableTransformStream<unknown, StreamPart<T>>;
|
503
|
-
|
504
|
-
declare function streamPartEncoderStream<T extends Record<string, unknown>>(): PipeableTransformStream<unknown, Uint8Array>;
|
505
|
-
|
506
|
-
declare namespace StreamUtils {
|
507
|
-
export type { StreamPart };
|
457
|
+
private _notifySubscribers;
|
508
458
|
}
|
509
|
-
/**
|
510
|
-
* @deprecated `streamUtils` will be replaced with `assistant-stream` once it is ready.
|
511
|
-
*/
|
512
|
-
declare const streamUtils: {
|
513
|
-
streamPartEncoderStream: typeof streamPartEncoderStream;
|
514
|
-
streamPartDecoderStream: typeof streamPartDecoderStream;
|
515
|
-
};
|
516
459
|
|
517
|
-
|
518
|
-
|
519
|
-
|
520
|
-
|
521
|
-
|
522
|
-
}
|
523
|
-
|
524
|
-
|
525
|
-
constructor(options: EdgeChatAdapterOptions);
|
526
|
-
run({ messages, abortSignal, config }: ChatModelRunOptions): AsyncGenerator<ChatModelRunResult, void, unknown>;
|
460
|
+
declare class LocalRuntimeCore extends BaseAssistantRuntimeCore {
|
461
|
+
readonly threadManager: LocalThreadManagerRuntimeCore;
|
462
|
+
private _options;
|
463
|
+
constructor(options: LocalRuntimeOptionsBase, initialMessages?: CoreMessage[]);
|
464
|
+
setOptions(options: LocalRuntimeOptionsBase): void;
|
465
|
+
reset({ initialMessages, }?: {
|
466
|
+
initialMessages?: readonly CoreMessage[] | undefined;
|
467
|
+
}): void;
|
527
468
|
}
|
528
469
|
|
529
|
-
type EdgeRuntimeOptions = EdgeChatAdapterOptions & LocalRuntimeOptions;
|
530
|
-
declare const useEdgeRuntime: (options: EdgeRuntimeOptions) => LocalRuntime;
|
531
|
-
|
532
|
-
type ThreadMessageLike = {
|
533
|
-
role: "assistant" | "user" | "system";
|
534
|
-
content: string | (TextContentPart | ImageContentPart | ToolCallContentPart<any, any> | CoreToolCallContentPart<any, any> | UIContentPart)[];
|
535
|
-
id?: string | undefined;
|
536
|
-
createdAt?: Date | undefined;
|
537
|
-
status?: MessageStatus | undefined;
|
538
|
-
attachments?: CompleteAttachment[] | undefined;
|
539
|
-
};
|
540
|
-
|
541
|
-
type ExternalStoreMessageConverter<T> = (message: T, idx: number) => ThreadMessageLike;
|
542
|
-
type ExternalStoreMessageConverterAdapter<T> = {
|
543
|
-
convertMessage: ExternalStoreMessageConverter<T>;
|
544
|
-
};
|
545
|
-
type ExternalStoreAdapterBase<T> = {
|
546
|
-
threadId?: string | undefined;
|
547
|
-
isDisabled?: boolean | undefined;
|
548
|
-
isRunning?: boolean | undefined;
|
549
|
-
messages: T[];
|
550
|
-
suggestions?: readonly ThreadSuggestion[] | undefined;
|
551
|
-
extras?: unknown;
|
552
|
-
setMessages?: ((messages: T[]) => void) | undefined;
|
553
|
-
onNew: (message: AppendMessage) => Promise<void>;
|
554
|
-
onEdit?: ((message: AppendMessage) => Promise<void>) | undefined;
|
555
|
-
onReload?: ((parentId: string | null) => Promise<void>) | undefined;
|
556
|
-
onCancel?: (() => Promise<void>) | undefined;
|
557
|
-
onAddToolResult?: ((options: AddToolResultOptions) => Promise<void> | void) | undefined;
|
558
|
-
onSwitchToThread?: ((threadId: string) => Promise<void> | void) | undefined;
|
559
|
-
onSwitchToNewThread?: (() => Promise<void> | void) | undefined;
|
560
|
-
convertMessage?: ExternalStoreMessageConverter<T> | undefined;
|
561
|
-
adapters?: {
|
562
|
-
attachments?: AttachmentAdapter | undefined;
|
563
|
-
speech?: SpeechSynthesisAdapter | undefined;
|
564
|
-
feedback?: FeedbackAdapter | undefined;
|
565
|
-
};
|
566
|
-
unstable_capabilities?: {
|
567
|
-
copy?: boolean | undefined;
|
568
|
-
} | undefined;
|
569
|
-
};
|
570
|
-
type ExternalStoreAdapter<T = ThreadMessage> = ExternalStoreAdapterBase<T> & (T extends ThreadMessage ? object : ExternalStoreMessageConverterAdapter<T>);
|
571
|
-
|
572
470
|
type Subscribable = {
|
573
471
|
subscribe: (callback: () => void) => Unsubscribe;
|
574
472
|
};
|
@@ -577,6 +475,9 @@ type SubscribableWithState<TState, TPath> = Subscribable & {
|
|
577
475
|
getState: () => TState;
|
578
476
|
};
|
579
477
|
|
478
|
+
type ThreadManagerRuntimePath = {
|
479
|
+
ref: string;
|
480
|
+
};
|
580
481
|
type ThreadRuntimePath = {
|
581
482
|
ref: string;
|
582
483
|
threadSelector: {
|
@@ -972,366 +873,732 @@ declare class MessageRuntimeImpl implements MessageRuntime {
|
|
972
873
|
getAttachmentByIndex(idx: number): MessageAttachmentRuntimeImpl;
|
973
874
|
}
|
974
875
|
|
975
|
-
declare const
|
876
|
+
declare const buttonVariants: (props?: ({
|
877
|
+
variant?: "default" | "outline" | "ghost" | null | undefined;
|
878
|
+
size?: "default" | "icon" | null | undefined;
|
879
|
+
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
880
|
+
type ButtonProps = React.ComponentPropsWithoutRef<typeof Primitive.button> & VariantProps<typeof buttonVariants>;
|
976
881
|
|
977
|
-
|
882
|
+
type TooltipIconButtonProps = ButtonProps & {
|
883
|
+
tooltip: string;
|
884
|
+
side?: "top" | "bottom" | "left" | "right";
|
885
|
+
};
|
886
|
+
declare const TooltipIconButton: react.ForwardRefExoticComponent<Omit<Omit<react.DetailedHTMLProps<react.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref"> & {
|
887
|
+
ref?: ((instance: HTMLButtonElement | null) => void | react.DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof react.DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | react.RefObject<HTMLButtonElement> | null | undefined;
|
888
|
+
} & {
|
889
|
+
asChild?: boolean;
|
890
|
+
}, "ref"> & class_variance_authority.VariantProps<(props?: ({
|
891
|
+
variant?: "default" | "outline" | "ghost" | null | undefined;
|
892
|
+
size?: "default" | "icon" | null | undefined;
|
893
|
+
} & class_variance_authority_types.ClassProp) | undefined) => string> & {
|
894
|
+
tooltip: string;
|
895
|
+
side?: "top" | "bottom" | "left" | "right";
|
896
|
+
} & react.RefAttributes<HTMLButtonElement>>;
|
978
897
|
|
979
|
-
declare
|
980
|
-
type Message = ThreadMessageLike | {
|
981
|
-
role: "tool";
|
982
|
-
toolCallId: string;
|
983
|
-
toolName?: string | undefined;
|
984
|
-
result: any;
|
985
|
-
};
|
986
|
-
type Callback<T> = (message: T) => Message | Message[];
|
987
|
-
}
|
988
|
-
declare const useExternalMessageConverter: <T extends WeakKey>({ callback, messages, isRunning, }: {
|
989
|
-
callback: useExternalMessageConverter.Callback<T>;
|
990
|
-
messages: T[];
|
991
|
-
isRunning: boolean;
|
992
|
-
}) => ThreadMessage[];
|
898
|
+
declare const generateId: (size?: number) => string;
|
993
899
|
|
994
|
-
|
900
|
+
declare const useSmooth: (state: ContentPartState & TextContentPart, smooth?: boolean) => ContentPartState & TextContentPart;
|
995
901
|
|
996
|
-
type
|
997
|
-
declare const useDangerousInBrowserRuntime: (options: DangerousInBrowserRuntimeOptions) => LocalRuntime;
|
902
|
+
type ReadonlyStore<T> = Omit<StoreApi<T>, "setState" | "destroy">;
|
998
903
|
|
999
|
-
|
1000
|
-
|
1001
|
-
|
1002
|
-
|
1003
|
-
|
1004
|
-
|
1005
|
-
|
1006
|
-
|
1007
|
-
|
1008
|
-
|
1009
|
-
|
1010
|
-
|
1011
|
-
|
1012
|
-
|
1013
|
-
|
1014
|
-
|
1015
|
-
|
1016
|
-
|
1017
|
-
|
1018
|
-
|
1019
|
-
|
904
|
+
declare const withSmoothContextProvider: <C extends ComponentType<any>>(Component: C) => C;
|
905
|
+
declare const useSmoothStatus: {
|
906
|
+
(): {
|
907
|
+
type: "running";
|
908
|
+
} | {
|
909
|
+
type: "complete";
|
910
|
+
} | {
|
911
|
+
type: "incomplete";
|
912
|
+
reason: "cancelled" | "length" | "content-filter" | "other" | "error";
|
913
|
+
error?: unknown;
|
914
|
+
} | {
|
915
|
+
type: "requires-action";
|
916
|
+
reason: "tool-calls";
|
917
|
+
};
|
918
|
+
<TSelected>(selector: (state: {
|
919
|
+
type: "running";
|
920
|
+
} | {
|
921
|
+
type: "complete";
|
922
|
+
} | {
|
923
|
+
type: "incomplete";
|
924
|
+
reason: "cancelled" | "length" | "content-filter" | "other" | "error";
|
925
|
+
error?: unknown;
|
926
|
+
} | {
|
927
|
+
type: "requires-action";
|
928
|
+
reason: "tool-calls";
|
929
|
+
}) => TSelected): TSelected;
|
930
|
+
(options: {
|
931
|
+
optional: true;
|
932
|
+
}): {
|
933
|
+
type: "running";
|
934
|
+
} | {
|
935
|
+
type: "complete";
|
936
|
+
} | {
|
937
|
+
type: "incomplete";
|
938
|
+
reason: "cancelled" | "length" | "content-filter" | "other" | "error";
|
939
|
+
error?: unknown;
|
940
|
+
} | {
|
941
|
+
type: "requires-action";
|
942
|
+
reason: "tool-calls";
|
943
|
+
} | null;
|
944
|
+
<TSelected>(options: {
|
945
|
+
optional: true;
|
946
|
+
selector?: (state: {
|
947
|
+
type: "running";
|
948
|
+
} | {
|
949
|
+
type: "complete";
|
950
|
+
} | {
|
951
|
+
type: "incomplete";
|
952
|
+
reason: "cancelled" | "length" | "content-filter" | "other" | "error";
|
953
|
+
error?: unknown;
|
954
|
+
} | {
|
955
|
+
type: "requires-action";
|
956
|
+
reason: "tool-calls";
|
957
|
+
}) => TSelected;
|
958
|
+
}): TSelected | null;
|
959
|
+
};
|
960
|
+
|
961
|
+
type internal_AssistantRuntimeImpl = AssistantRuntimeImpl;
|
962
|
+
declare const internal_AssistantRuntimeImpl: typeof AssistantRuntimeImpl;
|
963
|
+
type internal_BaseAssistantRuntimeCore = BaseAssistantRuntimeCore;
|
964
|
+
declare const internal_BaseAssistantRuntimeCore: typeof BaseAssistantRuntimeCore;
|
965
|
+
type internal_DefaultThreadComposerRuntimeCore = DefaultThreadComposerRuntimeCore;
|
966
|
+
declare const internal_DefaultThreadComposerRuntimeCore: typeof DefaultThreadComposerRuntimeCore;
|
967
|
+
type internal_MessageRepository = MessageRepository;
|
968
|
+
declare const internal_MessageRepository: typeof MessageRepository;
|
969
|
+
type internal_ProxyConfigProvider = ProxyConfigProvider;
|
970
|
+
declare const internal_ProxyConfigProvider: typeof ProxyConfigProvider;
|
971
|
+
type internal_ThreadManagerRuntimeCore = ThreadManagerRuntimeCore;
|
972
|
+
type internal_ThreadRuntimeCore = ThreadRuntimeCore;
|
973
|
+
type internal_ThreadRuntimeCoreBinding = ThreadRuntimeCoreBinding;
|
974
|
+
type internal_ThreadRuntimeImpl = ThreadRuntimeImpl;
|
975
|
+
declare const internal_ThreadRuntimeImpl: typeof ThreadRuntimeImpl;
|
976
|
+
declare const internal_TooltipIconButton: typeof TooltipIconButton;
|
977
|
+
declare const internal_generateId: typeof generateId;
|
978
|
+
declare const internal_useSmooth: typeof useSmooth;
|
979
|
+
declare const internal_useSmoothStatus: typeof useSmoothStatus;
|
980
|
+
declare const internal_withSmoothContextProvider: typeof withSmoothContextProvider;
|
981
|
+
declare namespace internal {
|
982
|
+
export { internal_AssistantRuntimeImpl as AssistantRuntimeImpl, internal_BaseAssistantRuntimeCore as BaseAssistantRuntimeCore, internal_DefaultThreadComposerRuntimeCore as DefaultThreadComposerRuntimeCore, internal_MessageRepository as MessageRepository, internal_ProxyConfigProvider as ProxyConfigProvider, type internal_ThreadManagerRuntimeCore as ThreadManagerRuntimeCore, type internal_ThreadRuntimeCore as ThreadRuntimeCore, type internal_ThreadRuntimeCoreBinding as ThreadRuntimeCoreBinding, internal_ThreadRuntimeImpl as ThreadRuntimeImpl, internal_TooltipIconButton as TooltipIconButton, internal_generateId as generateId, internal_useSmooth as useSmooth, internal_useSmoothStatus as useSmoothStatus, internal_withSmoothContextProvider as withSmoothContextProvider };
|
983
|
+
}
|
984
|
+
|
985
|
+
type ThreadManagerState = Readonly<{
|
986
|
+
threads: readonly ThreadManagerMetadata[];
|
987
|
+
archivedThreads: readonly ThreadManagerMetadata[];
|
1020
988
|
}>;
|
1021
|
-
type
|
1022
|
-
|
1023
|
-
|
1024
|
-
|
1025
|
-
|
1026
|
-
|
1027
|
-
|
1028
|
-
unstable_getCore(): ThreadRuntimeCore;
|
1029
|
-
append(message: CreateAppendMessage): void;
|
1030
|
-
startRun(parentId: string | null): void;
|
989
|
+
type ThreadManagerRuntime = Readonly<{
|
990
|
+
path: ThreadManagerRuntimePath;
|
991
|
+
getState(): ThreadManagerState;
|
992
|
+
rename(threadId: string, newTitle: string): Promise<void>;
|
993
|
+
archive(threadId: string): Promise<void>;
|
994
|
+
unarchive(threadId: string): Promise<void>;
|
995
|
+
delete(threadId: string): Promise<void>;
|
1031
996
|
subscribe(callback: () => void): Unsubscribe;
|
1032
|
-
|
1033
|
-
|
1034
|
-
|
1035
|
-
|
1036
|
-
|
1037
|
-
|
1038
|
-
|
1039
|
-
|
1040
|
-
|
1041
|
-
|
1042
|
-
|
1043
|
-
|
1044
|
-
|
1045
|
-
|
1046
|
-
|
1047
|
-
|
1048
|
-
|
1049
|
-
|
1050
|
-
|
1051
|
-
|
1052
|
-
|
1053
|
-
|
1054
|
-
isDisabled: boolean;
|
1055
|
-
/**
|
1056
|
-
* @deprecated Use `getState().isRunning` instead. This will be removed in 0.6.0.
|
1057
|
-
*/
|
1058
|
-
isRunning: boolean;
|
1059
|
-
/**
|
1060
|
-
* @deprecated Use `getState().messages` instead. This will be removed in 0.6.0.
|
1061
|
-
*/
|
1062
|
-
messages: readonly ThreadMessage[];
|
1063
|
-
/**
|
1064
|
-
* @deprecated Use `getState().followupSuggestions` instead. This will be removed in 0.6.0.
|
1065
|
-
*/
|
1066
|
-
suggestions: readonly ThreadSuggestion[];
|
1067
|
-
/**
|
1068
|
-
* @deprecated Use `getState().speechState` instead. This will be removed in 0.6.0.
|
1069
|
-
*/
|
1070
|
-
speech: SpeechState | undefined;
|
1071
|
-
/**
|
1072
|
-
* @deprecated Use `getState().extras` instead. This will be removed in 0.6.0.
|
1073
|
-
*/
|
1074
|
-
extras: unknown;
|
1075
|
-
/**
|
1076
|
-
* @deprecated Use `getMesssageById(id).getState().branchNumber` / `getMesssageById(id).getState().branchCount` instead. This will be removed in 0.6.0.
|
1077
|
-
*/
|
1078
|
-
getBranches: (messageId: string) => readonly string[];
|
1079
|
-
/**
|
1080
|
-
* @deprecated Use `getMesssageById(id).switchToBranch({ options })` instead. This will be removed in 0.6.0.
|
1081
|
-
*/
|
1082
|
-
switchToBranch: (branchId: string) => void;
|
1083
|
-
/**
|
1084
|
-
* @deprecated Use `getMesssageById(id).getContentPartByToolCallId(toolCallId).addToolResult({ result })` instead. This will be removed in 0.6.0.
|
1085
|
-
*/
|
1086
|
-
addToolResult: (options: AddToolResultOptions) => void;
|
1087
|
-
/**
|
1088
|
-
* @deprecated Use `getMesssageById(id).speak()` instead. This will be removed in 0.6.0.
|
1089
|
-
*/
|
1090
|
-
speak: (messageId: string) => void;
|
1091
|
-
/**
|
1092
|
-
* @deprecated Use `getMesssageById(id).getState().submittedFeedback` instead. This will be removed in 0.6.0.
|
1093
|
-
*/
|
1094
|
-
getSubmittedFeedback: (messageId: string) => SubmittedFeedback | undefined;
|
1095
|
-
/**
|
1096
|
-
* @deprecated Use `getMesssageById(id).submitFeedback({ type })` instead. This will be removed in 0.6.0.
|
1097
|
-
*/
|
1098
|
-
submitFeedback: (feedback: SubmitFeedbackOptions) => void;
|
997
|
+
}>;
|
998
|
+
type ThreadManagerRuntimeCoreBinding = ThreadManagerRuntimeCore;
|
999
|
+
declare class ThreadManagerRuntimeImpl implements ThreadManagerRuntime {
|
1000
|
+
private _core;
|
1001
|
+
get path(): {
|
1002
|
+
ref: string;
|
1003
|
+
};
|
1004
|
+
private _getState;
|
1005
|
+
constructor(_core: ThreadManagerRuntimeCoreBinding);
|
1006
|
+
getState(): ThreadManagerState;
|
1007
|
+
rename(threadId: string, newTitle: string): Promise<void>;
|
1008
|
+
archive(threadId: string): Promise<void>;
|
1009
|
+
unarchive(threadId: string): Promise<void>;
|
1010
|
+
delete(threadId: string): Promise<void>;
|
1011
|
+
subscribe(callback: () => void): Unsubscribe;
|
1012
|
+
}
|
1013
|
+
|
1014
|
+
type AssistantRuntime = {
|
1015
|
+
thread: ThreadRuntime;
|
1016
|
+
threadManager: ThreadManagerRuntime;
|
1017
|
+
switchToNewThread(): void;
|
1018
|
+
switchToThread(threadId: string): void;
|
1099
1019
|
/**
|
1100
|
-
* @deprecated Use `
|
1020
|
+
* @deprecated Use `switchToNewThread` instead. This will be removed in 0.6.0.
|
1101
1021
|
*/
|
1102
|
-
|
1022
|
+
switchToThread(threadId: string | null): void;
|
1023
|
+
registerModelConfigProvider(provider: ModelConfigProvider): Unsubscribe;
|
1103
1024
|
/**
|
1104
|
-
* @deprecated
|
1025
|
+
* @deprecated Thread is now static and never gets updated. This will be removed in 0.6.0.
|
1105
1026
|
*/
|
1106
|
-
|
1027
|
+
subscribe(callback: () => void): Unsubscribe;
|
1107
1028
|
};
|
1108
|
-
declare class
|
1109
|
-
|
1110
|
-
|
1111
|
-
|
1112
|
-
|
1113
|
-
get
|
1114
|
-
|
1115
|
-
|
1116
|
-
|
1117
|
-
|
1118
|
-
|
1119
|
-
|
1120
|
-
|
1121
|
-
|
1122
|
-
|
1123
|
-
|
1124
|
-
|
1125
|
-
|
1126
|
-
|
1127
|
-
|
1128
|
-
|
1129
|
-
|
1130
|
-
|
1131
|
-
|
1132
|
-
|
1133
|
-
|
1134
|
-
|
1135
|
-
|
1136
|
-
|
1137
|
-
*/
|
1138
|
-
get extras(): unknown;
|
1139
|
-
/**
|
1140
|
-
* @deprecated Use `getState().followupSuggestions` instead. This will be removed in 0.6.0.
|
1141
|
-
*/
|
1142
|
-
get suggestions(): readonly ThreadSuggestion[];
|
1143
|
-
/**
|
1144
|
-
* @deprecated Use `getState().messages` instead. This will be removed in 0.6.0.
|
1145
|
-
*/
|
1146
|
-
get messages(): readonly ThreadMessage[];
|
1147
|
-
/**
|
1148
|
-
* @deprecated Use `getState().speechState` instead. This will be removed in 0.6.0.
|
1149
|
-
*/
|
1150
|
-
get speech(): Readonly<{
|
1151
|
-
messageId: string;
|
1152
|
-
status: SpeechSynthesisAdapter.Status;
|
1153
|
-
}> | undefined;
|
1154
|
-
unstable_getCore(): Readonly<{
|
1155
|
-
getMessageById: (messageId: string) => {
|
1156
|
-
parentId: string | null;
|
1157
|
-
message: ThreadMessage;
|
1158
|
-
} | undefined;
|
1029
|
+
declare class AssistantRuntimeImpl implements Omit<AssistantRuntimeCore, "thread" | "threadManager">, AssistantRuntime {
|
1030
|
+
private readonly _core;
|
1031
|
+
private readonly _thread;
|
1032
|
+
readonly threadManager: ThreadManagerRuntimeImpl;
|
1033
|
+
protected constructor(_core: AssistantRuntimeCore, _thread: ThreadRuntime);
|
1034
|
+
get thread(): Readonly<{
|
1035
|
+
readonly path: ThreadRuntimePath;
|
1036
|
+
readonly composer: ThreadComposerRuntime;
|
1037
|
+
getState(): ThreadState;
|
1038
|
+
unstable_getCore(): ThreadRuntimeCore;
|
1039
|
+
append(message: CreateAppendMessage): void;
|
1040
|
+
startRun(parentId: string | null): void;
|
1041
|
+
subscribe(callback: () => void): Unsubscribe;
|
1042
|
+
cancelRun(): void;
|
1043
|
+
getModelConfig(): ModelConfig;
|
1044
|
+
export(): ExportedMessageRepository;
|
1045
|
+
import(repository: ExportedMessageRepository): void;
|
1046
|
+
getMesssageByIndex(idx: number): MessageRuntime;
|
1047
|
+
getMesssageById(messageId: string): MessageRuntime;
|
1048
|
+
stopSpeaking: () => void;
|
1049
|
+
unstable_on(event: ThreadRuntimeEventType, callback: () => void): Unsubscribe;
|
1050
|
+
capabilities: Readonly<RuntimeCapabilities>;
|
1051
|
+
threadId: string;
|
1052
|
+
isDisabled: boolean;
|
1053
|
+
isRunning: boolean;
|
1054
|
+
messages: readonly ThreadMessage[];
|
1055
|
+
suggestions: readonly ThreadSuggestion[];
|
1056
|
+
speech: SpeechState | undefined;
|
1057
|
+
extras: unknown;
|
1159
1058
|
getBranches: (messageId: string) => readonly string[];
|
1160
1059
|
switchToBranch: (branchId: string) => void;
|
1161
|
-
append: (message: AppendMessage) => void;
|
1162
|
-
startRun: (parentId: string | null) => void;
|
1163
|
-
cancelRun: () => void;
|
1164
1060
|
addToolResult: (options: AddToolResultOptions) => void;
|
1165
1061
|
speak: (messageId: string) => void;
|
1166
|
-
stopSpeaking: () => void;
|
1167
1062
|
getSubmittedFeedback: (messageId: string) => SubmittedFeedback | undefined;
|
1168
1063
|
submitFeedback: (feedback: SubmitFeedbackOptions) => void;
|
1169
|
-
getModelConfig: () => ModelConfig;
|
1170
|
-
composer: ThreadComposerRuntimeCore;
|
1171
1064
|
getEditComposer: (messageId: string) => ComposerRuntimeCore | undefined;
|
1172
1065
|
beginEdit: (messageId: string) => void;
|
1173
|
-
|
1174
|
-
|
1175
|
-
|
1176
|
-
|
1177
|
-
|
1178
|
-
|
1179
|
-
|
1180
|
-
|
1181
|
-
|
1066
|
+
}>;
|
1067
|
+
switchToNewThread(): void;
|
1068
|
+
switchToThread(threadId: string): void;
|
1069
|
+
/**
|
1070
|
+
* @deprecated Use `switchToNewThread` instead. This will be removed in 0.6.0.
|
1071
|
+
*/
|
1072
|
+
switchToThread(threadId: string | null): void;
|
1073
|
+
registerModelConfigProvider(provider: ModelConfigProvider): Unsubscribe;
|
1074
|
+
/**
|
1075
|
+
* @deprecated Thread is now static and never gets updated. This will be removed in 0.6.0.
|
1076
|
+
*/
|
1077
|
+
subscribe(): () => void;
|
1078
|
+
protected static createMainThreadRuntime(_core: AssistantRuntimeCore, CustomThreadRuntime?: new (binding: ThreadRuntimeCoreBinding) => ThreadRuntime): Readonly<{
|
1079
|
+
readonly path: ThreadRuntimePath;
|
1080
|
+
readonly composer: ThreadComposerRuntime;
|
1081
|
+
getState(): ThreadState;
|
1082
|
+
unstable_getCore(): ThreadRuntimeCore;
|
1083
|
+
append(message: CreateAppendMessage): void;
|
1084
|
+
startRun(parentId: string | null): void;
|
1085
|
+
subscribe(callback: () => void): Unsubscribe;
|
1086
|
+
cancelRun(): void;
|
1087
|
+
getModelConfig(): ModelConfig;
|
1182
1088
|
export(): ExportedMessageRepository;
|
1089
|
+
import(repository: ExportedMessageRepository): void;
|
1090
|
+
getMesssageByIndex(idx: number): MessageRuntime;
|
1091
|
+
getMesssageById(messageId: string): MessageRuntime;
|
1092
|
+
stopSpeaking: () => void;
|
1183
1093
|
unstable_on(event: ThreadRuntimeEventType, callback: () => void): Unsubscribe;
|
1184
|
-
|
1185
|
-
private _threadBinding;
|
1186
|
-
constructor(threadBinding: ThreadRuntimeCoreBinding);
|
1187
|
-
readonly composer: ThreadComposerRuntimeImpl;
|
1188
|
-
getState(): Readonly<{
|
1094
|
+
capabilities: Readonly<RuntimeCapabilities>;
|
1189
1095
|
threadId: string;
|
1190
1096
|
isDisabled: boolean;
|
1191
1097
|
isRunning: boolean;
|
1192
|
-
capabilities: RuntimeCapabilities;
|
1193
1098
|
messages: readonly ThreadMessage[];
|
1194
1099
|
suggestions: readonly ThreadSuggestion[];
|
1195
|
-
extras: unknown;
|
1196
|
-
/**
|
1197
|
-
* @deprecated This API is still under active development and might change without notice.
|
1198
|
-
*/
|
1199
1100
|
speech: SpeechState | undefined;
|
1101
|
+
extras: unknown;
|
1102
|
+
getBranches: (messageId: string) => readonly string[];
|
1103
|
+
switchToBranch: (branchId: string) => void;
|
1104
|
+
addToolResult: (options: AddToolResultOptions) => void;
|
1105
|
+
speak: (messageId: string) => void;
|
1106
|
+
getSubmittedFeedback: (messageId: string) => SubmittedFeedback | undefined;
|
1107
|
+
submitFeedback: (feedback: SubmitFeedbackOptions) => void;
|
1108
|
+
getEditComposer: (messageId: string) => ComposerRuntimeCore | undefined;
|
1109
|
+
beginEdit: (messageId: string) => void;
|
1200
1110
|
}>;
|
1201
|
-
|
1202
|
-
subscribe(callback: () => void): Unsubscribe;
|
1203
|
-
/**
|
1204
|
-
* @derprecated Use `getMesssageById(id).getState().branchNumber` / `getMesssageById(id).getState().branchCount` instead. This will be removed in 0.6.0.
|
1205
|
-
*/
|
1206
|
-
getBranches(messageId: string): readonly string[];
|
1207
|
-
getModelConfig(): ModelConfig;
|
1208
|
-
startRun(parentId: string | null): void;
|
1209
|
-
cancelRun(): void;
|
1210
|
-
/**
|
1211
|
-
* @deprecated Use `getMesssageById(id).getContentPartByToolCallId(toolCallId).addToolResult({ result })` instead. This will be removed in 0.6.0.
|
1212
|
-
*/
|
1213
|
-
addToolResult(options: AddToolResultOptions): void;
|
1214
|
-
/**
|
1215
|
-
* @deprecated Use `getMesssageById(id).switchToBranch({ options })` instead. This will be removed in 0.6.0.
|
1216
|
-
*/
|
1217
|
-
switchToBranch(branchId: string): void;
|
1218
|
-
/**
|
1219
|
-
* @deprecated Use `getMesssageById(id).speak()` instead. This will be removed in 0.6.0.
|
1220
|
-
*/
|
1221
|
-
speak(messageId: string): void;
|
1222
|
-
stopSpeaking(): void;
|
1223
|
-
getSubmittedFeedback(messageId: string): Readonly<{
|
1224
|
-
type: "negative" | "positive";
|
1225
|
-
}> | undefined;
|
1226
|
-
/**
|
1227
|
-
* @deprecated Use `getMesssageById(id).submitFeedback({ type })` instead. This will be removed in 0.6.0.
|
1228
|
-
*/
|
1229
|
-
submitFeedback(options: SubmitFeedbackOptions): void;
|
1230
|
-
/**
|
1231
|
-
* @deprecated Use `getMesssageById(id).getMessageByIndex(idx).composer` instead. This will be removed in 0.6.0.
|
1232
|
-
*/
|
1233
|
-
getEditComposer(messageId: string): Readonly<{
|
1234
|
-
attachments: readonly Attachment$1[];
|
1235
|
-
getAttachmentAccept(): string;
|
1236
|
-
addAttachment: (file: File) => Promise<void>;
|
1237
|
-
removeAttachment: (attachmentId: string) => Promise<void>;
|
1238
|
-
isEditing: boolean;
|
1239
|
-
canCancel: boolean;
|
1240
|
-
isEmpty: boolean;
|
1241
|
-
text: string;
|
1242
|
-
setText: (value: string) => void;
|
1243
|
-
reset: () => void;
|
1244
|
-
send: () => void;
|
1245
|
-
cancel: () => void;
|
1246
|
-
subscribe: (callback: () => void) => Unsubscribe;
|
1247
|
-
}> | undefined;
|
1248
|
-
/**
|
1249
|
-
* @deprecated Use `getMesssageById(id).getMessageByIndex(idx).composer.beginEdit()` instead. This will be removed in 0.6.0.
|
1250
|
-
*/
|
1251
|
-
beginEdit(messageId: string): void;
|
1252
|
-
export(): ExportedMessageRepository;
|
1253
|
-
import(data: ExportedMessageRepository): void;
|
1254
|
-
getMesssageByIndex(idx: number): MessageRuntimeImpl;
|
1255
|
-
getMesssageById(messageId: string): MessageRuntimeImpl;
|
1256
|
-
private _getMessageRuntime;
|
1257
|
-
private _eventListenerNestedSubscriptions;
|
1258
|
-
unstable_on(event: ThreadRuntimeEventType, callback: () => void): Unsubscribe;
|
1111
|
+
static create(_core: AssistantRuntimeCore, CustomThreadRuntime?: new (binding: ThreadRuntimeCoreBinding) => ThreadRuntime): AssistantRuntime;
|
1259
1112
|
}
|
1260
1113
|
|
1261
|
-
type
|
1262
|
-
|
1263
|
-
* @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.
|
1264
|
-
*/
|
1265
|
-
part: ThreadUserContentPart | ThreadAssistantContentPart;
|
1266
|
-
status: ContentPartStatus | ToolCallContentPartStatus;
|
1114
|
+
type LocalRuntime = AssistantRuntime & {
|
1115
|
+
reset: (options?: Parameters<LocalRuntimeCore["reset"]>[0]) => void;
|
1267
1116
|
};
|
1268
|
-
|
1269
|
-
|
1270
|
-
|
1271
|
-
|
1272
|
-
|
1273
|
-
|
1117
|
+
declare const useLocalRuntime: (adapter: ChatModelAdapter, options?: LocalRuntimeOptions) => LocalRuntime;
|
1118
|
+
|
1119
|
+
declare function toLanguageModelMessages(message: readonly CoreMessage[] | readonly ThreadMessage[]): LanguageModelV1Message[];
|
1120
|
+
|
1121
|
+
type fromLanguageModelMessagesOptions = {
|
1122
|
+
mergeSteps: boolean;
|
1274
1123
|
};
|
1275
|
-
declare
|
1276
|
-
|
1277
|
-
|
1278
|
-
|
1279
|
-
|
1280
|
-
|
1281
|
-
|
1282
|
-
|
1283
|
-
|
1124
|
+
declare const fromLanguageModelMessages: (lm: LanguageModelV1Message[], { mergeSteps }: fromLanguageModelMessagesOptions) => CoreMessage[];
|
1125
|
+
|
1126
|
+
declare const fromCoreMessages: (message: readonly CoreMessage[]) => ThreadMessage[];
|
1127
|
+
declare const fromCoreMessage: (message: CoreMessage, { id, status, attachments, }?: {
|
1128
|
+
id?: string | undefined;
|
1129
|
+
status?: MessageStatus | undefined;
|
1130
|
+
attachments?: readonly CompleteAttachment[] | undefined;
|
1131
|
+
}) => ThreadMessage;
|
1132
|
+
|
1133
|
+
declare const toCoreMessages: (message: ThreadMessage[]) => CoreMessage[];
|
1134
|
+
declare const toCoreMessage: (message: ThreadMessage) => CoreMessage;
|
1135
|
+
|
1136
|
+
declare const fromLanguageModelTools: (tools: LanguageModelV1FunctionTool[]) => Record<string, Tool<any, any>>;
|
1137
|
+
|
1138
|
+
declare const toLanguageModelTools: (tools: Record<string, Tool<any, any>>) => LanguageModelV1FunctionTool[];
|
1139
|
+
|
1140
|
+
declare class PipeableTransformStream<I, O> extends TransformStream<I, O> {
|
1141
|
+
constructor(transform: (readable: ReadableStream<I>) => ReadableStream<O>);
|
1284
1142
|
}
|
1285
1143
|
|
1286
|
-
type
|
1287
|
-
|
1144
|
+
type StreamPart<T extends Record<string, unknown>> = {
|
1145
|
+
[K in keyof T]: {
|
1146
|
+
type: K;
|
1147
|
+
value: T[K];
|
1148
|
+
};
|
1149
|
+
}[keyof T];
|
1150
|
+
|
1151
|
+
declare function streamPartDecoderStream<T extends Record<string, unknown>>(): PipeableTransformStream<unknown, StreamPart<T>>;
|
1152
|
+
|
1153
|
+
declare function streamPartEncoderStream<T extends Record<string, unknown>>(): PipeableTransformStream<unknown, Uint8Array>;
|
1154
|
+
|
1155
|
+
declare namespace StreamUtils {
|
1156
|
+
export type { StreamPart };
|
1157
|
+
}
|
1158
|
+
/**
|
1159
|
+
* @deprecated `streamUtils` will be replaced with `assistant-stream` once it is ready.
|
1160
|
+
*/
|
1161
|
+
declare const streamUtils: {
|
1162
|
+
streamPartEncoderStream: typeof streamPartEncoderStream;
|
1163
|
+
streamPartDecoderStream: typeof streamPartDecoderStream;
|
1288
1164
|
};
|
1289
|
-
|
1290
|
-
type
|
1291
|
-
|
1292
|
-
|
1293
|
-
|
1294
|
-
|
1165
|
+
|
1166
|
+
type EdgeChatAdapterOptions = {
|
1167
|
+
api: string;
|
1168
|
+
credentials?: RequestCredentials;
|
1169
|
+
headers?: Record<string, string> | Headers;
|
1170
|
+
body?: object;
|
1295
1171
|
};
|
1296
|
-
|
1297
|
-
|
1172
|
+
declare class EdgeChatAdapter implements ChatModelAdapter {
|
1173
|
+
private options;
|
1174
|
+
constructor(options: EdgeChatAdapterOptions);
|
1175
|
+
run({ messages, abortSignal, config }: ChatModelRunOptions): AsyncGenerator<ChatModelRunResult, void, unknown>;
|
1176
|
+
}
|
1177
|
+
|
1178
|
+
type EdgeRuntimeOptions = EdgeChatAdapterOptions & LocalRuntimeOptions;
|
1179
|
+
declare const useEdgeRuntime: (options: EdgeRuntimeOptions) => LocalRuntime;
|
1180
|
+
|
1181
|
+
type ThreadMessageLike = {
|
1182
|
+
role: "assistant" | "user" | "system";
|
1183
|
+
content: string | (TextContentPart | ImageContentPart | ToolCallContentPart<any, any> | CoreToolCallContentPart<any, any> | UIContentPart)[];
|
1184
|
+
id?: string | undefined;
|
1185
|
+
createdAt?: Date | undefined;
|
1186
|
+
status?: MessageStatus | undefined;
|
1187
|
+
attachments?: CompleteAttachment[] | undefined;
|
1188
|
+
};
|
1189
|
+
|
1190
|
+
type ExternalStoreThreadManagerAdapter = {
|
1191
|
+
threadId?: string | undefined;
|
1192
|
+
threads?: readonly ThreadManagerMetadata[] | undefined;
|
1193
|
+
archivedThreads?: readonly ThreadManagerMetadata[] | undefined;
|
1194
|
+
onSwitchToNewThread?: (() => Promise<void> | void) | undefined;
|
1195
|
+
onSwitchToThread?: ((threadId: string) => Promise<void> | void) | undefined;
|
1196
|
+
onRename?: (threadId: string, newTitle: string) => (Promise<void> | void) | undefined;
|
1197
|
+
onArchive?: ((threadId: string) => Promise<void> | void) | undefined;
|
1198
|
+
onUnarchive?: ((threadId: string) => Promise<void> | void) | undefined;
|
1199
|
+
onDelete?: ((threadId: string) => Promise<void> | void) | undefined;
|
1200
|
+
};
|
1201
|
+
type ExternalStoreMessageConverter<T> = (message: T, idx: number) => ThreadMessageLike;
|
1202
|
+
type ExternalStoreMessageConverterAdapter<T> = {
|
1203
|
+
convertMessage: ExternalStoreMessageConverter<T>;
|
1204
|
+
};
|
1205
|
+
type ExternalStoreAdapterBase<T> = {
|
1298
1206
|
/**
|
1299
|
-
* @deprecated
|
1207
|
+
* @deprecated Use `adapters.threadManager.threadId` instead. This will be removed in 0.6.0.
|
1300
1208
|
*/
|
1301
|
-
|
1302
|
-
};
|
1303
|
-
type ImageContentPartComponent = ComponentType<ImageContentPartProps>;
|
1304
|
-
type UIContentPartProps = ContentPartState & UIContentPart & {
|
1209
|
+
threadId?: string | undefined;
|
1305
1210
|
/**
|
1306
|
-
* @deprecated
|
1211
|
+
* @deprecated Use `adapters.threadManager.onSwitchToThread` instead. This will be removed in 0.6.0.
|
1307
1212
|
*/
|
1308
|
-
|
1309
|
-
};
|
1310
|
-
type UIContentPartComponent = ComponentType<UIContentPartProps>;
|
1311
|
-
type ToolCallContentPartProps<TArgs extends Record<string, unknown> = any, TResult = unknown> = ContentPartState & ToolCallContentPart<TArgs, TResult> & {
|
1213
|
+
onSwitchToThread?: ((threadId: string) => Promise<void> | void) | undefined;
|
1312
1214
|
/**
|
1313
|
-
* @deprecated
|
1215
|
+
* @deprecated Use `adapters.threadManager.onSwitchToNewThread` instead. This will be removed in 0.6.0.
|
1314
1216
|
*/
|
1315
|
-
|
1316
|
-
|
1317
|
-
};
|
1318
|
-
type ToolCallContentPartComponent<TArgs extends Record<string, unknown> = any, TResult = any> = ComponentType<ToolCallContentPartProps<TArgs, TResult>>;
|
1319
|
-
|
1320
|
-
type AssistantRuntimeProviderProps = {
|
1321
|
-
runtime: AssistantRuntime;
|
1322
|
-
};
|
1323
|
-
declare const AssistantRuntimeProvider: react.NamedExoticComponent<PropsWithChildren<AssistantRuntimeProviderProps>>;
|
1324
|
-
|
1325
|
-
type TextContentPartProviderProps = {
|
1326
|
-
text: string;
|
1217
|
+
onSwitchToNewThread?: (() => Promise<void> | void) | undefined;
|
1218
|
+
isDisabled?: boolean | undefined;
|
1327
1219
|
isRunning?: boolean | undefined;
|
1220
|
+
messages: T[];
|
1221
|
+
suggestions?: readonly ThreadSuggestion[] | undefined;
|
1222
|
+
extras?: unknown;
|
1223
|
+
setMessages?: ((messages: T[]) => void) | undefined;
|
1224
|
+
onNew: (message: AppendMessage) => Promise<void>;
|
1225
|
+
onEdit?: ((message: AppendMessage) => Promise<void>) | undefined;
|
1226
|
+
onReload?: ((parentId: string | null) => Promise<void>) | undefined;
|
1227
|
+
onCancel?: (() => Promise<void>) | undefined;
|
1228
|
+
onAddToolResult?: ((options: AddToolResultOptions) => Promise<void> | void) | undefined;
|
1229
|
+
convertMessage?: ExternalStoreMessageConverter<T> | undefined;
|
1230
|
+
adapters?: {
|
1231
|
+
attachments?: AttachmentAdapter | undefined;
|
1232
|
+
speech?: SpeechSynthesisAdapter | undefined;
|
1233
|
+
feedback?: FeedbackAdapter | undefined;
|
1234
|
+
threadManager?: ExternalStoreThreadManagerAdapter | undefined;
|
1235
|
+
};
|
1236
|
+
unstable_capabilities?: {
|
1237
|
+
copy?: boolean | undefined;
|
1238
|
+
} | undefined;
|
1328
1239
|
};
|
1329
|
-
|
1240
|
+
type ExternalStoreAdapter<T = ThreadMessage> = ExternalStoreAdapterBase<T> & (T extends ThreadMessage ? object : ExternalStoreMessageConverterAdapter<T>);
|
1330
1241
|
|
1331
|
-
|
1332
|
-
|
1333
|
-
|
1334
|
-
|
1242
|
+
declare const useExternalStoreRuntime: <T>(store: ExternalStoreAdapter<T>) => AssistantRuntime;
|
1243
|
+
|
1244
|
+
declare const getExternalStoreMessage: <T>(message: ThreadMessage) => T | undefined;
|
1245
|
+
|
1246
|
+
declare namespace useExternalMessageConverter {
|
1247
|
+
type Message = ThreadMessageLike | {
|
1248
|
+
role: "tool";
|
1249
|
+
toolCallId: string;
|
1250
|
+
toolName?: string | undefined;
|
1251
|
+
result: any;
|
1252
|
+
};
|
1253
|
+
type Callback<T> = (message: T) => Message | Message[];
|
1254
|
+
}
|
1255
|
+
declare const useExternalMessageConverter: <T extends WeakKey>({ callback, messages, isRunning, }: {
|
1256
|
+
callback: useExternalMessageConverter.Callback<T>;
|
1257
|
+
messages: T[];
|
1258
|
+
isRunning: boolean;
|
1259
|
+
}) => ThreadMessage[];
|
1260
|
+
|
1261
|
+
type DangerousInBrowserAdapterOptions = CreateEdgeRuntimeAPIOptions;
|
1262
|
+
|
1263
|
+
type DangerousInBrowserRuntimeOptions = DangerousInBrowserAdapterOptions & LocalRuntimeOptions;
|
1264
|
+
declare const useDangerousInBrowserRuntime: (options: DangerousInBrowserRuntimeOptions) => LocalRuntime;
|
1265
|
+
|
1266
|
+
type CreateAppendMessage = string | {
|
1267
|
+
parentId?: string | null | undefined;
|
1268
|
+
role?: AppendMessage["role"] | undefined;
|
1269
|
+
content: AppendMessage["content"];
|
1270
|
+
attachments?: AppendMessage["attachments"] | undefined;
|
1271
|
+
};
|
1272
|
+
type ThreadRuntimeCoreBinding = SubscribableWithState<ThreadRuntimeCore, ThreadRuntimePath> & {
|
1273
|
+
outerSubscribe(callback: () => void): Unsubscribe;
|
1274
|
+
};
|
1275
|
+
type ThreadState = Readonly<{
|
1276
|
+
threadId: string;
|
1277
|
+
isDisabled: boolean;
|
1278
|
+
isRunning: boolean;
|
1279
|
+
capabilities: RuntimeCapabilities;
|
1280
|
+
messages: readonly ThreadMessage[];
|
1281
|
+
suggestions: readonly ThreadSuggestion[];
|
1282
|
+
extras: unknown;
|
1283
|
+
/**
|
1284
|
+
* @deprecated This API is still under active development and might change without notice.
|
1285
|
+
*/
|
1286
|
+
speech: SpeechState | undefined;
|
1287
|
+
}>;
|
1288
|
+
type ThreadRuntime = Readonly<{
|
1289
|
+
readonly path: ThreadRuntimePath;
|
1290
|
+
readonly composer: ThreadComposerRuntime;
|
1291
|
+
getState(): ThreadState;
|
1292
|
+
/**
|
1293
|
+
* @deprecated This method will be removed in 0.6.0. Submit feedback if you need this functionality.
|
1294
|
+
*/
|
1295
|
+
unstable_getCore(): ThreadRuntimeCore;
|
1296
|
+
append(message: CreateAppendMessage): void;
|
1297
|
+
startRun(parentId: string | null): void;
|
1298
|
+
subscribe(callback: () => void): Unsubscribe;
|
1299
|
+
cancelRun(): void;
|
1300
|
+
getModelConfig(): ModelConfig;
|
1301
|
+
export(): ExportedMessageRepository;
|
1302
|
+
import(repository: ExportedMessageRepository): void;
|
1303
|
+
getMesssageByIndex(idx: number): MessageRuntime;
|
1304
|
+
getMesssageById(messageId: string): MessageRuntime;
|
1305
|
+
/**
|
1306
|
+
* @deprecated This API is still under active development and might change without notice.
|
1307
|
+
*/
|
1308
|
+
stopSpeaking: () => void;
|
1309
|
+
unstable_on(event: ThreadRuntimeEventType, callback: () => void): Unsubscribe;
|
1310
|
+
/**
|
1311
|
+
* @deprecated Use `getState().capabilities` instead. This will be removed in 0.6.0.
|
1312
|
+
*/
|
1313
|
+
capabilities: Readonly<RuntimeCapabilities>;
|
1314
|
+
/**
|
1315
|
+
* @deprecated Use `getState().threadId` instead. This will be removed in 0.6.0.
|
1316
|
+
*/
|
1317
|
+
threadId: string;
|
1318
|
+
/**
|
1319
|
+
* @deprecated Use `getState().isDisabled` instead. This will be removed in 0.6.0.
|
1320
|
+
*/
|
1321
|
+
isDisabled: boolean;
|
1322
|
+
/**
|
1323
|
+
* @deprecated Use `getState().isRunning` instead. This will be removed in 0.6.0.
|
1324
|
+
*/
|
1325
|
+
isRunning: boolean;
|
1326
|
+
/**
|
1327
|
+
* @deprecated Use `getState().messages` instead. This will be removed in 0.6.0.
|
1328
|
+
*/
|
1329
|
+
messages: readonly ThreadMessage[];
|
1330
|
+
/**
|
1331
|
+
* @deprecated Use `getState().followupSuggestions` instead. This will be removed in 0.6.0.
|
1332
|
+
*/
|
1333
|
+
suggestions: readonly ThreadSuggestion[];
|
1334
|
+
/**
|
1335
|
+
* @deprecated Use `getState().speechState` instead. This will be removed in 0.6.0.
|
1336
|
+
*/
|
1337
|
+
speech: SpeechState | undefined;
|
1338
|
+
/**
|
1339
|
+
* @deprecated Use `getState().extras` instead. This will be removed in 0.6.0.
|
1340
|
+
*/
|
1341
|
+
extras: unknown;
|
1342
|
+
/**
|
1343
|
+
* @deprecated Use `getMesssageById(id).getState().branchNumber` / `getMesssageById(id).getState().branchCount` instead. This will be removed in 0.6.0.
|
1344
|
+
*/
|
1345
|
+
getBranches: (messageId: string) => readonly string[];
|
1346
|
+
/**
|
1347
|
+
* @deprecated Use `getMesssageById(id).switchToBranch({ options })` instead. This will be removed in 0.6.0.
|
1348
|
+
*/
|
1349
|
+
switchToBranch: (branchId: string) => void;
|
1350
|
+
/**
|
1351
|
+
* @deprecated Use `getMesssageById(id).getContentPartByToolCallId(toolCallId).addToolResult({ result })` instead. This will be removed in 0.6.0.
|
1352
|
+
*/
|
1353
|
+
addToolResult: (options: AddToolResultOptions) => void;
|
1354
|
+
/**
|
1355
|
+
* @deprecated Use `getMesssageById(id).speak()` instead. This will be removed in 0.6.0.
|
1356
|
+
*/
|
1357
|
+
speak: (messageId: string) => void;
|
1358
|
+
/**
|
1359
|
+
* @deprecated Use `getMesssageById(id).getState().submittedFeedback` instead. This will be removed in 0.6.0.
|
1360
|
+
*/
|
1361
|
+
getSubmittedFeedback: (messageId: string) => SubmittedFeedback | undefined;
|
1362
|
+
/**
|
1363
|
+
* @deprecated Use `getMesssageById(id).submitFeedback({ type })` instead. This will be removed in 0.6.0.
|
1364
|
+
*/
|
1365
|
+
submitFeedback: (feedback: SubmitFeedbackOptions) => void;
|
1366
|
+
/**
|
1367
|
+
* @deprecated Use `getMesssageById(id).composer` instead. This will be removed in 0.6.0.
|
1368
|
+
*/
|
1369
|
+
getEditComposer: (messageId: string) => ComposerRuntimeCore | undefined;
|
1370
|
+
/**
|
1371
|
+
* @deprecated Use `getMesssageById(id).composer.beginEdit()` instead. This will be removed in 0.6.0.
|
1372
|
+
*/
|
1373
|
+
beginEdit: (messageId: string) => void;
|
1374
|
+
}>;
|
1375
|
+
declare class ThreadRuntimeImpl implements Omit<ThreadRuntimeCore, "getMessageById">, ThreadRuntime {
|
1376
|
+
get path(): ThreadRuntimePath;
|
1377
|
+
/**
|
1378
|
+
* @deprecated Use `getState().threadId` instead. This will be removed in 0.6.0.
|
1379
|
+
*/
|
1380
|
+
get threadId(): string;
|
1381
|
+
/**
|
1382
|
+
* @deprecated Use `getState().isDisabled` instead. This will be removed in 0.6.0.
|
1383
|
+
*/
|
1384
|
+
get isDisabled(): boolean;
|
1385
|
+
/**
|
1386
|
+
* @deprecated Use `getState().isRunning` instead. This will be removed in 0.6.0.
|
1387
|
+
*/
|
1388
|
+
get isRunning(): boolean;
|
1389
|
+
/**
|
1390
|
+
* @deprecated Use `getState().capabilities` instead. This will be removed in 0.6.0.
|
1391
|
+
*/
|
1392
|
+
get capabilities(): Readonly<{
|
1393
|
+
switchToBranch: boolean;
|
1394
|
+
edit: boolean;
|
1395
|
+
reload: boolean;
|
1396
|
+
cancel: boolean;
|
1397
|
+
unstable_copy: boolean;
|
1398
|
+
speech: boolean;
|
1399
|
+
attachments: boolean;
|
1400
|
+
feedback: boolean;
|
1401
|
+
}>;
|
1402
|
+
/**
|
1403
|
+
* @deprecated Use `getState().extras` instead. This will be removed in 0.6.0.
|
1404
|
+
*/
|
1405
|
+
get extras(): unknown;
|
1406
|
+
/**
|
1407
|
+
* @deprecated Use `getState().followupSuggestions` instead. This will be removed in 0.6.0.
|
1408
|
+
*/
|
1409
|
+
get suggestions(): readonly ThreadSuggestion[];
|
1410
|
+
/**
|
1411
|
+
* @deprecated Use `getState().messages` instead. This will be removed in 0.6.0.
|
1412
|
+
*/
|
1413
|
+
get messages(): readonly ThreadMessage[];
|
1414
|
+
/**
|
1415
|
+
* @deprecated Use `getState().speechState` instead. This will be removed in 0.6.0.
|
1416
|
+
*/
|
1417
|
+
get speech(): Readonly<{
|
1418
|
+
messageId: string;
|
1419
|
+
status: SpeechSynthesisAdapter.Status;
|
1420
|
+
}> | undefined;
|
1421
|
+
unstable_getCore(): Readonly<{
|
1422
|
+
getMessageById: (messageId: string) => {
|
1423
|
+
parentId: string | null;
|
1424
|
+
message: ThreadMessage;
|
1425
|
+
} | undefined;
|
1426
|
+
getBranches: (messageId: string) => readonly string[];
|
1427
|
+
switchToBranch: (branchId: string) => void;
|
1428
|
+
append: (message: AppendMessage) => void;
|
1429
|
+
startRun: (parentId: string | null) => void;
|
1430
|
+
cancelRun: () => void;
|
1431
|
+
addToolResult: (options: AddToolResultOptions) => void;
|
1432
|
+
speak: (messageId: string) => void;
|
1433
|
+
stopSpeaking: () => void;
|
1434
|
+
getSubmittedFeedback: (messageId: string) => SubmittedFeedback | undefined;
|
1435
|
+
submitFeedback: (feedback: SubmitFeedbackOptions) => void;
|
1436
|
+
getModelConfig: () => ModelConfig;
|
1437
|
+
composer: ThreadComposerRuntimeCore;
|
1438
|
+
getEditComposer: (messageId: string) => ComposerRuntimeCore | undefined;
|
1439
|
+
beginEdit: (messageId: string) => void;
|
1440
|
+
speech: SpeechState | undefined;
|
1441
|
+
capabilities: Readonly<RuntimeCapabilities>;
|
1442
|
+
threadId: string;
|
1443
|
+
isDisabled: boolean;
|
1444
|
+
messages: readonly ThreadMessage[];
|
1445
|
+
suggestions: readonly ThreadSuggestion[];
|
1446
|
+
extras: unknown;
|
1447
|
+
subscribe: (callback: () => void) => Unsubscribe;
|
1448
|
+
import(repository: ExportedMessageRepository): void;
|
1449
|
+
export(): ExportedMessageRepository;
|
1450
|
+
unstable_on(event: ThreadRuntimeEventType, callback: () => void): Unsubscribe;
|
1451
|
+
}>;
|
1452
|
+
private _threadBinding;
|
1453
|
+
constructor(threadBinding: ThreadRuntimeCoreBinding);
|
1454
|
+
readonly composer: ThreadComposerRuntimeImpl;
|
1455
|
+
getState(): Readonly<{
|
1456
|
+
threadId: string;
|
1457
|
+
isDisabled: boolean;
|
1458
|
+
isRunning: boolean;
|
1459
|
+
capabilities: RuntimeCapabilities;
|
1460
|
+
messages: readonly ThreadMessage[];
|
1461
|
+
suggestions: readonly ThreadSuggestion[];
|
1462
|
+
extras: unknown;
|
1463
|
+
/**
|
1464
|
+
* @deprecated This API is still under active development and might change without notice.
|
1465
|
+
*/
|
1466
|
+
speech: SpeechState | undefined;
|
1467
|
+
}>;
|
1468
|
+
append(message: CreateAppendMessage): void;
|
1469
|
+
subscribe(callback: () => void): Unsubscribe;
|
1470
|
+
/**
|
1471
|
+
* @derprecated Use `getMesssageById(id).getState().branchNumber` / `getMesssageById(id).getState().branchCount` instead. This will be removed in 0.6.0.
|
1472
|
+
*/
|
1473
|
+
getBranches(messageId: string): readonly string[];
|
1474
|
+
getModelConfig(): ModelConfig;
|
1475
|
+
startRun(parentId: string | null): void;
|
1476
|
+
cancelRun(): void;
|
1477
|
+
/**
|
1478
|
+
* @deprecated Use `getMesssageById(id).getContentPartByToolCallId(toolCallId).addToolResult({ result })` instead. This will be removed in 0.6.0.
|
1479
|
+
*/
|
1480
|
+
addToolResult(options: AddToolResultOptions): void;
|
1481
|
+
/**
|
1482
|
+
* @deprecated Use `getMesssageById(id).switchToBranch({ options })` instead. This will be removed in 0.6.0.
|
1483
|
+
*/
|
1484
|
+
switchToBranch(branchId: string): void;
|
1485
|
+
/**
|
1486
|
+
* @deprecated Use `getMesssageById(id).speak()` instead. This will be removed in 0.6.0.
|
1487
|
+
*/
|
1488
|
+
speak(messageId: string): void;
|
1489
|
+
stopSpeaking(): void;
|
1490
|
+
getSubmittedFeedback(messageId: string): Readonly<{
|
1491
|
+
type: "negative" | "positive";
|
1492
|
+
}> | undefined;
|
1493
|
+
/**
|
1494
|
+
* @deprecated Use `getMesssageById(id).submitFeedback({ type })` instead. This will be removed in 0.6.0.
|
1495
|
+
*/
|
1496
|
+
submitFeedback(options: SubmitFeedbackOptions): void;
|
1497
|
+
/**
|
1498
|
+
* @deprecated Use `getMesssageById(id).getMessageByIndex(idx).composer` instead. This will be removed in 0.6.0.
|
1499
|
+
*/
|
1500
|
+
getEditComposer(messageId: string): Readonly<{
|
1501
|
+
attachments: readonly Attachment$1[];
|
1502
|
+
getAttachmentAccept(): string;
|
1503
|
+
addAttachment: (file: File) => Promise<void>;
|
1504
|
+
removeAttachment: (attachmentId: string) => Promise<void>;
|
1505
|
+
isEditing: boolean;
|
1506
|
+
canCancel: boolean;
|
1507
|
+
isEmpty: boolean;
|
1508
|
+
text: string;
|
1509
|
+
setText: (value: string) => void;
|
1510
|
+
reset: () => void;
|
1511
|
+
send: () => void;
|
1512
|
+
cancel: () => void;
|
1513
|
+
subscribe: (callback: () => void) => Unsubscribe;
|
1514
|
+
}> | undefined;
|
1515
|
+
/**
|
1516
|
+
* @deprecated Use `getMesssageById(id).getMessageByIndex(idx).composer.beginEdit()` instead. This will be removed in 0.6.0.
|
1517
|
+
*/
|
1518
|
+
beginEdit(messageId: string): void;
|
1519
|
+
export(): ExportedMessageRepository;
|
1520
|
+
import(data: ExportedMessageRepository): void;
|
1521
|
+
getMesssageByIndex(idx: number): MessageRuntimeImpl;
|
1522
|
+
getMesssageById(messageId: string): MessageRuntimeImpl;
|
1523
|
+
private _getMessageRuntime;
|
1524
|
+
private _eventListenerNestedSubscriptions;
|
1525
|
+
unstable_on(event: ThreadRuntimeEventType, callback: () => void): Unsubscribe;
|
1526
|
+
}
|
1527
|
+
|
1528
|
+
type ContentPartState = (ThreadUserContentPart | ThreadAssistantContentPart) & {
|
1529
|
+
/**
|
1530
|
+
* @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.
|
1531
|
+
*/
|
1532
|
+
part: ThreadUserContentPart | ThreadAssistantContentPart;
|
1533
|
+
status: ContentPartStatus | ToolCallContentPartStatus;
|
1534
|
+
};
|
1535
|
+
type ContentPartSnapshotBinding = SubscribableWithState<ContentPartState, ContentPartRuntimePath>;
|
1536
|
+
type ContentPartRuntime = {
|
1537
|
+
path: ContentPartRuntimePath;
|
1538
|
+
getState(): ContentPartState;
|
1539
|
+
addToolResult(result: any): void;
|
1540
|
+
subscribe(callback: () => void): Unsubscribe;
|
1541
|
+
};
|
1542
|
+
declare class ContentPartRuntimeImpl implements ContentPartRuntime {
|
1543
|
+
private contentBinding;
|
1544
|
+
private messageApi;
|
1545
|
+
private threadApi;
|
1546
|
+
get path(): ContentPartRuntimePath;
|
1547
|
+
constructor(contentBinding: ContentPartSnapshotBinding, messageApi: MessageStateBinding, threadApi: ThreadRuntimeCoreBinding);
|
1548
|
+
getState(): ContentPartState;
|
1549
|
+
addToolResult(result: any): void;
|
1550
|
+
subscribe(callback: () => void): Unsubscribe;
|
1551
|
+
}
|
1552
|
+
|
1553
|
+
type EmptyContentPartProps = {
|
1554
|
+
status: ContentPartStatus;
|
1555
|
+
};
|
1556
|
+
type EmptyContentPartComponent = ComponentType<EmptyContentPartProps>;
|
1557
|
+
type TextContentPartProps = ContentPartState & TextContentPart & {
|
1558
|
+
/**
|
1559
|
+
* @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.
|
1560
|
+
*/
|
1561
|
+
part: TextContentPart;
|
1562
|
+
};
|
1563
|
+
type TextContentPartComponent = ComponentType<TextContentPartProps>;
|
1564
|
+
type ImageContentPartProps = ContentPartState & ImageContentPart & {
|
1565
|
+
/**
|
1566
|
+
* @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.
|
1567
|
+
*/
|
1568
|
+
part: ImageContentPart;
|
1569
|
+
};
|
1570
|
+
type ImageContentPartComponent = ComponentType<ImageContentPartProps>;
|
1571
|
+
type UIContentPartProps = ContentPartState & UIContentPart & {
|
1572
|
+
/**
|
1573
|
+
* @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.
|
1574
|
+
*/
|
1575
|
+
part: UIContentPart;
|
1576
|
+
};
|
1577
|
+
type UIContentPartComponent = ComponentType<UIContentPartProps>;
|
1578
|
+
type ToolCallContentPartProps<TArgs extends Record<string, unknown> = any, TResult = unknown> = ContentPartState & ToolCallContentPart<TArgs, TResult> & {
|
1579
|
+
/**
|
1580
|
+
* @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.
|
1581
|
+
*/
|
1582
|
+
part: ToolCallContentPart<TArgs, TResult>;
|
1583
|
+
addResult: (result: any) => void;
|
1584
|
+
};
|
1585
|
+
type ToolCallContentPartComponent<TArgs extends Record<string, unknown> = any, TResult = any> = ComponentType<ToolCallContentPartProps<TArgs, TResult>>;
|
1586
|
+
|
1587
|
+
type AssistantRuntimeProviderProps = {
|
1588
|
+
runtime: AssistantRuntime;
|
1589
|
+
};
|
1590
|
+
declare const AssistantRuntimeProvider: react.NamedExoticComponent<PropsWithChildren<AssistantRuntimeProviderProps>>;
|
1591
|
+
|
1592
|
+
type TextContentPartProviderProps = {
|
1593
|
+
text: string;
|
1594
|
+
isRunning?: boolean | undefined;
|
1595
|
+
};
|
1596
|
+
declare const TextContentPartProvider: FC<PropsWithChildren<TextContentPartProviderProps>>;
|
1597
|
+
|
1598
|
+
type AssistantToolUIsState = Readonly<{
|
1599
|
+
getToolUI: (toolName: string) => ToolCallContentPartComponent | null;
|
1600
|
+
setToolUI: (toolName: string, render: ToolCallContentPartComponent) => () => void;
|
1601
|
+
}>;
|
1335
1602
|
|
1336
1603
|
type MessageUtilsState = Readonly<{
|
1337
1604
|
isCopied: boolean;
|
@@ -1346,155 +1613,1033 @@ type ThreadViewportState = Readonly<{
|
|
1346
1613
|
onScrollToBottom: (callback: () => void) => Unsubscribe;
|
1347
1614
|
}>;
|
1348
1615
|
|
1349
|
-
type
|
1616
|
+
type AssistantContextValue = {
|
1617
|
+
useToolUIs: UseBoundStore<ReadonlyStore<AssistantToolUIsState>>;
|
1618
|
+
useAssistantRuntime: UseBoundStore<ReadonlyStore<AssistantRuntime>>;
|
1619
|
+
useThreadManager: UseBoundStore<ReadonlyStore<ThreadManagerState>>;
|
1620
|
+
/**
|
1621
|
+
* @deprecated Use `useAssistantRuntime` instead. This will be removed in 0.6.0.
|
1622
|
+
*/
|
1623
|
+
useAssistantActions: UseBoundStore<ReadonlyStore<AssistantRuntime>>;
|
1624
|
+
};
|
1625
|
+
declare const useAssistantContext: {
|
1626
|
+
(options?: {
|
1627
|
+
optional?: false | undefined;
|
1628
|
+
} | undefined): AssistantContextValue;
|
1629
|
+
(options?: {
|
1630
|
+
optional?: boolean | undefined;
|
1631
|
+
} | undefined): AssistantContextValue | null;
|
1632
|
+
};
|
1633
|
+
declare function useAssistantRuntime(options?: {
|
1634
|
+
optional?: false | undefined;
|
1635
|
+
}): AssistantRuntime;
|
1636
|
+
declare function useAssistantRuntime(options?: {
|
1637
|
+
optional?: boolean | undefined;
|
1638
|
+
}): AssistantRuntime | null;
|
1639
|
+
/**
|
1640
|
+
* @deprecated Use `useAssistantRuntime` instead. This will be removed in 0.6.0.
|
1641
|
+
*/
|
1642
|
+
declare const useAssistantActionsStore: {
|
1643
|
+
(): ReadonlyStore<AssistantRuntime>;
|
1644
|
+
(options: {
|
1645
|
+
optional: true;
|
1646
|
+
}): ReadonlyStore<AssistantRuntime> | null;
|
1647
|
+
};
|
1648
|
+
/**
|
1649
|
+
* @deprecated Use `useAssistantRuntime` instead. This will be removed in 0.6.0.
|
1650
|
+
*/
|
1651
|
+
declare const useAssistantActions: {
|
1652
|
+
(): AssistantRuntime;
|
1653
|
+
<TSelected>(selector: (state: AssistantRuntime) => TSelected): TSelected;
|
1654
|
+
(options: {
|
1655
|
+
optional: true;
|
1656
|
+
}): AssistantRuntime | null;
|
1657
|
+
<TSelected>(options: {
|
1658
|
+
optional: true;
|
1659
|
+
selector?: (state: AssistantRuntime) => TSelected;
|
1660
|
+
}): TSelected | null;
|
1661
|
+
};
|
1662
|
+
/**
|
1663
|
+
* @deprecated Use `useAssistantRuntime` instead. This will be removed in 0.6.0.
|
1664
|
+
*/
|
1665
|
+
declare const useAssistantRuntimeStore: {
|
1666
|
+
(): ReadonlyStore<AssistantRuntime>;
|
1667
|
+
(options: {
|
1668
|
+
optional: true;
|
1669
|
+
}): ReadonlyStore<AssistantRuntime> | null;
|
1670
|
+
};
|
1671
|
+
declare const useToolUIs: {
|
1672
|
+
(): Readonly<{
|
1673
|
+
getToolUI: (toolName: string) => ToolCallContentPartComponent | null;
|
1674
|
+
setToolUI: (toolName: string, render: ToolCallContentPartComponent) => () => void;
|
1675
|
+
}>;
|
1676
|
+
<TSelected>(selector: (state: Readonly<{
|
1677
|
+
getToolUI: (toolName: string) => ToolCallContentPartComponent | null;
|
1678
|
+
setToolUI: (toolName: string, render: ToolCallContentPartComponent) => () => void;
|
1679
|
+
}>) => TSelected): TSelected;
|
1680
|
+
(options: {
|
1681
|
+
optional: true;
|
1682
|
+
}): Readonly<{
|
1683
|
+
getToolUI: (toolName: string) => ToolCallContentPartComponent | null;
|
1684
|
+
setToolUI: (toolName: string, render: ToolCallContentPartComponent) => () => void;
|
1685
|
+
}> | null;
|
1686
|
+
<TSelected>(options: {
|
1687
|
+
optional: true;
|
1688
|
+
selector?: (state: Readonly<{
|
1689
|
+
getToolUI: (toolName: string) => ToolCallContentPartComponent | null;
|
1690
|
+
setToolUI: (toolName: string, render: ToolCallContentPartComponent) => () => void;
|
1691
|
+
}>) => TSelected;
|
1692
|
+
}): TSelected | null;
|
1693
|
+
};
|
1694
|
+
declare const useToolUIsStore: {
|
1695
|
+
(): ReadonlyStore<Readonly<{
|
1696
|
+
getToolUI: (toolName: string) => ToolCallContentPartComponent | null;
|
1697
|
+
setToolUI: (toolName: string, render: ToolCallContentPartComponent) => () => void;
|
1698
|
+
}>>;
|
1699
|
+
(options: {
|
1700
|
+
optional: true;
|
1701
|
+
}): ReadonlyStore<Readonly<{
|
1702
|
+
getToolUI: (toolName: string) => ToolCallContentPartComponent | null;
|
1703
|
+
setToolUI: (toolName: string, render: ToolCallContentPartComponent) => () => void;
|
1704
|
+
}>> | null;
|
1705
|
+
};
|
1706
|
+
declare const useThreadManager: {
|
1707
|
+
(): Readonly<{
|
1708
|
+
threads: readonly ThreadManagerMetadata[];
|
1709
|
+
archivedThreads: readonly ThreadManagerMetadata[];
|
1710
|
+
}>;
|
1711
|
+
<TSelected>(selector: (state: Readonly<{
|
1712
|
+
threads: readonly ThreadManagerMetadata[];
|
1713
|
+
archivedThreads: readonly ThreadManagerMetadata[];
|
1714
|
+
}>) => TSelected): TSelected;
|
1715
|
+
(options: {
|
1716
|
+
optional: true;
|
1717
|
+
}): Readonly<{
|
1718
|
+
threads: readonly ThreadManagerMetadata[];
|
1719
|
+
archivedThreads: readonly ThreadManagerMetadata[];
|
1720
|
+
}> | null;
|
1721
|
+
<TSelected>(options: {
|
1722
|
+
optional: true;
|
1723
|
+
selector?: (state: Readonly<{
|
1724
|
+
threads: readonly ThreadManagerMetadata[];
|
1725
|
+
archivedThreads: readonly ThreadManagerMetadata[];
|
1726
|
+
}>) => TSelected;
|
1727
|
+
}): TSelected | null;
|
1728
|
+
};
|
1350
1729
|
|
1351
|
-
type
|
1352
|
-
|
1353
|
-
useAssistantRuntime: UseBoundStore<ReadonlyStore<AssistantRuntime>>;
|
1730
|
+
type ThreadContextValue = {
|
1731
|
+
useThread: UseBoundStore<ReadonlyStore<ThreadState>>;
|
1354
1732
|
/**
|
1355
|
-
* @deprecated Use `
|
1733
|
+
* @deprecated Use `useThreadRuntime` instead. This will be removed in 0.6.0.
|
1356
1734
|
*/
|
1357
|
-
|
1735
|
+
useThreadActions: UseBoundStore<ReadonlyStore<ThreadRuntime>>;
|
1736
|
+
useThreadRuntime: UseBoundStore<ReadonlyStore<ThreadRuntime>>;
|
1737
|
+
useThreadMessages: UseBoundStore<ReadonlyStore<readonly ThreadMessage[]>>;
|
1738
|
+
useComposer: UseBoundStore<ReadonlyStore<ThreadComposerState>>;
|
1739
|
+
useViewport: UseBoundStore<ReadonlyStore<ThreadViewportState>>;
|
1358
1740
|
};
|
1359
|
-
declare const
|
1741
|
+
declare const useThreadContext: {
|
1360
1742
|
(options?: {
|
1361
1743
|
optional?: false | undefined;
|
1362
|
-
} | undefined):
|
1744
|
+
} | undefined): ThreadContextValue;
|
1363
1745
|
(options?: {
|
1364
1746
|
optional?: boolean | undefined;
|
1365
|
-
} | undefined):
|
1747
|
+
} | undefined): ThreadContextValue | null;
|
1366
1748
|
};
|
1367
|
-
declare function
|
1749
|
+
declare function useThreadRuntime(options?: {
|
1368
1750
|
optional?: false | undefined;
|
1369
|
-
}):
|
1370
|
-
declare function
|
1751
|
+
}): ThreadRuntime;
|
1752
|
+
declare function useThreadRuntime(options?: {
|
1371
1753
|
optional?: boolean | undefined;
|
1372
|
-
}):
|
1373
|
-
/**
|
1374
|
-
* @deprecated Use `useAssistantRuntime` instead. This will be removed in 0.6.0.
|
1375
|
-
*/
|
1376
|
-
declare const useAssistantActionsStore: {
|
1377
|
-
(): ReadonlyStore<AssistantRuntime>;
|
1378
|
-
(options: {
|
1379
|
-
optional: true;
|
1380
|
-
}): ReadonlyStore<AssistantRuntime> | null;
|
1381
|
-
};
|
1754
|
+
}): ThreadRuntime | null;
|
1382
1755
|
/**
|
1383
|
-
* @deprecated Use `
|
1756
|
+
* @deprecated Use `useThreadRuntime` instead. This will be removed in 0.6.0.
|
1384
1757
|
*/
|
1385
|
-
declare const
|
1386
|
-
():
|
1387
|
-
|
1758
|
+
declare const useThreadActionsStore: {
|
1759
|
+
(): ReadonlyStore<Readonly<{
|
1760
|
+
readonly path: ThreadRuntimePath;
|
1761
|
+
readonly composer: ThreadComposerRuntime;
|
1762
|
+
getState(): Readonly<{
|
1763
|
+
threadId: string;
|
1764
|
+
isDisabled: boolean;
|
1765
|
+
isRunning: boolean;
|
1766
|
+
capabilities: Readonly<{
|
1767
|
+
switchToBranch: boolean;
|
1768
|
+
edit: boolean;
|
1769
|
+
reload: boolean;
|
1770
|
+
cancel: boolean;
|
1771
|
+
unstable_copy: boolean;
|
1772
|
+
speech: boolean;
|
1773
|
+
attachments: boolean;
|
1774
|
+
feedback: boolean;
|
1775
|
+
}>;
|
1776
|
+
messages: readonly ThreadMessage[];
|
1777
|
+
suggestions: readonly ThreadSuggestion[];
|
1778
|
+
extras: unknown;
|
1779
|
+
speech: Readonly<{
|
1780
|
+
messageId: string;
|
1781
|
+
status: SpeechSynthesisAdapter.Status;
|
1782
|
+
}> | undefined;
|
1783
|
+
}>;
|
1784
|
+
unstable_getCore(): Readonly<{
|
1785
|
+
getMessageById: (messageId: string) => {
|
1786
|
+
parentId: string | null;
|
1787
|
+
message: ThreadMessage;
|
1788
|
+
} | undefined;
|
1789
|
+
getBranches: (messageId: string) => readonly string[];
|
1790
|
+
switchToBranch: (branchId: string) => void;
|
1791
|
+
append: (message: AppendMessage) => void;
|
1792
|
+
startRun: (parentId: string | null) => void;
|
1793
|
+
cancelRun: () => void;
|
1794
|
+
addToolResult: (options: AddToolResultOptions) => void;
|
1795
|
+
speak: (messageId: string) => void;
|
1796
|
+
stopSpeaking: () => void;
|
1797
|
+
getSubmittedFeedback: (messageId: string) => SubmittedFeedback | undefined;
|
1798
|
+
submitFeedback: (feedback: SubmitFeedbackOptions) => void;
|
1799
|
+
getModelConfig: () => ModelConfig;
|
1800
|
+
composer: ThreadComposerRuntimeCore;
|
1801
|
+
getEditComposer: (messageId: string) => ComposerRuntimeCore | undefined;
|
1802
|
+
beginEdit: (messageId: string) => void;
|
1803
|
+
speech: Readonly<{
|
1804
|
+
messageId: string;
|
1805
|
+
status: SpeechSynthesisAdapter.Status;
|
1806
|
+
}> | undefined;
|
1807
|
+
capabilities: Readonly<Readonly<{
|
1808
|
+
switchToBranch: boolean;
|
1809
|
+
edit: boolean;
|
1810
|
+
reload: boolean;
|
1811
|
+
cancel: boolean;
|
1812
|
+
unstable_copy: boolean;
|
1813
|
+
speech: boolean;
|
1814
|
+
attachments: boolean;
|
1815
|
+
feedback: boolean;
|
1816
|
+
}>>;
|
1817
|
+
threadId: string;
|
1818
|
+
isDisabled: boolean;
|
1819
|
+
messages: readonly ThreadMessage[];
|
1820
|
+
suggestions: readonly ThreadSuggestion[];
|
1821
|
+
extras: unknown;
|
1822
|
+
subscribe: (callback: () => void) => Unsubscribe;
|
1823
|
+
import(repository: ExportedMessageRepository): void;
|
1824
|
+
export(): ExportedMessageRepository;
|
1825
|
+
unstable_on(event: ThreadRuntimeEventType, callback: () => void): Unsubscribe;
|
1826
|
+
}>;
|
1827
|
+
append(message: CreateAppendMessage): void;
|
1828
|
+
startRun(parentId: string | null): void;
|
1829
|
+
subscribe(callback: () => void): Unsubscribe;
|
1830
|
+
cancelRun(): void;
|
1831
|
+
getModelConfig(): ModelConfig;
|
1832
|
+
export(): ExportedMessageRepository;
|
1833
|
+
import(repository: ExportedMessageRepository): void;
|
1834
|
+
getMesssageByIndex(idx: number): MessageRuntime;
|
1835
|
+
getMesssageById(messageId: string): MessageRuntime;
|
1836
|
+
stopSpeaking: () => void;
|
1837
|
+
unstable_on(event: ThreadRuntimeEventType, callback: () => void): Unsubscribe;
|
1838
|
+
capabilities: Readonly<Readonly<{
|
1839
|
+
switchToBranch: boolean;
|
1840
|
+
edit: boolean;
|
1841
|
+
reload: boolean;
|
1842
|
+
cancel: boolean;
|
1843
|
+
unstable_copy: boolean;
|
1844
|
+
speech: boolean;
|
1845
|
+
attachments: boolean;
|
1846
|
+
feedback: boolean;
|
1847
|
+
}>>;
|
1848
|
+
threadId: string;
|
1849
|
+
isDisabled: boolean;
|
1850
|
+
isRunning: boolean;
|
1851
|
+
messages: readonly ThreadMessage[];
|
1852
|
+
suggestions: readonly ThreadSuggestion[];
|
1853
|
+
speech: Readonly<{
|
1854
|
+
messageId: string;
|
1855
|
+
status: SpeechSynthesisAdapter.Status;
|
1856
|
+
}> | undefined;
|
1857
|
+
extras: unknown;
|
1858
|
+
getBranches: (messageId: string) => readonly string[];
|
1859
|
+
switchToBranch: (branchId: string) => void;
|
1860
|
+
addToolResult: (options: AddToolResultOptions) => void;
|
1861
|
+
speak: (messageId: string) => void;
|
1862
|
+
getSubmittedFeedback: (messageId: string) => SubmittedFeedback | undefined;
|
1863
|
+
submitFeedback: (feedback: SubmitFeedbackOptions) => void;
|
1864
|
+
getEditComposer: (messageId: string) => ComposerRuntimeCore | undefined;
|
1865
|
+
beginEdit: (messageId: string) => void;
|
1866
|
+
}>>;
|
1388
1867
|
(options: {
|
1389
1868
|
optional: true;
|
1390
|
-
}):
|
1391
|
-
|
1392
|
-
|
1393
|
-
|
1394
|
-
|
1869
|
+
}): ReadonlyStore<Readonly<{
|
1870
|
+
readonly path: ThreadRuntimePath;
|
1871
|
+
readonly composer: ThreadComposerRuntime;
|
1872
|
+
getState(): Readonly<{
|
1873
|
+
threadId: string;
|
1874
|
+
isDisabled: boolean;
|
1875
|
+
isRunning: boolean;
|
1876
|
+
capabilities: Readonly<{
|
1877
|
+
switchToBranch: boolean;
|
1878
|
+
edit: boolean;
|
1879
|
+
reload: boolean;
|
1880
|
+
cancel: boolean;
|
1881
|
+
unstable_copy: boolean;
|
1882
|
+
speech: boolean;
|
1883
|
+
attachments: boolean;
|
1884
|
+
feedback: boolean;
|
1885
|
+
}>;
|
1886
|
+
messages: readonly ThreadMessage[];
|
1887
|
+
suggestions: readonly ThreadSuggestion[];
|
1888
|
+
extras: unknown;
|
1889
|
+
speech: Readonly<{
|
1890
|
+
messageId: string;
|
1891
|
+
status: SpeechSynthesisAdapter.Status;
|
1892
|
+
}> | undefined;
|
1893
|
+
}>;
|
1894
|
+
unstable_getCore(): Readonly<{
|
1895
|
+
getMessageById: (messageId: string) => {
|
1896
|
+
parentId: string | null;
|
1897
|
+
message: ThreadMessage;
|
1898
|
+
} | undefined;
|
1899
|
+
getBranches: (messageId: string) => readonly string[];
|
1900
|
+
switchToBranch: (branchId: string) => void;
|
1901
|
+
append: (message: AppendMessage) => void;
|
1902
|
+
startRun: (parentId: string | null) => void;
|
1903
|
+
cancelRun: () => void;
|
1904
|
+
addToolResult: (options: AddToolResultOptions) => void;
|
1905
|
+
speak: (messageId: string) => void;
|
1906
|
+
stopSpeaking: () => void;
|
1907
|
+
getSubmittedFeedback: (messageId: string) => SubmittedFeedback | undefined;
|
1908
|
+
submitFeedback: (feedback: SubmitFeedbackOptions) => void;
|
1909
|
+
getModelConfig: () => ModelConfig;
|
1910
|
+
composer: ThreadComposerRuntimeCore;
|
1911
|
+
getEditComposer: (messageId: string) => ComposerRuntimeCore | undefined;
|
1912
|
+
beginEdit: (messageId: string) => void;
|
1913
|
+
speech: Readonly<{
|
1914
|
+
messageId: string;
|
1915
|
+
status: SpeechSynthesisAdapter.Status;
|
1916
|
+
}> | undefined;
|
1917
|
+
capabilities: Readonly<Readonly<{
|
1918
|
+
switchToBranch: boolean;
|
1919
|
+
edit: boolean;
|
1920
|
+
reload: boolean;
|
1921
|
+
cancel: boolean;
|
1922
|
+
unstable_copy: boolean;
|
1923
|
+
speech: boolean;
|
1924
|
+
attachments: boolean;
|
1925
|
+
feedback: boolean;
|
1926
|
+
}>>;
|
1927
|
+
threadId: string;
|
1928
|
+
isDisabled: boolean;
|
1929
|
+
messages: readonly ThreadMessage[];
|
1930
|
+
suggestions: readonly ThreadSuggestion[];
|
1931
|
+
extras: unknown;
|
1932
|
+
subscribe: (callback: () => void) => Unsubscribe;
|
1933
|
+
import(repository: ExportedMessageRepository): void;
|
1934
|
+
export(): ExportedMessageRepository;
|
1935
|
+
unstable_on(event: ThreadRuntimeEventType, callback: () => void): Unsubscribe;
|
1936
|
+
}>;
|
1937
|
+
append(message: CreateAppendMessage): void;
|
1938
|
+
startRun(parentId: string | null): void;
|
1939
|
+
subscribe(callback: () => void): Unsubscribe;
|
1940
|
+
cancelRun(): void;
|
1941
|
+
getModelConfig(): ModelConfig;
|
1942
|
+
export(): ExportedMessageRepository;
|
1943
|
+
import(repository: ExportedMessageRepository): void;
|
1944
|
+
getMesssageByIndex(idx: number): MessageRuntime;
|
1945
|
+
getMesssageById(messageId: string): MessageRuntime;
|
1946
|
+
stopSpeaking: () => void;
|
1947
|
+
unstable_on(event: ThreadRuntimeEventType, callback: () => void): Unsubscribe;
|
1948
|
+
capabilities: Readonly<Readonly<{
|
1949
|
+
switchToBranch: boolean;
|
1950
|
+
edit: boolean;
|
1951
|
+
reload: boolean;
|
1952
|
+
cancel: boolean;
|
1953
|
+
unstable_copy: boolean;
|
1954
|
+
speech: boolean;
|
1955
|
+
attachments: boolean;
|
1956
|
+
feedback: boolean;
|
1957
|
+
}>>;
|
1958
|
+
threadId: string;
|
1959
|
+
isDisabled: boolean;
|
1960
|
+
isRunning: boolean;
|
1961
|
+
messages: readonly ThreadMessage[];
|
1962
|
+
suggestions: readonly ThreadSuggestion[];
|
1963
|
+
speech: Readonly<{
|
1964
|
+
messageId: string;
|
1965
|
+
status: SpeechSynthesisAdapter.Status;
|
1966
|
+
}> | undefined;
|
1967
|
+
extras: unknown;
|
1968
|
+
getBranches: (messageId: string) => readonly string[];
|
1969
|
+
switchToBranch: (branchId: string) => void;
|
1970
|
+
addToolResult: (options: AddToolResultOptions) => void;
|
1971
|
+
speak: (messageId: string) => void;
|
1972
|
+
getSubmittedFeedback: (messageId: string) => SubmittedFeedback | undefined;
|
1973
|
+
submitFeedback: (feedback: SubmitFeedbackOptions) => void;
|
1974
|
+
getEditComposer: (messageId: string) => ComposerRuntimeCore | undefined;
|
1975
|
+
beginEdit: (messageId: string) => void;
|
1976
|
+
}>> | null;
|
1395
1977
|
};
|
1396
1978
|
/**
|
1397
|
-
* @deprecated Use `
|
1979
|
+
* @deprecated Use `useThreadRuntime` instead. This will be removed in 0.6.0.
|
1398
1980
|
*/
|
1399
|
-
declare const
|
1400
|
-
(): ReadonlyStore<AssistantRuntime>;
|
1401
|
-
(options: {
|
1402
|
-
optional: true;
|
1403
|
-
}): ReadonlyStore<AssistantRuntime> | null;
|
1404
|
-
};
|
1405
|
-
declare const useToolUIs: {
|
1981
|
+
declare const useThreadActions: {
|
1406
1982
|
(): Readonly<{
|
1407
|
-
|
1408
|
-
|
1983
|
+
readonly path: ThreadRuntimePath;
|
1984
|
+
readonly composer: ThreadComposerRuntime;
|
1985
|
+
getState(): Readonly<{
|
1986
|
+
threadId: string;
|
1987
|
+
isDisabled: boolean;
|
1988
|
+
isRunning: boolean;
|
1989
|
+
capabilities: Readonly<{
|
1990
|
+
switchToBranch: boolean;
|
1991
|
+
edit: boolean;
|
1992
|
+
reload: boolean;
|
1993
|
+
cancel: boolean;
|
1994
|
+
unstable_copy: boolean;
|
1995
|
+
speech: boolean;
|
1996
|
+
attachments: boolean;
|
1997
|
+
feedback: boolean;
|
1998
|
+
}>;
|
1999
|
+
messages: readonly ThreadMessage[];
|
2000
|
+
suggestions: readonly ThreadSuggestion[];
|
2001
|
+
extras: unknown;
|
2002
|
+
speech: Readonly<{
|
2003
|
+
messageId: string;
|
2004
|
+
status: SpeechSynthesisAdapter.Status;
|
2005
|
+
}> | undefined;
|
2006
|
+
}>;
|
2007
|
+
unstable_getCore(): Readonly<{
|
2008
|
+
getMessageById: (messageId: string) => {
|
2009
|
+
parentId: string | null;
|
2010
|
+
message: ThreadMessage;
|
2011
|
+
} | undefined;
|
2012
|
+
getBranches: (messageId: string) => readonly string[];
|
2013
|
+
switchToBranch: (branchId: string) => void;
|
2014
|
+
append: (message: AppendMessage) => void;
|
2015
|
+
startRun: (parentId: string | null) => void;
|
2016
|
+
cancelRun: () => void;
|
2017
|
+
addToolResult: (options: AddToolResultOptions) => void;
|
2018
|
+
speak: (messageId: string) => void;
|
2019
|
+
stopSpeaking: () => void;
|
2020
|
+
getSubmittedFeedback: (messageId: string) => SubmittedFeedback | undefined;
|
2021
|
+
submitFeedback: (feedback: SubmitFeedbackOptions) => void;
|
2022
|
+
getModelConfig: () => ModelConfig;
|
2023
|
+
composer: ThreadComposerRuntimeCore;
|
2024
|
+
getEditComposer: (messageId: string) => ComposerRuntimeCore | undefined;
|
2025
|
+
beginEdit: (messageId: string) => void;
|
2026
|
+
speech: Readonly<{
|
2027
|
+
messageId: string;
|
2028
|
+
status: SpeechSynthesisAdapter.Status;
|
2029
|
+
}> | undefined;
|
2030
|
+
capabilities: Readonly<Readonly<{
|
2031
|
+
switchToBranch: boolean;
|
2032
|
+
edit: boolean;
|
2033
|
+
reload: boolean;
|
2034
|
+
cancel: boolean;
|
2035
|
+
unstable_copy: boolean;
|
2036
|
+
speech: boolean;
|
2037
|
+
attachments: boolean;
|
2038
|
+
feedback: boolean;
|
2039
|
+
}>>;
|
2040
|
+
threadId: string;
|
2041
|
+
isDisabled: boolean;
|
2042
|
+
messages: readonly ThreadMessage[];
|
2043
|
+
suggestions: readonly ThreadSuggestion[];
|
2044
|
+
extras: unknown;
|
2045
|
+
subscribe: (callback: () => void) => Unsubscribe;
|
2046
|
+
import(repository: ExportedMessageRepository): void;
|
2047
|
+
export(): ExportedMessageRepository;
|
2048
|
+
unstable_on(event: ThreadRuntimeEventType, callback: () => void): Unsubscribe;
|
2049
|
+
}>;
|
2050
|
+
append(message: CreateAppendMessage): void;
|
2051
|
+
startRun(parentId: string | null): void;
|
2052
|
+
subscribe(callback: () => void): Unsubscribe;
|
2053
|
+
cancelRun(): void;
|
2054
|
+
getModelConfig(): ModelConfig;
|
2055
|
+
export(): ExportedMessageRepository;
|
2056
|
+
import(repository: ExportedMessageRepository): void;
|
2057
|
+
getMesssageByIndex(idx: number): MessageRuntime;
|
2058
|
+
getMesssageById(messageId: string): MessageRuntime;
|
2059
|
+
stopSpeaking: () => void;
|
2060
|
+
unstable_on(event: ThreadRuntimeEventType, callback: () => void): Unsubscribe;
|
2061
|
+
capabilities: Readonly<Readonly<{
|
2062
|
+
switchToBranch: boolean;
|
2063
|
+
edit: boolean;
|
2064
|
+
reload: boolean;
|
2065
|
+
cancel: boolean;
|
2066
|
+
unstable_copy: boolean;
|
2067
|
+
speech: boolean;
|
2068
|
+
attachments: boolean;
|
2069
|
+
feedback: boolean;
|
2070
|
+
}>>;
|
2071
|
+
threadId: string;
|
2072
|
+
isDisabled: boolean;
|
2073
|
+
isRunning: boolean;
|
2074
|
+
messages: readonly ThreadMessage[];
|
2075
|
+
suggestions: readonly ThreadSuggestion[];
|
2076
|
+
speech: Readonly<{
|
2077
|
+
messageId: string;
|
2078
|
+
status: SpeechSynthesisAdapter.Status;
|
2079
|
+
}> | undefined;
|
2080
|
+
extras: unknown;
|
2081
|
+
getBranches: (messageId: string) => readonly string[];
|
2082
|
+
switchToBranch: (branchId: string) => void;
|
2083
|
+
addToolResult: (options: AddToolResultOptions) => void;
|
2084
|
+
speak: (messageId: string) => void;
|
2085
|
+
getSubmittedFeedback: (messageId: string) => SubmittedFeedback | undefined;
|
2086
|
+
submitFeedback: (feedback: SubmitFeedbackOptions) => void;
|
2087
|
+
getEditComposer: (messageId: string) => ComposerRuntimeCore | undefined;
|
2088
|
+
beginEdit: (messageId: string) => void;
|
1409
2089
|
}>;
|
1410
2090
|
<TSelected>(selector: (state: Readonly<{
|
1411
|
-
|
1412
|
-
|
2091
|
+
readonly path: ThreadRuntimePath;
|
2092
|
+
readonly composer: ThreadComposerRuntime;
|
2093
|
+
getState(): Readonly<{
|
2094
|
+
threadId: string;
|
2095
|
+
isDisabled: boolean;
|
2096
|
+
isRunning: boolean;
|
2097
|
+
capabilities: Readonly<{
|
2098
|
+
switchToBranch: boolean;
|
2099
|
+
edit: boolean;
|
2100
|
+
reload: boolean;
|
2101
|
+
cancel: boolean;
|
2102
|
+
unstable_copy: boolean;
|
2103
|
+
speech: boolean;
|
2104
|
+
attachments: boolean;
|
2105
|
+
feedback: boolean;
|
2106
|
+
}>;
|
2107
|
+
messages: readonly ThreadMessage[];
|
2108
|
+
suggestions: readonly ThreadSuggestion[];
|
2109
|
+
extras: unknown;
|
2110
|
+
speech: Readonly<{
|
2111
|
+
messageId: string;
|
2112
|
+
status: SpeechSynthesisAdapter.Status;
|
2113
|
+
}> | undefined;
|
2114
|
+
}>;
|
2115
|
+
unstable_getCore(): Readonly<{
|
2116
|
+
getMessageById: (messageId: string) => {
|
2117
|
+
parentId: string | null;
|
2118
|
+
message: ThreadMessage;
|
2119
|
+
} | undefined;
|
2120
|
+
getBranches: (messageId: string) => readonly string[];
|
2121
|
+
switchToBranch: (branchId: string) => void;
|
2122
|
+
append: (message: AppendMessage) => void;
|
2123
|
+
startRun: (parentId: string | null) => void;
|
2124
|
+
cancelRun: () => void;
|
2125
|
+
addToolResult: (options: AddToolResultOptions) => void;
|
2126
|
+
speak: (messageId: string) => void;
|
2127
|
+
stopSpeaking: () => void;
|
2128
|
+
getSubmittedFeedback: (messageId: string) => SubmittedFeedback | undefined;
|
2129
|
+
submitFeedback: (feedback: SubmitFeedbackOptions) => void;
|
2130
|
+
getModelConfig: () => ModelConfig;
|
2131
|
+
composer: ThreadComposerRuntimeCore;
|
2132
|
+
getEditComposer: (messageId: string) => ComposerRuntimeCore | undefined;
|
2133
|
+
beginEdit: (messageId: string) => void;
|
2134
|
+
speech: Readonly<{
|
2135
|
+
messageId: string;
|
2136
|
+
status: SpeechSynthesisAdapter.Status;
|
2137
|
+
}> | undefined;
|
2138
|
+
capabilities: Readonly<Readonly<{
|
2139
|
+
switchToBranch: boolean;
|
2140
|
+
edit: boolean;
|
2141
|
+
reload: boolean;
|
2142
|
+
cancel: boolean;
|
2143
|
+
unstable_copy: boolean;
|
2144
|
+
speech: boolean;
|
2145
|
+
attachments: boolean;
|
2146
|
+
feedback: boolean;
|
2147
|
+
}>>;
|
2148
|
+
threadId: string;
|
2149
|
+
isDisabled: boolean;
|
2150
|
+
messages: readonly ThreadMessage[];
|
2151
|
+
suggestions: readonly ThreadSuggestion[];
|
2152
|
+
extras: unknown;
|
2153
|
+
subscribe: (callback: () => void) => Unsubscribe;
|
2154
|
+
import(repository: ExportedMessageRepository): void;
|
2155
|
+
export(): ExportedMessageRepository;
|
2156
|
+
unstable_on(event: ThreadRuntimeEventType, callback: () => void): Unsubscribe;
|
2157
|
+
}>;
|
2158
|
+
append(message: CreateAppendMessage): void;
|
2159
|
+
startRun(parentId: string | null): void;
|
2160
|
+
subscribe(callback: () => void): Unsubscribe;
|
2161
|
+
cancelRun(): void;
|
2162
|
+
getModelConfig(): ModelConfig;
|
2163
|
+
export(): ExportedMessageRepository;
|
2164
|
+
import(repository: ExportedMessageRepository): void;
|
2165
|
+
getMesssageByIndex(idx: number): MessageRuntime;
|
2166
|
+
getMesssageById(messageId: string): MessageRuntime;
|
2167
|
+
stopSpeaking: () => void;
|
2168
|
+
unstable_on(event: ThreadRuntimeEventType, callback: () => void): Unsubscribe;
|
2169
|
+
capabilities: Readonly<Readonly<{
|
2170
|
+
switchToBranch: boolean;
|
2171
|
+
edit: boolean;
|
2172
|
+
reload: boolean;
|
2173
|
+
cancel: boolean;
|
2174
|
+
unstable_copy: boolean;
|
2175
|
+
speech: boolean;
|
2176
|
+
attachments: boolean;
|
2177
|
+
feedback: boolean;
|
2178
|
+
}>>;
|
2179
|
+
threadId: string;
|
2180
|
+
isDisabled: boolean;
|
2181
|
+
isRunning: boolean;
|
2182
|
+
messages: readonly ThreadMessage[];
|
2183
|
+
suggestions: readonly ThreadSuggestion[];
|
2184
|
+
speech: Readonly<{
|
2185
|
+
messageId: string;
|
2186
|
+
status: SpeechSynthesisAdapter.Status;
|
2187
|
+
}> | undefined;
|
2188
|
+
extras: unknown;
|
2189
|
+
getBranches: (messageId: string) => readonly string[];
|
2190
|
+
switchToBranch: (branchId: string) => void;
|
2191
|
+
addToolResult: (options: AddToolResultOptions) => void;
|
2192
|
+
speak: (messageId: string) => void;
|
2193
|
+
getSubmittedFeedback: (messageId: string) => SubmittedFeedback | undefined;
|
2194
|
+
submitFeedback: (feedback: SubmitFeedbackOptions) => void;
|
2195
|
+
getEditComposer: (messageId: string) => ComposerRuntimeCore | undefined;
|
2196
|
+
beginEdit: (messageId: string) => void;
|
1413
2197
|
}>) => TSelected): TSelected;
|
1414
2198
|
(options: {
|
1415
2199
|
optional: true;
|
1416
2200
|
}): Readonly<{
|
1417
|
-
|
1418
|
-
|
2201
|
+
readonly path: ThreadRuntimePath;
|
2202
|
+
readonly composer: ThreadComposerRuntime;
|
2203
|
+
getState(): Readonly<{
|
2204
|
+
threadId: string;
|
2205
|
+
isDisabled: boolean;
|
2206
|
+
isRunning: boolean;
|
2207
|
+
capabilities: Readonly<{
|
2208
|
+
switchToBranch: boolean;
|
2209
|
+
edit: boolean;
|
2210
|
+
reload: boolean;
|
2211
|
+
cancel: boolean;
|
2212
|
+
unstable_copy: boolean;
|
2213
|
+
speech: boolean;
|
2214
|
+
attachments: boolean;
|
2215
|
+
feedback: boolean;
|
2216
|
+
}>;
|
2217
|
+
messages: readonly ThreadMessage[];
|
2218
|
+
suggestions: readonly ThreadSuggestion[];
|
2219
|
+
extras: unknown;
|
2220
|
+
speech: Readonly<{
|
2221
|
+
messageId: string;
|
2222
|
+
status: SpeechSynthesisAdapter.Status;
|
2223
|
+
}> | undefined;
|
2224
|
+
}>;
|
2225
|
+
unstable_getCore(): Readonly<{
|
2226
|
+
getMessageById: (messageId: string) => {
|
2227
|
+
parentId: string | null;
|
2228
|
+
message: ThreadMessage;
|
2229
|
+
} | undefined;
|
2230
|
+
getBranches: (messageId: string) => readonly string[];
|
2231
|
+
switchToBranch: (branchId: string) => void;
|
2232
|
+
append: (message: AppendMessage) => void;
|
2233
|
+
startRun: (parentId: string | null) => void;
|
2234
|
+
cancelRun: () => void;
|
2235
|
+
addToolResult: (options: AddToolResultOptions) => void;
|
2236
|
+
speak: (messageId: string) => void;
|
2237
|
+
stopSpeaking: () => void;
|
2238
|
+
getSubmittedFeedback: (messageId: string) => SubmittedFeedback | undefined;
|
2239
|
+
submitFeedback: (feedback: SubmitFeedbackOptions) => void;
|
2240
|
+
getModelConfig: () => ModelConfig;
|
2241
|
+
composer: ThreadComposerRuntimeCore;
|
2242
|
+
getEditComposer: (messageId: string) => ComposerRuntimeCore | undefined;
|
2243
|
+
beginEdit: (messageId: string) => void;
|
2244
|
+
speech: Readonly<{
|
2245
|
+
messageId: string;
|
2246
|
+
status: SpeechSynthesisAdapter.Status;
|
2247
|
+
}> | undefined;
|
2248
|
+
capabilities: Readonly<Readonly<{
|
2249
|
+
switchToBranch: boolean;
|
2250
|
+
edit: boolean;
|
2251
|
+
reload: boolean;
|
2252
|
+
cancel: boolean;
|
2253
|
+
unstable_copy: boolean;
|
2254
|
+
speech: boolean;
|
2255
|
+
attachments: boolean;
|
2256
|
+
feedback: boolean;
|
2257
|
+
}>>;
|
2258
|
+
threadId: string;
|
2259
|
+
isDisabled: boolean;
|
2260
|
+
messages: readonly ThreadMessage[];
|
2261
|
+
suggestions: readonly ThreadSuggestion[];
|
2262
|
+
extras: unknown;
|
2263
|
+
subscribe: (callback: () => void) => Unsubscribe;
|
2264
|
+
import(repository: ExportedMessageRepository): void;
|
2265
|
+
export(): ExportedMessageRepository;
|
2266
|
+
unstable_on(event: ThreadRuntimeEventType, callback: () => void): Unsubscribe;
|
2267
|
+
}>;
|
2268
|
+
append(message: CreateAppendMessage): void;
|
2269
|
+
startRun(parentId: string | null): void;
|
2270
|
+
subscribe(callback: () => void): Unsubscribe;
|
2271
|
+
cancelRun(): void;
|
2272
|
+
getModelConfig(): ModelConfig;
|
2273
|
+
export(): ExportedMessageRepository;
|
2274
|
+
import(repository: ExportedMessageRepository): void;
|
2275
|
+
getMesssageByIndex(idx: number): MessageRuntime;
|
2276
|
+
getMesssageById(messageId: string): MessageRuntime;
|
2277
|
+
stopSpeaking: () => void;
|
2278
|
+
unstable_on(event: ThreadRuntimeEventType, callback: () => void): Unsubscribe;
|
2279
|
+
capabilities: Readonly<Readonly<{
|
2280
|
+
switchToBranch: boolean;
|
2281
|
+
edit: boolean;
|
2282
|
+
reload: boolean;
|
2283
|
+
cancel: boolean;
|
2284
|
+
unstable_copy: boolean;
|
2285
|
+
speech: boolean;
|
2286
|
+
attachments: boolean;
|
2287
|
+
feedback: boolean;
|
2288
|
+
}>>;
|
2289
|
+
threadId: string;
|
2290
|
+
isDisabled: boolean;
|
2291
|
+
isRunning: boolean;
|
2292
|
+
messages: readonly ThreadMessage[];
|
2293
|
+
suggestions: readonly ThreadSuggestion[];
|
2294
|
+
speech: Readonly<{
|
2295
|
+
messageId: string;
|
2296
|
+
status: SpeechSynthesisAdapter.Status;
|
2297
|
+
}> | undefined;
|
2298
|
+
extras: unknown;
|
2299
|
+
getBranches: (messageId: string) => readonly string[];
|
2300
|
+
switchToBranch: (branchId: string) => void;
|
2301
|
+
addToolResult: (options: AddToolResultOptions) => void;
|
2302
|
+
speak: (messageId: string) => void;
|
2303
|
+
getSubmittedFeedback: (messageId: string) => SubmittedFeedback | undefined;
|
2304
|
+
submitFeedback: (feedback: SubmitFeedbackOptions) => void;
|
2305
|
+
getEditComposer: (messageId: string) => ComposerRuntimeCore | undefined;
|
2306
|
+
beginEdit: (messageId: string) => void;
|
1419
2307
|
}> | null;
|
1420
2308
|
<TSelected>(options: {
|
1421
2309
|
optional: true;
|
1422
2310
|
selector?: (state: Readonly<{
|
1423
|
-
|
1424
|
-
|
2311
|
+
readonly path: ThreadRuntimePath;
|
2312
|
+
readonly composer: ThreadComposerRuntime;
|
2313
|
+
getState(): Readonly<{
|
2314
|
+
threadId: string;
|
2315
|
+
isDisabled: boolean;
|
2316
|
+
isRunning: boolean;
|
2317
|
+
capabilities: Readonly<{
|
2318
|
+
switchToBranch: boolean;
|
2319
|
+
edit: boolean;
|
2320
|
+
reload: boolean;
|
2321
|
+
cancel: boolean;
|
2322
|
+
unstable_copy: boolean;
|
2323
|
+
speech: boolean;
|
2324
|
+
attachments: boolean;
|
2325
|
+
feedback: boolean;
|
2326
|
+
}>;
|
2327
|
+
messages: readonly ThreadMessage[];
|
2328
|
+
suggestions: readonly ThreadSuggestion[];
|
2329
|
+
extras: unknown;
|
2330
|
+
speech: Readonly<{
|
2331
|
+
messageId: string;
|
2332
|
+
status: SpeechSynthesisAdapter.Status;
|
2333
|
+
}> | undefined;
|
2334
|
+
}>;
|
2335
|
+
unstable_getCore(): Readonly<{
|
2336
|
+
getMessageById: (messageId: string) => {
|
2337
|
+
parentId: string | null;
|
2338
|
+
message: ThreadMessage;
|
2339
|
+
} | undefined;
|
2340
|
+
getBranches: (messageId: string) => readonly string[];
|
2341
|
+
switchToBranch: (branchId: string) => void;
|
2342
|
+
append: (message: AppendMessage) => void;
|
2343
|
+
startRun: (parentId: string | null) => void;
|
2344
|
+
cancelRun: () => void;
|
2345
|
+
addToolResult: (options: AddToolResultOptions) => void;
|
2346
|
+
speak: (messageId: string) => void;
|
2347
|
+
stopSpeaking: () => void;
|
2348
|
+
getSubmittedFeedback: (messageId: string) => SubmittedFeedback | undefined;
|
2349
|
+
submitFeedback: (feedback: SubmitFeedbackOptions) => void;
|
2350
|
+
getModelConfig: () => ModelConfig;
|
2351
|
+
composer: ThreadComposerRuntimeCore;
|
2352
|
+
getEditComposer: (messageId: string) => ComposerRuntimeCore | undefined;
|
2353
|
+
beginEdit: (messageId: string) => void;
|
2354
|
+
speech: Readonly<{
|
2355
|
+
messageId: string;
|
2356
|
+
status: SpeechSynthesisAdapter.Status;
|
2357
|
+
}> | undefined;
|
2358
|
+
capabilities: Readonly<Readonly<{
|
2359
|
+
switchToBranch: boolean;
|
2360
|
+
edit: boolean;
|
2361
|
+
reload: boolean;
|
2362
|
+
cancel: boolean;
|
2363
|
+
unstable_copy: boolean;
|
2364
|
+
speech: boolean;
|
2365
|
+
attachments: boolean;
|
2366
|
+
feedback: boolean;
|
2367
|
+
}>>;
|
2368
|
+
threadId: string;
|
2369
|
+
isDisabled: boolean;
|
2370
|
+
messages: readonly ThreadMessage[];
|
2371
|
+
suggestions: readonly ThreadSuggestion[];
|
2372
|
+
extras: unknown;
|
2373
|
+
subscribe: (callback: () => void) => Unsubscribe;
|
2374
|
+
import(repository: ExportedMessageRepository): void;
|
2375
|
+
export(): ExportedMessageRepository;
|
2376
|
+
unstable_on(event: ThreadRuntimeEventType, callback: () => void): Unsubscribe;
|
2377
|
+
}>;
|
2378
|
+
append(message: CreateAppendMessage): void;
|
2379
|
+
startRun(parentId: string | null): void;
|
2380
|
+
subscribe(callback: () => void): Unsubscribe;
|
2381
|
+
cancelRun(): void;
|
2382
|
+
getModelConfig(): ModelConfig;
|
2383
|
+
export(): ExportedMessageRepository;
|
2384
|
+
import(repository: ExportedMessageRepository): void;
|
2385
|
+
getMesssageByIndex(idx: number): MessageRuntime;
|
2386
|
+
getMesssageById(messageId: string): MessageRuntime;
|
2387
|
+
stopSpeaking: () => void;
|
2388
|
+
unstable_on(event: ThreadRuntimeEventType, callback: () => void): Unsubscribe;
|
2389
|
+
capabilities: Readonly<Readonly<{
|
2390
|
+
switchToBranch: boolean;
|
2391
|
+
edit: boolean;
|
2392
|
+
reload: boolean;
|
2393
|
+
cancel: boolean;
|
2394
|
+
unstable_copy: boolean;
|
2395
|
+
speech: boolean;
|
2396
|
+
attachments: boolean;
|
2397
|
+
feedback: boolean;
|
2398
|
+
}>>;
|
2399
|
+
threadId: string;
|
2400
|
+
isDisabled: boolean;
|
2401
|
+
isRunning: boolean;
|
2402
|
+
messages: readonly ThreadMessage[];
|
2403
|
+
suggestions: readonly ThreadSuggestion[];
|
2404
|
+
speech: Readonly<{
|
2405
|
+
messageId: string;
|
2406
|
+
status: SpeechSynthesisAdapter.Status;
|
2407
|
+
}> | undefined;
|
2408
|
+
extras: unknown;
|
2409
|
+
getBranches: (messageId: string) => readonly string[];
|
2410
|
+
switchToBranch: (branchId: string) => void;
|
2411
|
+
addToolResult: (options: AddToolResultOptions) => void;
|
2412
|
+
speak: (messageId: string) => void;
|
2413
|
+
getSubmittedFeedback: (messageId: string) => SubmittedFeedback | undefined;
|
2414
|
+
submitFeedback: (feedback: SubmitFeedbackOptions) => void;
|
2415
|
+
getEditComposer: (messageId: string) => ComposerRuntimeCore | undefined;
|
2416
|
+
beginEdit: (messageId: string) => void;
|
1425
2417
|
}>) => TSelected;
|
1426
2418
|
}): TSelected | null;
|
1427
2419
|
};
|
1428
|
-
|
2420
|
+
/**
|
2421
|
+
* @deprecated Use `useThreadRuntime` instead. This will be removed in 0.6.0.
|
2422
|
+
*/
|
2423
|
+
declare const useThreadRuntimeStore: {
|
1429
2424
|
(): ReadonlyStore<Readonly<{
|
1430
|
-
|
1431
|
-
|
2425
|
+
readonly path: ThreadRuntimePath;
|
2426
|
+
readonly composer: ThreadComposerRuntime;
|
2427
|
+
getState(): Readonly<{
|
2428
|
+
threadId: string;
|
2429
|
+
isDisabled: boolean;
|
2430
|
+
isRunning: boolean;
|
2431
|
+
capabilities: Readonly<{
|
2432
|
+
switchToBranch: boolean;
|
2433
|
+
edit: boolean;
|
2434
|
+
reload: boolean;
|
2435
|
+
cancel: boolean;
|
2436
|
+
unstable_copy: boolean;
|
2437
|
+
speech: boolean;
|
2438
|
+
attachments: boolean;
|
2439
|
+
feedback: boolean;
|
2440
|
+
}>;
|
2441
|
+
messages: readonly ThreadMessage[];
|
2442
|
+
suggestions: readonly ThreadSuggestion[];
|
2443
|
+
extras: unknown;
|
2444
|
+
speech: Readonly<{
|
2445
|
+
messageId: string;
|
2446
|
+
status: SpeechSynthesisAdapter.Status;
|
2447
|
+
}> | undefined;
|
2448
|
+
}>;
|
2449
|
+
unstable_getCore(): Readonly<{
|
2450
|
+
getMessageById: (messageId: string) => {
|
2451
|
+
parentId: string | null;
|
2452
|
+
message: ThreadMessage;
|
2453
|
+
} | undefined;
|
2454
|
+
getBranches: (messageId: string) => readonly string[];
|
2455
|
+
switchToBranch: (branchId: string) => void;
|
2456
|
+
append: (message: AppendMessage) => void;
|
2457
|
+
startRun: (parentId: string | null) => void;
|
2458
|
+
cancelRun: () => void;
|
2459
|
+
addToolResult: (options: AddToolResultOptions) => void;
|
2460
|
+
speak: (messageId: string) => void;
|
2461
|
+
stopSpeaking: () => void;
|
2462
|
+
getSubmittedFeedback: (messageId: string) => SubmittedFeedback | undefined;
|
2463
|
+
submitFeedback: (feedback: SubmitFeedbackOptions) => void;
|
2464
|
+
getModelConfig: () => ModelConfig;
|
2465
|
+
composer: ThreadComposerRuntimeCore;
|
2466
|
+
getEditComposer: (messageId: string) => ComposerRuntimeCore | undefined;
|
2467
|
+
beginEdit: (messageId: string) => void;
|
2468
|
+
speech: Readonly<{
|
2469
|
+
messageId: string;
|
2470
|
+
status: SpeechSynthesisAdapter.Status;
|
2471
|
+
}> | undefined;
|
2472
|
+
capabilities: Readonly<Readonly<{
|
2473
|
+
switchToBranch: boolean;
|
2474
|
+
edit: boolean;
|
2475
|
+
reload: boolean;
|
2476
|
+
cancel: boolean;
|
2477
|
+
unstable_copy: boolean;
|
2478
|
+
speech: boolean;
|
2479
|
+
attachments: boolean;
|
2480
|
+
feedback: boolean;
|
2481
|
+
}>>;
|
2482
|
+
threadId: string;
|
2483
|
+
isDisabled: boolean;
|
2484
|
+
messages: readonly ThreadMessage[];
|
2485
|
+
suggestions: readonly ThreadSuggestion[];
|
2486
|
+
extras: unknown;
|
2487
|
+
subscribe: (callback: () => void) => Unsubscribe;
|
2488
|
+
import(repository: ExportedMessageRepository): void;
|
2489
|
+
export(): ExportedMessageRepository;
|
2490
|
+
unstable_on(event: ThreadRuntimeEventType, callback: () => void): Unsubscribe;
|
2491
|
+
}>;
|
2492
|
+
append(message: CreateAppendMessage): void;
|
2493
|
+
startRun(parentId: string | null): void;
|
2494
|
+
subscribe(callback: () => void): Unsubscribe;
|
2495
|
+
cancelRun(): void;
|
2496
|
+
getModelConfig(): ModelConfig;
|
2497
|
+
export(): ExportedMessageRepository;
|
2498
|
+
import(repository: ExportedMessageRepository): void;
|
2499
|
+
getMesssageByIndex(idx: number): MessageRuntime;
|
2500
|
+
getMesssageById(messageId: string): MessageRuntime;
|
2501
|
+
stopSpeaking: () => void;
|
2502
|
+
unstable_on(event: ThreadRuntimeEventType, callback: () => void): Unsubscribe;
|
2503
|
+
capabilities: Readonly<Readonly<{
|
2504
|
+
switchToBranch: boolean;
|
2505
|
+
edit: boolean;
|
2506
|
+
reload: boolean;
|
2507
|
+
cancel: boolean;
|
2508
|
+
unstable_copy: boolean;
|
2509
|
+
speech: boolean;
|
2510
|
+
attachments: boolean;
|
2511
|
+
feedback: boolean;
|
2512
|
+
}>>;
|
2513
|
+
threadId: string;
|
2514
|
+
isDisabled: boolean;
|
2515
|
+
isRunning: boolean;
|
2516
|
+
messages: readonly ThreadMessage[];
|
2517
|
+
suggestions: readonly ThreadSuggestion[];
|
2518
|
+
speech: Readonly<{
|
2519
|
+
messageId: string;
|
2520
|
+
status: SpeechSynthesisAdapter.Status;
|
2521
|
+
}> | undefined;
|
2522
|
+
extras: unknown;
|
2523
|
+
getBranches: (messageId: string) => readonly string[];
|
2524
|
+
switchToBranch: (branchId: string) => void;
|
2525
|
+
addToolResult: (options: AddToolResultOptions) => void;
|
2526
|
+
speak: (messageId: string) => void;
|
2527
|
+
getSubmittedFeedback: (messageId: string) => SubmittedFeedback | undefined;
|
2528
|
+
submitFeedback: (feedback: SubmitFeedbackOptions) => void;
|
2529
|
+
getEditComposer: (messageId: string) => ComposerRuntimeCore | undefined;
|
2530
|
+
beginEdit: (messageId: string) => void;
|
1432
2531
|
}>>;
|
1433
2532
|
(options: {
|
1434
2533
|
optional: true;
|
1435
2534
|
}): ReadonlyStore<Readonly<{
|
1436
|
-
|
1437
|
-
|
2535
|
+
readonly path: ThreadRuntimePath;
|
2536
|
+
readonly composer: ThreadComposerRuntime;
|
2537
|
+
getState(): Readonly<{
|
2538
|
+
threadId: string;
|
2539
|
+
isDisabled: boolean;
|
2540
|
+
isRunning: boolean;
|
2541
|
+
capabilities: Readonly<{
|
2542
|
+
switchToBranch: boolean;
|
2543
|
+
edit: boolean;
|
2544
|
+
reload: boolean;
|
2545
|
+
cancel: boolean;
|
2546
|
+
unstable_copy: boolean;
|
2547
|
+
speech: boolean;
|
2548
|
+
attachments: boolean;
|
2549
|
+
feedback: boolean;
|
2550
|
+
}>;
|
2551
|
+
messages: readonly ThreadMessage[];
|
2552
|
+
suggestions: readonly ThreadSuggestion[];
|
2553
|
+
extras: unknown;
|
2554
|
+
speech: Readonly<{
|
2555
|
+
messageId: string;
|
2556
|
+
status: SpeechSynthesisAdapter.Status;
|
2557
|
+
}> | undefined;
|
2558
|
+
}>;
|
2559
|
+
unstable_getCore(): Readonly<{
|
2560
|
+
getMessageById: (messageId: string) => {
|
2561
|
+
parentId: string | null;
|
2562
|
+
message: ThreadMessage;
|
2563
|
+
} | undefined;
|
2564
|
+
getBranches: (messageId: string) => readonly string[];
|
2565
|
+
switchToBranch: (branchId: string) => void;
|
2566
|
+
append: (message: AppendMessage) => void;
|
2567
|
+
startRun: (parentId: string | null) => void;
|
2568
|
+
cancelRun: () => void;
|
2569
|
+
addToolResult: (options: AddToolResultOptions) => void;
|
2570
|
+
speak: (messageId: string) => void;
|
2571
|
+
stopSpeaking: () => void;
|
2572
|
+
getSubmittedFeedback: (messageId: string) => SubmittedFeedback | undefined;
|
2573
|
+
submitFeedback: (feedback: SubmitFeedbackOptions) => void;
|
2574
|
+
getModelConfig: () => ModelConfig;
|
2575
|
+
composer: ThreadComposerRuntimeCore;
|
2576
|
+
getEditComposer: (messageId: string) => ComposerRuntimeCore | undefined;
|
2577
|
+
beginEdit: (messageId: string) => void;
|
2578
|
+
speech: Readonly<{
|
2579
|
+
messageId: string;
|
2580
|
+
status: SpeechSynthesisAdapter.Status;
|
2581
|
+
}> | undefined;
|
2582
|
+
capabilities: Readonly<Readonly<{
|
2583
|
+
switchToBranch: boolean;
|
2584
|
+
edit: boolean;
|
2585
|
+
reload: boolean;
|
2586
|
+
cancel: boolean;
|
2587
|
+
unstable_copy: boolean;
|
2588
|
+
speech: boolean;
|
2589
|
+
attachments: boolean;
|
2590
|
+
feedback: boolean;
|
2591
|
+
}>>;
|
2592
|
+
threadId: string;
|
2593
|
+
isDisabled: boolean;
|
2594
|
+
messages: readonly ThreadMessage[];
|
2595
|
+
suggestions: readonly ThreadSuggestion[];
|
2596
|
+
extras: unknown;
|
2597
|
+
subscribe: (callback: () => void) => Unsubscribe;
|
2598
|
+
import(repository: ExportedMessageRepository): void;
|
2599
|
+
export(): ExportedMessageRepository;
|
2600
|
+
unstable_on(event: ThreadRuntimeEventType, callback: () => void): Unsubscribe;
|
2601
|
+
}>;
|
2602
|
+
append(message: CreateAppendMessage): void;
|
2603
|
+
startRun(parentId: string | null): void;
|
2604
|
+
subscribe(callback: () => void): Unsubscribe;
|
2605
|
+
cancelRun(): void;
|
2606
|
+
getModelConfig(): ModelConfig;
|
2607
|
+
export(): ExportedMessageRepository;
|
2608
|
+
import(repository: ExportedMessageRepository): void;
|
2609
|
+
getMesssageByIndex(idx: number): MessageRuntime;
|
2610
|
+
getMesssageById(messageId: string): MessageRuntime;
|
2611
|
+
stopSpeaking: () => void;
|
2612
|
+
unstable_on(event: ThreadRuntimeEventType, callback: () => void): Unsubscribe;
|
2613
|
+
capabilities: Readonly<Readonly<{
|
2614
|
+
switchToBranch: boolean;
|
2615
|
+
edit: boolean;
|
2616
|
+
reload: boolean;
|
2617
|
+
cancel: boolean;
|
2618
|
+
unstable_copy: boolean;
|
2619
|
+
speech: boolean;
|
2620
|
+
attachments: boolean;
|
2621
|
+
feedback: boolean;
|
2622
|
+
}>>;
|
2623
|
+
threadId: string;
|
2624
|
+
isDisabled: boolean;
|
2625
|
+
isRunning: boolean;
|
2626
|
+
messages: readonly ThreadMessage[];
|
2627
|
+
suggestions: readonly ThreadSuggestion[];
|
2628
|
+
speech: Readonly<{
|
2629
|
+
messageId: string;
|
2630
|
+
status: SpeechSynthesisAdapter.Status;
|
2631
|
+
}> | undefined;
|
2632
|
+
extras: unknown;
|
2633
|
+
getBranches: (messageId: string) => readonly string[];
|
2634
|
+
switchToBranch: (branchId: string) => void;
|
2635
|
+
addToolResult: (options: AddToolResultOptions) => void;
|
2636
|
+
speak: (messageId: string) => void;
|
2637
|
+
getSubmittedFeedback: (messageId: string) => SubmittedFeedback | undefined;
|
2638
|
+
submitFeedback: (feedback: SubmitFeedbackOptions) => void;
|
2639
|
+
getEditComposer: (messageId: string) => ComposerRuntimeCore | undefined;
|
2640
|
+
beginEdit: (messageId: string) => void;
|
1438
2641
|
}>> | null;
|
1439
2642
|
};
|
1440
|
-
|
1441
|
-
type ThreadContextValue = {
|
1442
|
-
useThread: UseBoundStore<ReadonlyStore<ThreadState>>;
|
1443
|
-
/**
|
1444
|
-
* @deprecated Use `useThreadRuntime` instead. This will be removed in 0.6.0.
|
1445
|
-
*/
|
1446
|
-
useThreadActions: UseBoundStore<ReadonlyStore<ThreadRuntime>>;
|
1447
|
-
useThreadRuntime: UseBoundStore<ReadonlyStore<ThreadRuntime>>;
|
1448
|
-
useThreadMessages: UseBoundStore<ReadonlyStore<readonly ThreadMessage[]>>;
|
1449
|
-
useComposer: UseBoundStore<ReadonlyStore<ThreadComposerState>>;
|
1450
|
-
useViewport: UseBoundStore<ReadonlyStore<ThreadViewportState>>;
|
1451
|
-
};
|
1452
|
-
declare const useThreadContext: {
|
1453
|
-
(options?: {
|
1454
|
-
optional?: false | undefined;
|
1455
|
-
} | undefined): ThreadContextValue;
|
1456
|
-
(options?: {
|
1457
|
-
optional?: boolean | undefined;
|
1458
|
-
} | undefined): ThreadContextValue | null;
|
1459
|
-
};
|
1460
|
-
declare function useThreadRuntime(options?: {
|
1461
|
-
optional?: false | undefined;
|
1462
|
-
}): ThreadRuntime;
|
1463
|
-
declare function useThreadRuntime(options?: {
|
1464
|
-
optional?: boolean | undefined;
|
1465
|
-
}): ThreadRuntime | null;
|
1466
|
-
/**
|
1467
|
-
* @deprecated Use `useThreadRuntime` instead. This will be removed in 0.6.0.
|
1468
|
-
*/
|
1469
|
-
declare const useThreadActionsStore: {
|
1470
|
-
(): ReadonlyStore<ThreadRuntime>;
|
1471
|
-
(options: {
|
1472
|
-
optional: true;
|
1473
|
-
}): ReadonlyStore<ThreadRuntime> | null;
|
1474
|
-
};
|
1475
|
-
/**
|
1476
|
-
* @deprecated Use `useThreadRuntime` instead. This will be removed in 0.6.0.
|
1477
|
-
*/
|
1478
|
-
declare const useThreadActions: {
|
1479
|
-
(): ThreadRuntime;
|
1480
|
-
<TSelected>(selector: (state: ThreadRuntime) => TSelected): TSelected;
|
1481
|
-
(options: {
|
1482
|
-
optional: true;
|
1483
|
-
}): ThreadRuntime | null;
|
1484
|
-
<TSelected>(options: {
|
1485
|
-
optional: true;
|
1486
|
-
selector?: (state: ThreadRuntime) => TSelected;
|
1487
|
-
}): TSelected | null;
|
1488
|
-
};
|
1489
|
-
/**
|
1490
|
-
* @deprecated Use `useThreadRuntime` instead. This will be removed in 0.6.0.
|
1491
|
-
*/
|
1492
|
-
declare const useThreadRuntimeStore: {
|
1493
|
-
(): ReadonlyStore<ThreadRuntime>;
|
1494
|
-
(options: {
|
1495
|
-
optional: true;
|
1496
|
-
}): ReadonlyStore<ThreadRuntime> | null;
|
1497
|
-
};
|
1498
2643
|
declare const useThread: {
|
1499
2644
|
(): Readonly<{
|
1500
2645
|
threadId: string;
|
@@ -2693,6 +3838,9 @@ type StringsConfig = {
|
|
2693
3838
|
tooltip?: string | undefined;
|
2694
3839
|
};
|
2695
3840
|
};
|
3841
|
+
welcome?: {
|
3842
|
+
message?: string | undefined;
|
3843
|
+
};
|
2696
3844
|
userMessage?: {
|
2697
3845
|
edit?: {
|
2698
3846
|
tooltip?: string | undefined;
|
@@ -2782,28 +3930,6 @@ type ThreadConfigProviderProps = PropsWithChildren<{
|
|
2782
3930
|
}>;
|
2783
3931
|
declare const ThreadConfigProvider: FC<ThreadConfigProviderProps>;
|
2784
3932
|
|
2785
|
-
declare const buttonVariants: (props?: ({
|
2786
|
-
variant?: "default" | "outline" | "ghost" | null | undefined;
|
2787
|
-
size?: "default" | "icon" | null | undefined;
|
2788
|
-
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
2789
|
-
type ButtonProps = React.ComponentPropsWithoutRef<typeof Primitive.button> & VariantProps<typeof buttonVariants>;
|
2790
|
-
|
2791
|
-
type TooltipIconButtonProps = ButtonProps & {
|
2792
|
-
tooltip: string;
|
2793
|
-
side?: "top" | "bottom" | "left" | "right";
|
2794
|
-
};
|
2795
|
-
declare const TooltipIconButton: react.ForwardRefExoticComponent<Omit<Omit<react.DetailedHTMLProps<react.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref"> & {
|
2796
|
-
ref?: ((instance: HTMLButtonElement | null) => void | react.DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof react.DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | react.RefObject<HTMLButtonElement> | null | undefined;
|
2797
|
-
} & {
|
2798
|
-
asChild?: boolean;
|
2799
|
-
}, "ref"> & class_variance_authority.VariantProps<(props?: ({
|
2800
|
-
variant?: "default" | "outline" | "ghost" | null | undefined;
|
2801
|
-
size?: "default" | "icon" | null | undefined;
|
2802
|
-
} & class_variance_authority_types.ClassProp) | undefined) => string> & {
|
2803
|
-
tooltip: string;
|
2804
|
-
side?: "top" | "bottom" | "left" | "right";
|
2805
|
-
} & react.RefAttributes<HTMLButtonElement>>;
|
2806
|
-
|
2807
3933
|
declare const AssistantActionBar: FC;
|
2808
3934
|
declare const exports$b: {
|
2809
3935
|
Root: react.ForwardRefExoticComponent<Partial<Omit<Omit<Omit<react.DetailedHTMLProps<react.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
|
@@ -3069,97 +4195,4 @@ declare const exports: {
|
|
3069
4195
|
Text: FC;
|
3070
4196
|
};
|
3071
4197
|
|
3072
|
-
|
3073
|
-
private _providers;
|
3074
|
-
getModelConfig(): ModelConfig;
|
3075
|
-
registerModelConfigProvider(provider: ModelConfigProvider): () => void;
|
3076
|
-
private _subscribers;
|
3077
|
-
notifySubscribers(): void;
|
3078
|
-
subscribe(callback: () => void): () => boolean;
|
3079
|
-
}
|
3080
|
-
|
3081
|
-
declare const generateId: (size?: number) => string;
|
3082
|
-
|
3083
|
-
declare const useSmooth: (state: ContentPartState & TextContentPart, smooth?: boolean) => ContentPartState & TextContentPart;
|
3084
|
-
|
3085
|
-
declare const withSmoothContextProvider: <C extends ComponentType<any>>(Component: C) => C;
|
3086
|
-
declare const useSmoothStatus: {
|
3087
|
-
(): {
|
3088
|
-
type: "running";
|
3089
|
-
} | {
|
3090
|
-
type: "complete";
|
3091
|
-
} | {
|
3092
|
-
type: "incomplete";
|
3093
|
-
reason: "cancelled" | "length" | "content-filter" | "other" | "error";
|
3094
|
-
error?: unknown;
|
3095
|
-
} | {
|
3096
|
-
type: "requires-action";
|
3097
|
-
reason: "tool-calls";
|
3098
|
-
};
|
3099
|
-
<TSelected>(selector: (state: {
|
3100
|
-
type: "running";
|
3101
|
-
} | {
|
3102
|
-
type: "complete";
|
3103
|
-
} | {
|
3104
|
-
type: "incomplete";
|
3105
|
-
reason: "cancelled" | "length" | "content-filter" | "other" | "error";
|
3106
|
-
error?: unknown;
|
3107
|
-
} | {
|
3108
|
-
type: "requires-action";
|
3109
|
-
reason: "tool-calls";
|
3110
|
-
}) => TSelected): TSelected;
|
3111
|
-
(options: {
|
3112
|
-
optional: true;
|
3113
|
-
}): {
|
3114
|
-
type: "running";
|
3115
|
-
} | {
|
3116
|
-
type: "complete";
|
3117
|
-
} | {
|
3118
|
-
type: "incomplete";
|
3119
|
-
reason: "cancelled" | "length" | "content-filter" | "other" | "error";
|
3120
|
-
error?: unknown;
|
3121
|
-
} | {
|
3122
|
-
type: "requires-action";
|
3123
|
-
reason: "tool-calls";
|
3124
|
-
} | null;
|
3125
|
-
<TSelected>(options: {
|
3126
|
-
optional: true;
|
3127
|
-
selector?: (state: {
|
3128
|
-
type: "running";
|
3129
|
-
} | {
|
3130
|
-
type: "complete";
|
3131
|
-
} | {
|
3132
|
-
type: "incomplete";
|
3133
|
-
reason: "cancelled" | "length" | "content-filter" | "other" | "error";
|
3134
|
-
error?: unknown;
|
3135
|
-
} | {
|
3136
|
-
type: "requires-action";
|
3137
|
-
reason: "tool-calls";
|
3138
|
-
}) => TSelected;
|
3139
|
-
}): TSelected | null;
|
3140
|
-
};
|
3141
|
-
|
3142
|
-
type internal_AssistantRuntimeImpl = AssistantRuntimeImpl;
|
3143
|
-
declare const internal_AssistantRuntimeImpl: typeof AssistantRuntimeImpl;
|
3144
|
-
type internal_BaseAssistantRuntimeCore<TThreadRuntime extends ThreadRuntimeCore> = BaseAssistantRuntimeCore<TThreadRuntime>;
|
3145
|
-
declare const internal_BaseAssistantRuntimeCore: typeof BaseAssistantRuntimeCore;
|
3146
|
-
type internal_DefaultThreadComposerRuntimeCore = DefaultThreadComposerRuntimeCore;
|
3147
|
-
declare const internal_DefaultThreadComposerRuntimeCore: typeof DefaultThreadComposerRuntimeCore;
|
3148
|
-
type internal_MessageRepository = MessageRepository;
|
3149
|
-
declare const internal_MessageRepository: typeof MessageRepository;
|
3150
|
-
type internal_ProxyConfigProvider = ProxyConfigProvider;
|
3151
|
-
declare const internal_ProxyConfigProvider: typeof ProxyConfigProvider;
|
3152
|
-
type internal_ThreadRuntimeCore = ThreadRuntimeCore;
|
3153
|
-
type internal_ThreadRuntimeCoreBinding = ThreadRuntimeCoreBinding;
|
3154
|
-
type internal_ThreadRuntimeImpl = ThreadRuntimeImpl;
|
3155
|
-
declare const internal_ThreadRuntimeImpl: typeof ThreadRuntimeImpl;
|
3156
|
-
declare const internal_TooltipIconButton: typeof TooltipIconButton;
|
3157
|
-
declare const internal_generateId: typeof generateId;
|
3158
|
-
declare const internal_useSmooth: typeof useSmooth;
|
3159
|
-
declare const internal_useSmoothStatus: typeof useSmoothStatus;
|
3160
|
-
declare const internal_withSmoothContextProvider: typeof withSmoothContextProvider;
|
3161
|
-
declare namespace internal {
|
3162
|
-
export { internal_AssistantRuntimeImpl as AssistantRuntimeImpl, internal_BaseAssistantRuntimeCore as BaseAssistantRuntimeCore, internal_DefaultThreadComposerRuntimeCore as DefaultThreadComposerRuntimeCore, internal_MessageRepository as MessageRepository, internal_ProxyConfigProvider as ProxyConfigProvider, type internal_ThreadRuntimeCore as ThreadRuntimeCore, type internal_ThreadRuntimeCoreBinding as ThreadRuntimeCoreBinding, internal_ThreadRuntimeImpl as ThreadRuntimeImpl, internal_TooltipIconButton as TooltipIconButton, internal_generateId as generateId, internal_useSmooth as useSmooth, internal_useSmoothStatus as useSmoothStatus, internal_withSmoothContextProvider as withSmoothContextProvider };
|
3163
|
-
}
|
3164
|
-
|
3165
|
-
export { index$7 as ActionBarPrimitive, type ActionBarPrimitiveCopyProps, type ActionBarPrimitiveEditProps, type ActionBarPrimitiveFeedbackNegativeProps, type ActionBarPrimitiveFeedbackPositiveProps, type ActionBarPrimitiveReloadProps, type ActionBarPrimitiveRootProps, type ActionBarPrimitiveSpeakProps, type ActionBarPrimitiveStopSpeakingProps, type AddToolResultOptions, AppendMessage, _default$a as AssistantActionBar, type AssistantContextValue, _default$9 as AssistantMessage, type AssistantMessageConfig, type AssistantMessageContentProps, _default$8 as AssistantModal, index$6 as AssistantModalPrimitive, type AssistantModalPrimitiveContentProps, type AssistantModalPrimitiveRootProps, type AssistantModalPrimitiveTriggerProps, type AssistantRuntime, AssistantRuntimeProvider, type AssistantTool, type AssistantToolProps, type AssistantToolUI, type AssistantToolUIProps, type AssistantToolUIsState, Attachment$1 as Attachment, type AttachmentAdapter, index$5 as AttachmentPrimitive, _default$5 as AttachmentUI, _default$7 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$6 as Composer, _default$5 as ComposerAttachment, type ComposerContextValue, type ComposerInputProps, index$3 as ComposerPrimitive, type ComposerPrimitiveCancelProps, type ComposerPrimitiveIfProps, type ComposerPrimitiveInputProps, type ComposerPrimitiveRootProps, type ComposerPrimitiveSendProps, type ComposerRuntime, type ComposerState, CompositeAttachmentAdapter, exports as ContentPart, type ContentPartContextValue, index$2 as ContentPartPrimitive, type ContentPartPrimitiveDisplayProps, type ContentPartPrimitiveImageProps, type ContentPartPrimitiveInProgressProps, type ContentPartPrimitiveTextProps, type ContentPartRuntime, CoreMessage, type DangerousInBrowserRuntimeOptions, EdgeChatAdapter, type EdgeRuntimeOptions, _default$4 as EditComposer, type 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, type 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$3 as Thread, ThreadAssistantContentPart, type ThreadComposerRuntime, type ThreadComposerState, 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, type ThreadRuntime, type ThreadState, type ThreadSuggestion, ThreadUserContentPart, type ThreadViewportState, _default as ThreadWelcome, type ThreadWelcomeConfig, type ThreadWelcomeMessageProps, type ThreadWelcomeSuggestionProps, Tool, ToolCallContentPart, type ToolCallContentPartComponent, type ToolCallContentPartProps, UIContentPart, type UIContentPartComponent, type UIContentPartProps, Unsubscribe, type UseActionBarCopyProps, _default$1 as UserActionBar, _default$2 as UserMessage, _default$5 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, useThreadModelConfig, useThreadRuntime, useThreadRuntimeStore, useThreadScrollToBottom, useThreadStore, useThreadSuggestion, useThreadViewport, useThreadViewportStore, useToolUIs, useToolUIsStore };
|
4198
|
+
export { index$7 as ActionBarPrimitive, type ActionBarPrimitiveCopyProps, type ActionBarPrimitiveEditProps, type ActionBarPrimitiveFeedbackNegativeProps, type ActionBarPrimitiveFeedbackPositiveProps, type ActionBarPrimitiveReloadProps, type ActionBarPrimitiveRootProps, type ActionBarPrimitiveSpeakProps, type ActionBarPrimitiveStopSpeakingProps, type AddToolResultOptions, AppendMessage, _default$a as AssistantActionBar, type AssistantContextValue, _default$9 as AssistantMessage, type AssistantMessageConfig, type AssistantMessageContentProps, _default$8 as AssistantModal, index$6 as AssistantModalPrimitive, type AssistantModalPrimitiveContentProps, type AssistantModalPrimitiveRootProps, type AssistantModalPrimitiveTriggerProps, type AssistantRuntime, AssistantRuntimeProvider, type AssistantTool, type AssistantToolProps, type AssistantToolUI, type AssistantToolUIProps, type AssistantToolUIsState, Attachment$1 as Attachment, type AttachmentAdapter, index$5 as AttachmentPrimitive, type AttachmentRuntime, type AttachmentState, _default$5 as AttachmentUI, _default$7 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$6 as Composer, _default$5 as ComposerAttachment, type ComposerContextValue, type ComposerInputProps, index$3 as ComposerPrimitive, type ComposerPrimitiveCancelProps, type ComposerPrimitiveIfProps, type ComposerPrimitiveInputProps, type ComposerPrimitiveRootProps, type ComposerPrimitiveSendProps, type ComposerRuntime, type ComposerState, CompositeAttachmentAdapter, exports as ContentPart, type ContentPartContextValue, index$2 as ContentPartPrimitive, type ContentPartPrimitiveDisplayProps, type ContentPartPrimitiveImageProps, type ContentPartPrimitiveInProgressProps, type ContentPartPrimitiveTextProps, type ContentPartRuntime, type ContentPartState, CoreMessage, type DangerousInBrowserRuntimeOptions, EdgeChatAdapter, type EdgeRuntimeOptions, _default$4 as EditComposer, type 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, type 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$3 as Thread, ThreadAssistantContentPart, type ThreadComposerRuntime, type ThreadComposerState, type ThreadConfig, ThreadConfigProvider, type ThreadConfigProviderProps, type ThreadContextValue, type ThreadManagerRuntime, type ThreadManagerState, ThreadMessage, type ThreadMessageLike, index as ThreadPrimitive, type ThreadPrimitiveEmptyProps, type ThreadPrimitiveIfProps, type ThreadPrimitiveMessagesProps, type ThreadPrimitiveRootProps, type ThreadPrimitiveScrollToBottomProps, type ThreadPrimitiveSuggestionProps, type ThreadPrimitiveViewportProps, type ThreadRootProps, type ThreadRuntime, type ThreadState, type ThreadSuggestion, ThreadUserContentPart, type ThreadViewportState, _default as ThreadWelcome, type ThreadWelcomeConfig, type ThreadWelcomeMessageProps, type ThreadWelcomeSuggestionProps, Tool, ToolCallContentPart, type ToolCallContentPartComponent, type ToolCallContentPartProps, UIContentPart, type UIContentPartComponent, type UIContentPartProps, Unsubscribe, type UseActionBarCopyProps, _default$1 as UserActionBar, _default$2 as UserMessage, _default$5 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, useThreadManager, useThreadMessages, useThreadMessagesStore, useThreadModelConfig, useThreadRuntime, useThreadRuntimeStore, useThreadScrollToBottom, useThreadStore, useThreadSuggestion, useThreadViewport, useThreadViewportStore, useToolUIs, useToolUIsStore };
|