@21st-sdk/react 0.1.3 → 0.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +1 -1
- package/README.md +20 -20
- package/dist/index.cjs +17 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +48 -36
- package/dist/index.d.ts +48 -36
- package/dist/index.js +13 -5
- package/dist/index.js.map +1 -1
- package/docs/02-getting-started.md +8 -8
- package/docs/04-react-ui.md +13 -13
- package/docs/05-nextjs.md +15 -15
- package/docs/06-node-sdk.md +8 -8
- package/docs/07-cli.md +1 -1
- package/docs/08-custom-tools.md +2 -2
- package/package.json +4 -4
- package/src/an-agent-chat.tsx +6 -3
- package/src/components/input/context-items.tsx +2 -2
- package/src/components/input/model-selector.tsx +3 -3
- package/src/components/input-bar.tsx +2 -2
- package/src/create-an-chat.ts +7 -4
- package/src/index.ts +11 -5
- package/src/models.ts +11 -6
- package/src/theme-config.ts +9 -6
- package/src/theme.ts +2 -2
- package/src/tools/tool-router.ts +3 -3
- package/src/types.ts +23 -15
package/dist/index.d.cts
CHANGED
|
@@ -3,14 +3,14 @@ import React, { ReactNode } from 'react';
|
|
|
3
3
|
import { UIMessage, ChatStatus } from 'ai';
|
|
4
4
|
import { Chat } from '@ai-sdk/react';
|
|
5
5
|
|
|
6
|
-
/** Theme JSON generated by the
|
|
7
|
-
interface
|
|
6
|
+
/** Theme JSON generated by the playground */
|
|
7
|
+
interface ChatTheme {
|
|
8
8
|
theme: Record<string, string>;
|
|
9
9
|
light: Record<string, string>;
|
|
10
10
|
dark: Record<string, string>;
|
|
11
11
|
}
|
|
12
12
|
/** Per-element CSS class overrides */
|
|
13
|
-
interface
|
|
13
|
+
interface ChatClassNames {
|
|
14
14
|
root: string;
|
|
15
15
|
messageList: string;
|
|
16
16
|
userMessage: string;
|
|
@@ -28,15 +28,15 @@ interface AnClassNames {
|
|
|
28
28
|
toolGeneric: string;
|
|
29
29
|
}
|
|
30
30
|
/** Component slot overrides */
|
|
31
|
-
interface
|
|
31
|
+
interface ChatSlots {
|
|
32
32
|
InputBar: React.ComponentType<any>;
|
|
33
33
|
UserMessage: React.ComponentType<any>;
|
|
34
34
|
AssistantMessage: React.ComponentType<any>;
|
|
35
35
|
ToolRenderer: React.ComponentType<any>;
|
|
36
36
|
MessageActions: React.ComponentType<any>;
|
|
37
37
|
}
|
|
38
|
-
/** Props for
|
|
39
|
-
interface
|
|
38
|
+
/** Props for createAgentChat() */
|
|
39
|
+
interface CreateAgentChatOptions {
|
|
40
40
|
agent: string;
|
|
41
41
|
/** Provide either tokenUrl (simple) or getToken (full control) */
|
|
42
42
|
tokenUrl?: string;
|
|
@@ -53,10 +53,10 @@ interface CreateAnChatOptions {
|
|
|
53
53
|
*
|
|
54
54
|
* @example
|
|
55
55
|
* // Per-user sandbox
|
|
56
|
-
*
|
|
56
|
+
* createAgentChat({ agent: "my-agent", tokenUrl: "/api/an/token", sandboxId: `user-${userId}` })
|
|
57
57
|
*
|
|
58
58
|
* // Continue existing sandbox
|
|
59
|
-
*
|
|
59
|
+
* createAgentChat({ agent: "my-agent", tokenUrl: "/api/an/token", sandboxId: sandbox.id })
|
|
60
60
|
*/
|
|
61
61
|
sandboxId?: string;
|
|
62
62
|
/**
|
|
@@ -75,13 +75,13 @@ interface CustomToolRendererProps {
|
|
|
75
75
|
status: "pending" | "streaming" | "success" | "error";
|
|
76
76
|
}
|
|
77
77
|
/** A model option for the model selector */
|
|
78
|
-
interface
|
|
78
|
+
interface ModelOption {
|
|
79
79
|
id: string;
|
|
80
80
|
name: string;
|
|
81
81
|
version?: string;
|
|
82
82
|
}
|
|
83
|
-
/** Props for the <
|
|
84
|
-
interface
|
|
83
|
+
/** Props for the <AgentChat> drop-in component */
|
|
84
|
+
interface AgentChatProps {
|
|
85
85
|
messages: UIMessage[];
|
|
86
86
|
onSend: (message: {
|
|
87
87
|
role: "user";
|
|
@@ -90,16 +90,16 @@ interface AnAgentChatProps {
|
|
|
90
90
|
status: ChatStatus;
|
|
91
91
|
onStop: () => void;
|
|
92
92
|
error?: Error;
|
|
93
|
-
theme?:
|
|
93
|
+
theme?: ChatTheme;
|
|
94
94
|
colorMode?: "light" | "dark" | "auto";
|
|
95
|
-
classNames?: Partial<
|
|
96
|
-
slots?: Partial<
|
|
95
|
+
classNames?: Partial<ChatClassNames>;
|
|
96
|
+
slots?: Partial<ChatSlots>;
|
|
97
97
|
toolRenderers?: Record<string, React.ComponentType<CustomToolRendererProps>>;
|
|
98
98
|
/** Show window chrome header (traffic lights + agent indicator) */
|
|
99
99
|
showWindowChrome?: boolean;
|
|
100
100
|
/** Model selector configuration */
|
|
101
101
|
modelSelector?: {
|
|
102
|
-
models:
|
|
102
|
+
models: ModelOption[];
|
|
103
103
|
activeModelId?: string;
|
|
104
104
|
onModelChange?: (id: string) => void;
|
|
105
105
|
display?: "popover" | "badge";
|
|
@@ -138,16 +138,24 @@ interface AnAgentChatProps {
|
|
|
138
138
|
className?: string;
|
|
139
139
|
style?: React.CSSProperties;
|
|
140
140
|
}
|
|
141
|
+
type AnTheme = ChatTheme;
|
|
142
|
+
type AnClassNames = ChatClassNames;
|
|
143
|
+
type AnSlots = ChatSlots;
|
|
144
|
+
type CreateAnChatOptions = CreateAgentChatOptions;
|
|
145
|
+
type AnModelOption = ModelOption;
|
|
146
|
+
type AnAgentChatProps = AgentChatProps;
|
|
141
147
|
|
|
142
|
-
declare function
|
|
148
|
+
declare function AgentChat({ messages, onSend, status, onStop, error, theme, colorMode, classNames, slots, toolRenderers, showWindowChrome, modelSelector, modeSelector, attachments, className, style, }: AgentChatProps): react_jsx_runtime.JSX.Element;
|
|
149
|
+
declare const AnAgentChat: typeof AgentChat;
|
|
143
150
|
|
|
144
|
-
/** Create an AI SDK Chat instance pointed at the
|
|
145
|
-
declare function
|
|
151
|
+
/** Create an AI SDK Chat instance pointed at the relay API */
|
|
152
|
+
declare function createAgentChat(options: CreateAgentChatOptions): Chat<UIMessage>;
|
|
153
|
+
declare const createAnChat: typeof createAgentChat;
|
|
146
154
|
|
|
147
155
|
/** Apply theme CSS variables from playground JSON to a DOM element */
|
|
148
|
-
declare function applyTheme(element: HTMLElement, theme:
|
|
156
|
+
declare function applyTheme(element: HTMLElement, theme: ChatTheme, colorMode?: "light" | "dark" | "auto"): void;
|
|
149
157
|
|
|
150
|
-
interface
|
|
158
|
+
interface ChatThemeConfig {
|
|
151
159
|
messageStyle: "bubble-right" | "full-width";
|
|
152
160
|
messageDensity: "relaxed" | "compact" | "dense";
|
|
153
161
|
inputStyle: "rounded" | "flat" | "bordered";
|
|
@@ -176,10 +184,11 @@ interface AnThemeConfig {
|
|
|
176
184
|
showWindowChrome: boolean;
|
|
177
185
|
attachmentPreviewStyle: "thumbnail" | "chip" | "hidden";
|
|
178
186
|
}
|
|
179
|
-
|
|
180
|
-
declare
|
|
181
|
-
declare
|
|
182
|
-
declare
|
|
187
|
+
type AnThemeConfig = ChatThemeConfig;
|
|
188
|
+
declare const DEFAULT_THEME_CONFIG: ChatThemeConfig;
|
|
189
|
+
declare function extractThemeConfig(theme?: ChatTheme): ChatThemeConfig;
|
|
190
|
+
declare const ThemeConfigContext: React.Context<ChatThemeConfig>;
|
|
191
|
+
declare function useThemeConfig(): ChatThemeConfig;
|
|
183
192
|
|
|
184
193
|
interface MessageListProps {
|
|
185
194
|
messages: UIMessage[];
|
|
@@ -212,7 +221,7 @@ interface AttachedFile {
|
|
|
212
221
|
interface ContextItemsProps {
|
|
213
222
|
images: AttachedImage[];
|
|
214
223
|
files: AttachedFile[];
|
|
215
|
-
previewStyle:
|
|
224
|
+
previewStyle: ChatThemeConfig["attachmentPreviewStyle"];
|
|
216
225
|
innerRadius?: number;
|
|
217
226
|
onRemoveImage?: (id: string) => void;
|
|
218
227
|
onRemoveFile?: (id: string) => void;
|
|
@@ -236,7 +245,7 @@ interface InputBarProps {
|
|
|
236
245
|
onPaste?: (e: React.ClipboardEvent) => void;
|
|
237
246
|
isDragOver?: boolean;
|
|
238
247
|
modelSelector?: {
|
|
239
|
-
models:
|
|
248
|
+
models: ModelOption[];
|
|
240
249
|
activeModelId?: string;
|
|
241
250
|
onModelChange?: (id: string) => void;
|
|
242
251
|
display?: "popover" | "badge";
|
|
@@ -300,13 +309,13 @@ interface AttachmentButtonProps {
|
|
|
300
309
|
declare const AttachmentButton: React.NamedExoticComponent<AttachmentButtonProps>;
|
|
301
310
|
|
|
302
311
|
declare function ModelPopover({ models, activeModelId, onModelChange, innerRadius, }: {
|
|
303
|
-
models:
|
|
312
|
+
models: ModelOption[];
|
|
304
313
|
activeModelId?: string;
|
|
305
314
|
onModelChange?: (id: string) => void;
|
|
306
315
|
innerRadius?: number;
|
|
307
316
|
}): react_jsx_runtime.JSX.Element;
|
|
308
317
|
declare function ModelBadge({ models, activeModelId, innerRadius, }: {
|
|
309
|
-
models:
|
|
318
|
+
models: ModelOption[];
|
|
310
319
|
activeModelId?: string;
|
|
311
320
|
innerRadius?: number;
|
|
312
321
|
}): react_jsx_runtime.JSX.Element;
|
|
@@ -592,11 +601,11 @@ declare function ActionRow({ step, state, onComplete, index, showIcon, size, }:
|
|
|
592
601
|
size?: ToolSize;
|
|
593
602
|
}): react_jsx_runtime.JSX.Element;
|
|
594
603
|
|
|
595
|
-
declare function resolveToolSize(config:
|
|
604
|
+
declare function resolveToolSize(config: ChatThemeConfig): ToolSize;
|
|
596
605
|
|
|
597
606
|
declare function routeToolCall(step: Extract<TimelineStep, {
|
|
598
607
|
type: "tool-call";
|
|
599
|
-
}>, state: StepState, onComplete: () => void, config:
|
|
608
|
+
}>, state: StepState, onComplete: () => void, config: ChatThemeConfig, actionIndex: number): React.ReactNode;
|
|
600
609
|
|
|
601
610
|
declare function useToolComplete(isAnimating: boolean, duration: number, onComplete: () => void): void;
|
|
602
611
|
|
|
@@ -664,11 +673,14 @@ declare function FileExtIcon({ filename, className }: {
|
|
|
664
673
|
|
|
665
674
|
declare function PaperclipIcon(): react_jsx_runtime.JSX.Element;
|
|
666
675
|
|
|
667
|
-
/** Claude model IDs supported by the
|
|
668
|
-
type
|
|
669
|
-
/** Pre-defined Claude models available through
|
|
670
|
-
declare const
|
|
676
|
+
/** Claude model IDs supported by the relay */
|
|
677
|
+
type ClaudeModelId = "opus" | "sonnet" | "haiku";
|
|
678
|
+
/** Pre-defined Claude models available through the relay */
|
|
679
|
+
declare const CLAUDE_MODELS: ModelOption[];
|
|
671
680
|
/** Default model ID */
|
|
672
|
-
declare const
|
|
681
|
+
declare const DEFAULT_MODEL_ID: ClaudeModelId;
|
|
682
|
+
type AnClaudeModelId = ClaudeModelId;
|
|
683
|
+
declare const AN_CLAUDE_MODELS: ModelOption[];
|
|
684
|
+
declare const AN_DEFAULT_MODEL_ID: "sonnet";
|
|
673
685
|
|
|
674
|
-
export { AN_CLAUDE_MODELS, AN_DEFAULT_MODEL_ID, ActionRow, AnAgentChat, type AnAgentChatProps, type AnClassNames, type AnClaudeModelId, type AnModelOption, type AnSlots, type AnTheme, type AnThemeConfig, type AttachedFile, type AttachedImage, AttachmentButton, BashTool, CheckIcon16, ChevronDown, ChevronRightIcon, ContextItems, type CreateAnChatOptions, type CustomToolRendererProps, DEFAULT_THEME_CONFIG, DateDivider, EditTool, FileChip, FileExtIcon, GenericTool, ImageThumb, ImageThumbInput, InlineModeSelector, InputBar, LightbulbIcon, McpTool, MessageActions, MessageList, ModeSelector, ModelBadge, ModelPopover, PaperclipIcon, PlanTool, PopoverShell, SearchGroupMinimal, SearchGroupRich, SearchIcon, SearchTool, SendButtonUnified, SettingsPopover, SourceIcon, type SourceType, SparklesIcon, SpinnerIcon16, type StepState, StreamingMarkdown, TaskTool, TerminalIcon, ThemeConfigContext, ThinkingTool, type TimelineStep, TodoTool, ToggleSwitch, ToolRenderer, ToolRowBase, type ToolSize, ToolTimer, UserMessage, WindowChrome, EditTool as WriteTool, applyTheme, createAnChat, extractThemeConfig, loadGoogleFont, mapToolInvocationToStep, mapToolStateToStepState, resolveToolSize, routeToolCall, useInputTyping, useStreamingText, useThemeConfig, useToolComplete };
|
|
686
|
+
export { AN_CLAUDE_MODELS, AN_DEFAULT_MODEL_ID, ActionRow, AgentChat, type AgentChatProps, AnAgentChat, type AnAgentChatProps, type AnClassNames, type AnClaudeModelId, type AnModelOption, type AnSlots, type AnTheme, type AnThemeConfig, type AttachedFile, type AttachedImage, AttachmentButton, BashTool, CLAUDE_MODELS, type ChatClassNames, type ChatSlots, type ChatTheme, type ChatThemeConfig, CheckIcon16, ChevronDown, ChevronRightIcon, type ClaudeModelId, ContextItems, type CreateAgentChatOptions, type CreateAnChatOptions, type CustomToolRendererProps, DEFAULT_MODEL_ID, DEFAULT_THEME_CONFIG, DateDivider, EditTool, FileChip, FileExtIcon, GenericTool, ImageThumb, ImageThumbInput, InlineModeSelector, InputBar, LightbulbIcon, McpTool, MessageActions, MessageList, ModeSelector, ModelBadge, type ModelOption, ModelPopover, PaperclipIcon, PlanTool, PopoverShell, SearchGroupMinimal, SearchGroupRich, SearchIcon, SearchTool, SendButtonUnified, SettingsPopover, SourceIcon, type SourceType, SparklesIcon, SpinnerIcon16, type StepState, StreamingMarkdown, TaskTool, TerminalIcon, ThemeConfigContext, ThinkingTool, type TimelineStep, TodoTool, ToggleSwitch, ToolRenderer, ToolRowBase, type ToolSize, ToolTimer, UserMessage, WindowChrome, EditTool as WriteTool, applyTheme, createAgentChat, createAnChat, extractThemeConfig, loadGoogleFont, mapToolInvocationToStep, mapToolStateToStepState, resolveToolSize, routeToolCall, useInputTyping, useStreamingText, useThemeConfig, useToolComplete };
|
package/dist/index.d.ts
CHANGED
|
@@ -3,14 +3,14 @@ import React, { ReactNode } from 'react';
|
|
|
3
3
|
import { UIMessage, ChatStatus } from 'ai';
|
|
4
4
|
import { Chat } from '@ai-sdk/react';
|
|
5
5
|
|
|
6
|
-
/** Theme JSON generated by the
|
|
7
|
-
interface
|
|
6
|
+
/** Theme JSON generated by the playground */
|
|
7
|
+
interface ChatTheme {
|
|
8
8
|
theme: Record<string, string>;
|
|
9
9
|
light: Record<string, string>;
|
|
10
10
|
dark: Record<string, string>;
|
|
11
11
|
}
|
|
12
12
|
/** Per-element CSS class overrides */
|
|
13
|
-
interface
|
|
13
|
+
interface ChatClassNames {
|
|
14
14
|
root: string;
|
|
15
15
|
messageList: string;
|
|
16
16
|
userMessage: string;
|
|
@@ -28,15 +28,15 @@ interface AnClassNames {
|
|
|
28
28
|
toolGeneric: string;
|
|
29
29
|
}
|
|
30
30
|
/** Component slot overrides */
|
|
31
|
-
interface
|
|
31
|
+
interface ChatSlots {
|
|
32
32
|
InputBar: React.ComponentType<any>;
|
|
33
33
|
UserMessage: React.ComponentType<any>;
|
|
34
34
|
AssistantMessage: React.ComponentType<any>;
|
|
35
35
|
ToolRenderer: React.ComponentType<any>;
|
|
36
36
|
MessageActions: React.ComponentType<any>;
|
|
37
37
|
}
|
|
38
|
-
/** Props for
|
|
39
|
-
interface
|
|
38
|
+
/** Props for createAgentChat() */
|
|
39
|
+
interface CreateAgentChatOptions {
|
|
40
40
|
agent: string;
|
|
41
41
|
/** Provide either tokenUrl (simple) or getToken (full control) */
|
|
42
42
|
tokenUrl?: string;
|
|
@@ -53,10 +53,10 @@ interface CreateAnChatOptions {
|
|
|
53
53
|
*
|
|
54
54
|
* @example
|
|
55
55
|
* // Per-user sandbox
|
|
56
|
-
*
|
|
56
|
+
* createAgentChat({ agent: "my-agent", tokenUrl: "/api/an/token", sandboxId: `user-${userId}` })
|
|
57
57
|
*
|
|
58
58
|
* // Continue existing sandbox
|
|
59
|
-
*
|
|
59
|
+
* createAgentChat({ agent: "my-agent", tokenUrl: "/api/an/token", sandboxId: sandbox.id })
|
|
60
60
|
*/
|
|
61
61
|
sandboxId?: string;
|
|
62
62
|
/**
|
|
@@ -75,13 +75,13 @@ interface CustomToolRendererProps {
|
|
|
75
75
|
status: "pending" | "streaming" | "success" | "error";
|
|
76
76
|
}
|
|
77
77
|
/** A model option for the model selector */
|
|
78
|
-
interface
|
|
78
|
+
interface ModelOption {
|
|
79
79
|
id: string;
|
|
80
80
|
name: string;
|
|
81
81
|
version?: string;
|
|
82
82
|
}
|
|
83
|
-
/** Props for the <
|
|
84
|
-
interface
|
|
83
|
+
/** Props for the <AgentChat> drop-in component */
|
|
84
|
+
interface AgentChatProps {
|
|
85
85
|
messages: UIMessage[];
|
|
86
86
|
onSend: (message: {
|
|
87
87
|
role: "user";
|
|
@@ -90,16 +90,16 @@ interface AnAgentChatProps {
|
|
|
90
90
|
status: ChatStatus;
|
|
91
91
|
onStop: () => void;
|
|
92
92
|
error?: Error;
|
|
93
|
-
theme?:
|
|
93
|
+
theme?: ChatTheme;
|
|
94
94
|
colorMode?: "light" | "dark" | "auto";
|
|
95
|
-
classNames?: Partial<
|
|
96
|
-
slots?: Partial<
|
|
95
|
+
classNames?: Partial<ChatClassNames>;
|
|
96
|
+
slots?: Partial<ChatSlots>;
|
|
97
97
|
toolRenderers?: Record<string, React.ComponentType<CustomToolRendererProps>>;
|
|
98
98
|
/** Show window chrome header (traffic lights + agent indicator) */
|
|
99
99
|
showWindowChrome?: boolean;
|
|
100
100
|
/** Model selector configuration */
|
|
101
101
|
modelSelector?: {
|
|
102
|
-
models:
|
|
102
|
+
models: ModelOption[];
|
|
103
103
|
activeModelId?: string;
|
|
104
104
|
onModelChange?: (id: string) => void;
|
|
105
105
|
display?: "popover" | "badge";
|
|
@@ -138,16 +138,24 @@ interface AnAgentChatProps {
|
|
|
138
138
|
className?: string;
|
|
139
139
|
style?: React.CSSProperties;
|
|
140
140
|
}
|
|
141
|
+
type AnTheme = ChatTheme;
|
|
142
|
+
type AnClassNames = ChatClassNames;
|
|
143
|
+
type AnSlots = ChatSlots;
|
|
144
|
+
type CreateAnChatOptions = CreateAgentChatOptions;
|
|
145
|
+
type AnModelOption = ModelOption;
|
|
146
|
+
type AnAgentChatProps = AgentChatProps;
|
|
141
147
|
|
|
142
|
-
declare function
|
|
148
|
+
declare function AgentChat({ messages, onSend, status, onStop, error, theme, colorMode, classNames, slots, toolRenderers, showWindowChrome, modelSelector, modeSelector, attachments, className, style, }: AgentChatProps): react_jsx_runtime.JSX.Element;
|
|
149
|
+
declare const AnAgentChat: typeof AgentChat;
|
|
143
150
|
|
|
144
|
-
/** Create an AI SDK Chat instance pointed at the
|
|
145
|
-
declare function
|
|
151
|
+
/** Create an AI SDK Chat instance pointed at the relay API */
|
|
152
|
+
declare function createAgentChat(options: CreateAgentChatOptions): Chat<UIMessage>;
|
|
153
|
+
declare const createAnChat: typeof createAgentChat;
|
|
146
154
|
|
|
147
155
|
/** Apply theme CSS variables from playground JSON to a DOM element */
|
|
148
|
-
declare function applyTheme(element: HTMLElement, theme:
|
|
156
|
+
declare function applyTheme(element: HTMLElement, theme: ChatTheme, colorMode?: "light" | "dark" | "auto"): void;
|
|
149
157
|
|
|
150
|
-
interface
|
|
158
|
+
interface ChatThemeConfig {
|
|
151
159
|
messageStyle: "bubble-right" | "full-width";
|
|
152
160
|
messageDensity: "relaxed" | "compact" | "dense";
|
|
153
161
|
inputStyle: "rounded" | "flat" | "bordered";
|
|
@@ -176,10 +184,11 @@ interface AnThemeConfig {
|
|
|
176
184
|
showWindowChrome: boolean;
|
|
177
185
|
attachmentPreviewStyle: "thumbnail" | "chip" | "hidden";
|
|
178
186
|
}
|
|
179
|
-
|
|
180
|
-
declare
|
|
181
|
-
declare
|
|
182
|
-
declare
|
|
187
|
+
type AnThemeConfig = ChatThemeConfig;
|
|
188
|
+
declare const DEFAULT_THEME_CONFIG: ChatThemeConfig;
|
|
189
|
+
declare function extractThemeConfig(theme?: ChatTheme): ChatThemeConfig;
|
|
190
|
+
declare const ThemeConfigContext: React.Context<ChatThemeConfig>;
|
|
191
|
+
declare function useThemeConfig(): ChatThemeConfig;
|
|
183
192
|
|
|
184
193
|
interface MessageListProps {
|
|
185
194
|
messages: UIMessage[];
|
|
@@ -212,7 +221,7 @@ interface AttachedFile {
|
|
|
212
221
|
interface ContextItemsProps {
|
|
213
222
|
images: AttachedImage[];
|
|
214
223
|
files: AttachedFile[];
|
|
215
|
-
previewStyle:
|
|
224
|
+
previewStyle: ChatThemeConfig["attachmentPreviewStyle"];
|
|
216
225
|
innerRadius?: number;
|
|
217
226
|
onRemoveImage?: (id: string) => void;
|
|
218
227
|
onRemoveFile?: (id: string) => void;
|
|
@@ -236,7 +245,7 @@ interface InputBarProps {
|
|
|
236
245
|
onPaste?: (e: React.ClipboardEvent) => void;
|
|
237
246
|
isDragOver?: boolean;
|
|
238
247
|
modelSelector?: {
|
|
239
|
-
models:
|
|
248
|
+
models: ModelOption[];
|
|
240
249
|
activeModelId?: string;
|
|
241
250
|
onModelChange?: (id: string) => void;
|
|
242
251
|
display?: "popover" | "badge";
|
|
@@ -300,13 +309,13 @@ interface AttachmentButtonProps {
|
|
|
300
309
|
declare const AttachmentButton: React.NamedExoticComponent<AttachmentButtonProps>;
|
|
301
310
|
|
|
302
311
|
declare function ModelPopover({ models, activeModelId, onModelChange, innerRadius, }: {
|
|
303
|
-
models:
|
|
312
|
+
models: ModelOption[];
|
|
304
313
|
activeModelId?: string;
|
|
305
314
|
onModelChange?: (id: string) => void;
|
|
306
315
|
innerRadius?: number;
|
|
307
316
|
}): react_jsx_runtime.JSX.Element;
|
|
308
317
|
declare function ModelBadge({ models, activeModelId, innerRadius, }: {
|
|
309
|
-
models:
|
|
318
|
+
models: ModelOption[];
|
|
310
319
|
activeModelId?: string;
|
|
311
320
|
innerRadius?: number;
|
|
312
321
|
}): react_jsx_runtime.JSX.Element;
|
|
@@ -592,11 +601,11 @@ declare function ActionRow({ step, state, onComplete, index, showIcon, size, }:
|
|
|
592
601
|
size?: ToolSize;
|
|
593
602
|
}): react_jsx_runtime.JSX.Element;
|
|
594
603
|
|
|
595
|
-
declare function resolveToolSize(config:
|
|
604
|
+
declare function resolveToolSize(config: ChatThemeConfig): ToolSize;
|
|
596
605
|
|
|
597
606
|
declare function routeToolCall(step: Extract<TimelineStep, {
|
|
598
607
|
type: "tool-call";
|
|
599
|
-
}>, state: StepState, onComplete: () => void, config:
|
|
608
|
+
}>, state: StepState, onComplete: () => void, config: ChatThemeConfig, actionIndex: number): React.ReactNode;
|
|
600
609
|
|
|
601
610
|
declare function useToolComplete(isAnimating: boolean, duration: number, onComplete: () => void): void;
|
|
602
611
|
|
|
@@ -664,11 +673,14 @@ declare function FileExtIcon({ filename, className }: {
|
|
|
664
673
|
|
|
665
674
|
declare function PaperclipIcon(): react_jsx_runtime.JSX.Element;
|
|
666
675
|
|
|
667
|
-
/** Claude model IDs supported by the
|
|
668
|
-
type
|
|
669
|
-
/** Pre-defined Claude models available through
|
|
670
|
-
declare const
|
|
676
|
+
/** Claude model IDs supported by the relay */
|
|
677
|
+
type ClaudeModelId = "opus" | "sonnet" | "haiku";
|
|
678
|
+
/** Pre-defined Claude models available through the relay */
|
|
679
|
+
declare const CLAUDE_MODELS: ModelOption[];
|
|
671
680
|
/** Default model ID */
|
|
672
|
-
declare const
|
|
681
|
+
declare const DEFAULT_MODEL_ID: ClaudeModelId;
|
|
682
|
+
type AnClaudeModelId = ClaudeModelId;
|
|
683
|
+
declare const AN_CLAUDE_MODELS: ModelOption[];
|
|
684
|
+
declare const AN_DEFAULT_MODEL_ID: "sonnet";
|
|
673
685
|
|
|
674
|
-
export { AN_CLAUDE_MODELS, AN_DEFAULT_MODEL_ID, ActionRow, AnAgentChat, type AnAgentChatProps, type AnClassNames, type AnClaudeModelId, type AnModelOption, type AnSlots, type AnTheme, type AnThemeConfig, type AttachedFile, type AttachedImage, AttachmentButton, BashTool, CheckIcon16, ChevronDown, ChevronRightIcon, ContextItems, type CreateAnChatOptions, type CustomToolRendererProps, DEFAULT_THEME_CONFIG, DateDivider, EditTool, FileChip, FileExtIcon, GenericTool, ImageThumb, ImageThumbInput, InlineModeSelector, InputBar, LightbulbIcon, McpTool, MessageActions, MessageList, ModeSelector, ModelBadge, ModelPopover, PaperclipIcon, PlanTool, PopoverShell, SearchGroupMinimal, SearchGroupRich, SearchIcon, SearchTool, SendButtonUnified, SettingsPopover, SourceIcon, type SourceType, SparklesIcon, SpinnerIcon16, type StepState, StreamingMarkdown, TaskTool, TerminalIcon, ThemeConfigContext, ThinkingTool, type TimelineStep, TodoTool, ToggleSwitch, ToolRenderer, ToolRowBase, type ToolSize, ToolTimer, UserMessage, WindowChrome, EditTool as WriteTool, applyTheme, createAnChat, extractThemeConfig, loadGoogleFont, mapToolInvocationToStep, mapToolStateToStepState, resolveToolSize, routeToolCall, useInputTyping, useStreamingText, useThemeConfig, useToolComplete };
|
|
686
|
+
export { AN_CLAUDE_MODELS, AN_DEFAULT_MODEL_ID, ActionRow, AgentChat, type AgentChatProps, AnAgentChat, type AnAgentChatProps, type AnClassNames, type AnClaudeModelId, type AnModelOption, type AnSlots, type AnTheme, type AnThemeConfig, type AttachedFile, type AttachedImage, AttachmentButton, BashTool, CLAUDE_MODELS, type ChatClassNames, type ChatSlots, type ChatTheme, type ChatThemeConfig, CheckIcon16, ChevronDown, ChevronRightIcon, type ClaudeModelId, ContextItems, type CreateAgentChatOptions, type CreateAnChatOptions, type CustomToolRendererProps, DEFAULT_MODEL_ID, DEFAULT_THEME_CONFIG, DateDivider, EditTool, FileChip, FileExtIcon, GenericTool, ImageThumb, ImageThumbInput, InlineModeSelector, InputBar, LightbulbIcon, McpTool, MessageActions, MessageList, ModeSelector, ModelBadge, type ModelOption, ModelPopover, PaperclipIcon, PlanTool, PopoverShell, SearchGroupMinimal, SearchGroupRich, SearchIcon, SearchTool, SendButtonUnified, SettingsPopover, SourceIcon, type SourceType, SparklesIcon, SpinnerIcon16, type StepState, StreamingMarkdown, TaskTool, TerminalIcon, ThemeConfigContext, ThinkingTool, type TimelineStep, TodoTool, ToggleSwitch, ToolRenderer, ToolRowBase, type ToolSize, ToolTimer, UserMessage, WindowChrome, EditTool as WriteTool, applyTheme, createAgentChat, createAnChat, extractThemeConfig, loadGoogleFont, mapToolInvocationToStep, mapToolStateToStepState, resolveToolSize, routeToolCall, useInputTyping, useStreamingText, useThemeConfig, useToolComplete };
|
package/dist/index.js
CHANGED
|
@@ -13672,7 +13672,7 @@ function applyTheme(element, theme, colorMode = "auto") {
|
|
|
13672
13672
|
init_cn();
|
|
13673
13673
|
init_theme_config();
|
|
13674
13674
|
import { jsx as jsx34, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
13675
|
-
function
|
|
13675
|
+
function AgentChat({
|
|
13676
13676
|
messages,
|
|
13677
13677
|
onSend,
|
|
13678
13678
|
status,
|
|
@@ -13756,6 +13756,7 @@ function AnAgentChat({
|
|
|
13756
13756
|
}
|
|
13757
13757
|
) });
|
|
13758
13758
|
}
|
|
13759
|
+
var AnAgentChat = AgentChat;
|
|
13759
13760
|
|
|
13760
13761
|
// src/create-an-chat.ts
|
|
13761
13762
|
import { Chat } from "@ai-sdk/react";
|
|
@@ -13783,7 +13784,7 @@ function createTokenFetcher(tokenUrl, agent) {
|
|
|
13783
13784
|
return data.token;
|
|
13784
13785
|
};
|
|
13785
13786
|
}
|
|
13786
|
-
function
|
|
13787
|
+
function createAgentChat(options) {
|
|
13787
13788
|
const {
|
|
13788
13789
|
agent,
|
|
13789
13790
|
tokenUrl,
|
|
@@ -13796,7 +13797,7 @@ function createAnChat(options) {
|
|
|
13796
13797
|
} = options;
|
|
13797
13798
|
const getToken = getTokenFn || (tokenUrl ? createTokenFetcher(tokenUrl, agent) : null);
|
|
13798
13799
|
if (!getToken) {
|
|
13799
|
-
throw new Error("
|
|
13800
|
+
throw new Error("createAgentChat: provide either tokenUrl or getToken");
|
|
13800
13801
|
}
|
|
13801
13802
|
return new Chat({
|
|
13802
13803
|
id: sandboxId || `sandbox-${agent}`,
|
|
@@ -13815,6 +13816,7 @@ function createAnChat(options) {
|
|
|
13815
13816
|
onError
|
|
13816
13817
|
});
|
|
13817
13818
|
}
|
|
13819
|
+
var createAnChat = createAgentChat;
|
|
13818
13820
|
|
|
13819
13821
|
// src/index.ts
|
|
13820
13822
|
init_theme_config();
|
|
@@ -15217,23 +15219,28 @@ init_tool_icons();
|
|
|
15217
15219
|
init_file_ext_icon();
|
|
15218
15220
|
|
|
15219
15221
|
// src/models.ts
|
|
15220
|
-
var
|
|
15222
|
+
var CLAUDE_MODELS = [
|
|
15221
15223
|
{ id: "sonnet", name: "Sonnet", version: "4.6" },
|
|
15222
15224
|
{ id: "opus", name: "Opus", version: "4.6" },
|
|
15223
15225
|
{ id: "haiku", name: "Haiku", version: "4.5" }
|
|
15224
15226
|
];
|
|
15225
|
-
var
|
|
15227
|
+
var DEFAULT_MODEL_ID = "sonnet";
|
|
15228
|
+
var AN_CLAUDE_MODELS = CLAUDE_MODELS;
|
|
15229
|
+
var AN_DEFAULT_MODEL_ID = DEFAULT_MODEL_ID;
|
|
15226
15230
|
export {
|
|
15227
15231
|
AN_CLAUDE_MODELS,
|
|
15228
15232
|
AN_DEFAULT_MODEL_ID,
|
|
15229
15233
|
ActionRow,
|
|
15234
|
+
AgentChat,
|
|
15230
15235
|
AnAgentChat,
|
|
15231
15236
|
AttachmentButton,
|
|
15232
15237
|
BashTool,
|
|
15238
|
+
CLAUDE_MODELS,
|
|
15233
15239
|
CheckIcon16,
|
|
15234
15240
|
ChevronDown,
|
|
15235
15241
|
ChevronRightIcon,
|
|
15236
15242
|
ContextItems,
|
|
15243
|
+
DEFAULT_MODEL_ID,
|
|
15237
15244
|
DEFAULT_THEME_CONFIG,
|
|
15238
15245
|
DateDivider,
|
|
15239
15246
|
EditTool,
|
|
@@ -15277,6 +15284,7 @@ export {
|
|
|
15277
15284
|
WindowChrome,
|
|
15278
15285
|
EditTool as WriteTool,
|
|
15279
15286
|
applyTheme,
|
|
15287
|
+
createAgentChat,
|
|
15280
15288
|
createAnChat,
|
|
15281
15289
|
extractThemeConfig,
|
|
15282
15290
|
loadGoogleFont,
|