@assistant-ui/react 0.5.20 → 0.5.22

Sign up to get free protection for your applications and to get access to all the features.
package/dist/index.d.ts CHANGED
@@ -1,173 +1,21 @@
1
1
  import * as react from 'react';
2
- import { ReactNode, ComponentType, PropsWithChildren, ComponentPropsWithoutRef, FC, ElementType } from 'react';
3
- import { z } from 'zod';
4
- import { JSONSchema7 } from 'json-schema';
5
- import { LanguageModelV1LogProbs, LanguageModelV1Message, LanguageModelV1FunctionTool } from '@ai-sdk/provider';
2
+ import { ComponentType, PropsWithChildren, ComponentPropsWithoutRef, FC, ElementType, ReactNode } from 'react';
3
+ import { T as ThreadAssistantContentPart, M as MessageStatus, a as ThreadRoundtrip, b as ThreadMessage, c as ModelConfig, d as ModelConfigProvider, e as TextContentPart, C as ContentPartStatus, I as ImageContentPart, U as UIContentPart, f as ToolCallContentPart, g as ToolCallContentPartStatus, h as CoreMessage, A as AppendMessage, i as Tool, j as CoreToolCallContentPart } from './AssistantTypes-BNB-knVq.js';
4
+ export { p as CoreAssistantContentPart, s as CoreAssistantMessage, q as CoreSystemMessage, o as CoreUserContentPart, r as CoreUserMessage, m as ThreadAssistantMessage, l as ThreadSystemMessage, k as ThreadUserContentPart, n as ThreadUserMessage } from './AssistantTypes-BNB-knVq.js';
6
5
  import { UseBoundStore, StoreApi } from 'zustand';
7
6
  import { Primitive } from '@radix-ui/react-primitive';
8
7
  import * as PopoverPrimitive from '@radix-ui/react-popover';
9
8
  import * as react_textarea_autosize from 'react-textarea-autosize';
10
9
  import { TextareaAutosizeProps } from 'react-textarea-autosize';
10
+ import { LanguageModelV1Message, LanguageModelV1FunctionTool } from '@ai-sdk/provider';
11
+ import { JSONSchema7 } from 'json-schema';
12
+ import { z } from 'zod';
11
13
  import * as class_variance_authority from 'class-variance-authority';
12
14
  import { VariantProps } from 'class-variance-authority';
13
15
  import * as class_variance_authority_types from 'class-variance-authority/types';
14
16
 
15
- declare const LanguageModelV1CallSettingsSchema: z.ZodObject<{
16
- maxTokens: z.ZodOptional<z.ZodNumber>;
17
- temperature: z.ZodOptional<z.ZodNumber>;
18
- topP: z.ZodOptional<z.ZodNumber>;
19
- presencePenalty: z.ZodOptional<z.ZodNumber>;
20
- frequencyPenalty: z.ZodOptional<z.ZodNumber>;
21
- seed: z.ZodOptional<z.ZodNumber>;
22
- headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodOptional<z.ZodString>>>;
23
- }, "strip", z.ZodTypeAny, {
24
- maxTokens?: number | undefined;
25
- temperature?: number | undefined;
26
- topP?: number | undefined;
27
- presencePenalty?: number | undefined;
28
- frequencyPenalty?: number | undefined;
29
- seed?: number | undefined;
30
- headers?: Record<string, string | undefined> | undefined;
31
- }, {
32
- maxTokens?: number | undefined;
33
- temperature?: number | undefined;
34
- topP?: number | undefined;
35
- presencePenalty?: number | undefined;
36
- frequencyPenalty?: number | undefined;
37
- seed?: number | undefined;
38
- headers?: Record<string, string | undefined> | undefined;
39
- }>;
40
- type LanguageModelV1CallSettings = z.infer<typeof LanguageModelV1CallSettingsSchema>;
41
- declare const LanguageModelConfigSchema: z.ZodObject<{
42
- apiKey: z.ZodOptional<z.ZodString>;
43
- baseUrl: z.ZodOptional<z.ZodString>;
44
- modelName: z.ZodOptional<z.ZodString>;
45
- }, "strip", z.ZodTypeAny, {
46
- apiKey?: string | undefined;
47
- baseUrl?: string | undefined;
48
- modelName?: string | undefined;
49
- }, {
50
- apiKey?: string | undefined;
51
- baseUrl?: string | undefined;
52
- modelName?: string | undefined;
53
- }>;
54
- type LanguageModelConfig = z.infer<typeof LanguageModelConfigSchema>;
55
- type ToolExecuteFunction<TArgs, TResult> = (args: TArgs) => TResult | Promise<TResult>;
56
- type Tool<TArgs extends Record<string, unknown> = Record<string | number, unknown>, TResult = unknown> = {
57
- description?: string | undefined;
58
- parameters: z.ZodSchema<TArgs> | JSONSchema7;
59
- execute?: ToolExecuteFunction<TArgs, TResult>;
60
- };
61
- type ModelConfig = {
62
- priority?: number | undefined;
63
- system?: string | undefined;
64
- tools?: Record<string, Tool<any, any>> | undefined;
65
- callSettings?: LanguageModelV1CallSettings | undefined;
66
- config?: LanguageModelConfig | undefined;
67
- };
68
- type ModelConfigProvider = {
69
- getModelConfig: () => ModelConfig;
70
- };
71
-
72
17
  type Unsubscribe = () => void;
73
18
 
74
- type TextContentPart = {
75
- type: "text";
76
- text: string;
77
- };
78
- type ImageContentPart = {
79
- type: "image";
80
- image: string;
81
- };
82
- type UIContentPart = {
83
- type: "ui";
84
- display: ReactNode;
85
- };
86
- type CoreToolCallContentPart<TArgs extends Record<string, unknown> = Record<string | number, unknown>, TResult = unknown> = {
87
- type: "tool-call";
88
- toolCallId: string;
89
- toolName: string;
90
- args: TArgs;
91
- result?: TResult | undefined;
92
- isError?: boolean | undefined;
93
- };
94
- type ToolCallContentPart<TArgs extends Record<string, unknown> = Record<string | number, unknown>, TResult = unknown> = CoreToolCallContentPart<TArgs, TResult> & {
95
- argsText: string;
96
- };
97
- type ThreadUserContentPart = TextContentPart | ImageContentPart | UIContentPart;
98
- type ThreadAssistantContentPart = TextContentPart | ToolCallContentPart | UIContentPart;
99
- type MessageCommonProps = {
100
- id: string;
101
- createdAt: Date;
102
- };
103
- type ThreadRoundtrip = {
104
- logprobs?: LanguageModelV1LogProbs | undefined;
105
- usage?: {
106
- promptTokens: number;
107
- completionTokens: number;
108
- } | undefined;
109
- };
110
- type ContentPartStatus = {
111
- type: "running";
112
- } | {
113
- type: "complete";
114
- } | {
115
- type: "incomplete";
116
- reason: "cancelled" | "length" | "content-filter" | "other" | "error";
117
- error?: unknown;
118
- };
119
- type ToolCallContentPartStatus = {
120
- type: "requires-action";
121
- reason: "tool-calls";
122
- } | ContentPartStatus;
123
- type MessageStatus = {
124
- type: "running";
125
- } | {
126
- type: "requires-action";
127
- reason: "tool-calls";
128
- } | {
129
- type: "complete";
130
- reason: "stop" | "unknown";
131
- } | {
132
- type: "incomplete";
133
- reason: "cancelled" | "tool-calls" | "length" | "content-filter" | "other" | "error";
134
- error?: unknown;
135
- };
136
- type ThreadSystemMessage = MessageCommonProps & {
137
- role: "system";
138
- content: [TextContentPart];
139
- };
140
- type ThreadUserMessage = MessageCommonProps & {
141
- role: "user";
142
- content: ThreadUserContentPart[];
143
- };
144
- type ThreadAssistantMessage = MessageCommonProps & {
145
- role: "assistant";
146
- content: ThreadAssistantContentPart[];
147
- status: MessageStatus;
148
- roundtrips?: ThreadRoundtrip[] | undefined;
149
- };
150
- type AppendMessage = CoreMessage & {
151
- parentId: string | null;
152
- };
153
- type ThreadMessage = ThreadSystemMessage | ThreadUserMessage | ThreadAssistantMessage;
154
- /** Core Message Types (without UI content parts) */
155
- type CoreUserContentPart = TextContentPart | ImageContentPart;
156
- type CoreAssistantContentPart = TextContentPart | CoreToolCallContentPart;
157
- type CoreSystemMessage = {
158
- role: "system";
159
- content: [TextContentPart];
160
- };
161
- type CoreUserMessage = {
162
- role: "user";
163
- content: CoreUserContentPart[];
164
- };
165
- type CoreAssistantMessage = {
166
- role: "assistant";
167
- content: CoreAssistantContentPart[];
168
- };
169
- type CoreMessage = CoreSystemMessage | CoreUserMessage | CoreAssistantMessage;
170
-
171
19
  type ReadonlyStore<T> = UseBoundStore<Omit<StoreApi<T>, "setState" | "destroy">>;
172
20
 
173
21
  type ReactThreadRuntime = ThreadRuntime & {
@@ -1512,4 +1360,4 @@ declare const exports: {
1512
1360
  Text: FC;
1513
1361
  };
1514
1362
 
1515
- export { index$6 as ActionBarPrimitive, type ActionBarPrimitiveCopyProps, type ActionBarPrimitiveEditProps, type ActionBarPrimitiveReloadProps, type ActionBarPrimitiveRootProps, type AddToolResultOptions, type AppendMessage, _default$9 as AssistantActionBar, type AssistantActionsState, type AssistantContextValue, _default$8 as AssistantMessage, type AssistantMessageConfig, type AssistantMessageContentProps, _default$7 as AssistantModal, index$5 as AssistantModalPrimitive, type AssistantModalPrimitiveContentProps, type AssistantModalPrimitiveRootProps, type AssistantModalPrimitiveTriggerProps, type AssistantModelConfigState, type AssistantRuntime, AssistantRuntimeProvider, type AssistantToolProps, type AssistantToolUIProps, type AssistantToolUIsState, _default$6 as BranchPicker, index$4 as BranchPickerPrimitive, type BranchPickerPrimitiveCountProps, type BranchPickerPrimitiveNextProps, type BranchPickerPrimitiveNumberProps, type BranchPickerPrimitivePreviousProps, type BranchPickerPrimitiveRootProps, type ChatModelAdapter, type ChatModelRunOptions, type ChatModelRunResult, type ChatModelRunUpdate, _default$5 as Composer, type ComposerContextValue, type ComposerInputProps, index$3 as ComposerPrimitive, type ComposerPrimitiveCancelProps, type ComposerPrimitiveIfProps, type ComposerPrimitiveInputProps, type ComposerPrimitiveRootProps, type ComposerPrimitiveSendProps, type ComposerState, exports as ContentPart, type ContentPartContextValue, index$2 as ContentPartPrimitive, type ContentPartPrimitiveDisplayProps, type ContentPartPrimitiveImageProps, type ContentPartPrimitiveInProgressProps, type ContentPartPrimitiveTextProps, type ContentPartState, type CoreAssistantContentPart, type CoreAssistantMessage, type CoreMessage, type CoreSystemMessage, type CoreUserContentPart, type CoreUserMessage, EdgeChatAdapter, type EdgeRuntimeOptions, type EdgeRuntimeRequestOptions, _default$4 as EditComposer, type EditComposerState, type ExternalStoreAdapter, type ExternalStoreMessageConverter, ExternalStoreRuntime, internal as INTERNAL, type ImageContentPart, type ImageContentPartComponent, type ImageContentPartProps, type LocalRuntimeOptions, type MessageContextValue, index$1 as MessagePrimitive, type MessagePrimitiveContentProps, type MessagePrimitiveIfProps, type MessagePrimitiveInProgressProps, type MessagePrimitiveRootProps, type MessageState, type MessageStatus, type MessageUtilsState, type ModelConfig, type ModelConfigProvider, type ReactThreadRuntime, type StringsConfig, type SuggestionConfig, type TextContentPart, type TextContentPartComponent, type TextContentPartProps, _default$3 as Thread, type ThreadActionsState, type ThreadAssistantContentPart, type ThreadAssistantMessage, type ThreadConfig, ThreadConfigProvider, type ThreadConfigProviderProps, type ThreadContextValue, type ThreadMessage, type ThreadMessageLike, type ThreadMessagesState, index as ThreadPrimitive, type ThreadPrimitiveEmptyProps, type ThreadPrimitiveIfProps, type ThreadPrimitiveMessagesProps, type ThreadPrimitiveRootProps, type ThreadPrimitiveScrollToBottomProps, type ThreadPrimitiveSuggestionProps, type ThreadPrimitiveViewportProps, type ThreadRootProps, type ThreadRuntime, type ThreadState, type ThreadSystemMessage, type ThreadUserContentPart, type ThreadUserMessage, type ThreadViewportState, _default as ThreadWelcome, type ThreadWelcomeConfig, type ThreadWelcomeMessageProps, type ThreadWelcomeSuggestionProps, type Tool, type ToolCallContentPart, type ToolCallContentPartComponent, type ToolCallContentPartProps, type UIContentPart, type UIContentPartComponent, type UIContentPartProps, type Unsubscribe, type UseActionBarCopyProps, _default$1 as UserActionBar, _default$2 as UserMessage, type UserMessageConfig, type UserMessageContentProps, fromCoreMessage, fromCoreMessages, fromLanguageModelMessages, fromLanguageModelTools, getExternalStoreMessage, makeAssistantTool, makeAssistantToolUI, toCoreMessage, toCoreMessages, toLanguageModelMessages, toLanguageModelTools, useActionBarCopy, useActionBarEdit, useActionBarReload, useAppendMessage, useAssistantContext, useAssistantInstructions, useAssistantTool, useAssistantToolUI, useBranchPickerCount, useBranchPickerNext, useBranchPickerNumber, useBranchPickerPrevious, useComposerCancel, useComposerContext, useComposerIf, useComposerSend, useContentPartContext, useContentPartDisplay, useContentPartImage, useContentPartText, useEdgeRuntime, useExternalStoreRuntime, useLocalRuntime, useMessageContext, useMessageIf, useSwitchToNewThread, useThreadConfig, useThreadContext, useThreadEmpty, useThreadIf, useThreadScrollToBottom, useThreadSuggestion };
1363
+ export { index$6 as ActionBarPrimitive, type ActionBarPrimitiveCopyProps, type ActionBarPrimitiveEditProps, type ActionBarPrimitiveReloadProps, type ActionBarPrimitiveRootProps, type AddToolResultOptions, AppendMessage, _default$9 as AssistantActionBar, type AssistantActionsState, type AssistantContextValue, _default$8 as AssistantMessage, type AssistantMessageConfig, type AssistantMessageContentProps, _default$7 as AssistantModal, index$5 as AssistantModalPrimitive, type AssistantModalPrimitiveContentProps, type AssistantModalPrimitiveRootProps, type AssistantModalPrimitiveTriggerProps, type AssistantModelConfigState, type AssistantRuntime, AssistantRuntimeProvider, type AssistantToolProps, type AssistantToolUIProps, type AssistantToolUIsState, _default$6 as BranchPicker, index$4 as BranchPickerPrimitive, type BranchPickerPrimitiveCountProps, type BranchPickerPrimitiveNextProps, type BranchPickerPrimitiveNumberProps, type BranchPickerPrimitivePreviousProps, type BranchPickerPrimitiveRootProps, type ChatModelAdapter, type ChatModelRunOptions, type ChatModelRunResult, type ChatModelRunUpdate, _default$5 as Composer, type ComposerContextValue, type ComposerInputProps, index$3 as ComposerPrimitive, type ComposerPrimitiveCancelProps, type ComposerPrimitiveIfProps, type ComposerPrimitiveInputProps, type ComposerPrimitiveRootProps, type ComposerPrimitiveSendProps, type ComposerState, exports as ContentPart, type ContentPartContextValue, index$2 as ContentPartPrimitive, type ContentPartPrimitiveDisplayProps, type ContentPartPrimitiveImageProps, type ContentPartPrimitiveInProgressProps, type ContentPartPrimitiveTextProps, type ContentPartState, CoreMessage, EdgeChatAdapter, type EdgeRuntimeOptions, type EdgeRuntimeRequestOptions, _default$4 as EditComposer, type EditComposerState, type ExternalStoreAdapter, type ExternalStoreMessageConverter, ExternalStoreRuntime, internal as INTERNAL, ImageContentPart, type ImageContentPartComponent, type ImageContentPartProps, type LocalRuntimeOptions, type MessageContextValue, index$1 as MessagePrimitive, type MessagePrimitiveContentProps, type MessagePrimitiveIfProps, type MessagePrimitiveInProgressProps, type MessagePrimitiveRootProps, type MessageState, MessageStatus, type MessageUtilsState, ModelConfig, ModelConfigProvider, type ReactThreadRuntime, type StringsConfig, type SuggestionConfig, TextContentPart, type TextContentPartComponent, type TextContentPartProps, _default$3 as Thread, type ThreadActionsState, ThreadAssistantContentPart, type ThreadConfig, ThreadConfigProvider, type ThreadConfigProviderProps, type ThreadContextValue, ThreadMessage, type ThreadMessageLike, type ThreadMessagesState, index as ThreadPrimitive, type ThreadPrimitiveEmptyProps, type ThreadPrimitiveIfProps, type ThreadPrimitiveMessagesProps, type ThreadPrimitiveRootProps, type ThreadPrimitiveScrollToBottomProps, type ThreadPrimitiveSuggestionProps, type ThreadPrimitiveViewportProps, type ThreadRootProps, type ThreadRuntime, type ThreadState, type ThreadViewportState, _default as ThreadWelcome, type ThreadWelcomeConfig, type ThreadWelcomeMessageProps, type ThreadWelcomeSuggestionProps, Tool, ToolCallContentPart, type ToolCallContentPartComponent, type ToolCallContentPartProps, UIContentPart, type UIContentPartComponent, type UIContentPartProps, type Unsubscribe, type UseActionBarCopyProps, _default$1 as UserActionBar, _default$2 as UserMessage, type UserMessageConfig, type UserMessageContentProps, fromCoreMessage, fromCoreMessages, fromLanguageModelMessages, fromLanguageModelTools, getExternalStoreMessage, makeAssistantTool, makeAssistantToolUI, toCoreMessage, toCoreMessages, toLanguageModelMessages, toLanguageModelTools, useActionBarCopy, useActionBarEdit, useActionBarReload, useAppendMessage, useAssistantContext, useAssistantInstructions, useAssistantTool, useAssistantToolUI, useBranchPickerCount, useBranchPickerNext, useBranchPickerNumber, useBranchPickerPrevious, useComposerCancel, useComposerContext, useComposerIf, useComposerSend, useContentPartContext, useContentPartDisplay, useContentPartImage, useContentPartText, useEdgeRuntime, useExternalStoreRuntime, useLocalRuntime, useMessageContext, useMessageIf, useSwitchToNewThread, useThreadConfig, useThreadContext, useThreadEmpty, useThreadIf, useThreadScrollToBottom, useThreadSuggestion };