@ensembleapp/client-sdk 0.0.7 → 0.0.8
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/dist/index.d.ts +60 -14
- package/dist/index.js +22200 -7405
- package/dist/index.js.map +1 -1
- package/lib/components/ChatWidget.css +3 -3
- package/package.json +5 -8
- package/dist/schemas-n2u83F_H.d.ts +0 -19
- package/dist/schemas.d.ts +0 -4
- package/dist/schemas.js +0 -1
- package/dist/schemas.js.map +0 -1
- package/dist/widget/widget.global.d.ts +0 -22
- package/dist/widget/widget.global.js +0 -180
- package/dist/widget/widget.global.js.map +0 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import * as ai from 'ai';
|
|
2
2
|
import { UIMessage } from 'ai';
|
|
3
|
-
import { U as UIWidget, a as UIWidgetDefinition } from './schemas-n2u83F_H.js';
|
|
4
|
-
export { W as WidgetDefinition, c as createWidget } from './schemas-n2u83F_H.js';
|
|
5
3
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
6
|
-
import React from 'react';
|
|
4
|
+
import React$1, { ReactNode } from 'react';
|
|
5
|
+
import z, { AnyZodObject } from 'zod';
|
|
7
6
|
import { ClassValue } from 'clsx';
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
|
|
8
|
+
type UIWidget = {
|
|
9
|
+
widgetType: string;
|
|
10
|
+
} & Record<string, unknown>;
|
|
10
11
|
|
|
11
12
|
type DeprecatedChatConfig = {
|
|
12
13
|
/** @deprecated use agentId instead */
|
|
@@ -35,10 +36,34 @@ type UseChatConfig = DeprecatedChatConfig & {
|
|
|
35
36
|
onData?: (data: any) => void;
|
|
36
37
|
onMessage?: (message: UIMessage) => void;
|
|
37
38
|
};
|
|
39
|
+
interface ToolCallContent {
|
|
40
|
+
type: 'tool-call';
|
|
41
|
+
toolName: string;
|
|
42
|
+
input?: Record<string, unknown>;
|
|
43
|
+
state: 'pending' | 'output-available' | 'error';
|
|
44
|
+
output?: unknown;
|
|
45
|
+
}
|
|
46
|
+
type ChatContentItem = string | UIWidget | ToolCallContent;
|
|
47
|
+
/** A grouped section of sub-agent output, wrapped by data-tag-start/end markers */
|
|
48
|
+
interface TagGroup {
|
|
49
|
+
tagId: string;
|
|
50
|
+
content: ChatContentItem[];
|
|
51
|
+
/** Index into content[] where the last step begins (for promoting only final output) */
|
|
52
|
+
lastStepStartIndex?: number;
|
|
53
|
+
}
|
|
54
|
+
/** A single section in the message, rendered in chronological order */
|
|
55
|
+
type MessageSection = {
|
|
56
|
+
type: 'content';
|
|
57
|
+
item: ChatContentItem;
|
|
58
|
+
} | {
|
|
59
|
+
type: 'tag-group';
|
|
60
|
+
group: TagGroup;
|
|
61
|
+
};
|
|
38
62
|
interface ChatMessage {
|
|
39
63
|
id: string;
|
|
40
64
|
role: 'user' | 'assistant';
|
|
41
|
-
|
|
65
|
+
/** Ordered sections: content items and tag groups interleaved chronologically */
|
|
66
|
+
sections: MessageSection[];
|
|
42
67
|
thoughts?: (string | UIWidget)[];
|
|
43
68
|
createdAt?: Date;
|
|
44
69
|
}
|
|
@@ -100,6 +125,13 @@ declare function useFeedback({ api, threadId, agentId, agentExecutionId, }: UseF
|
|
|
100
125
|
error: Error | null;
|
|
101
126
|
};
|
|
102
127
|
|
|
128
|
+
interface UIWidgetDefinition<TSchema extends AnyZodObject = AnyZodObject> {
|
|
129
|
+
widgetType: string;
|
|
130
|
+
schema: TSchema;
|
|
131
|
+
render(widget: z.infer<TSchema>): ReactNode;
|
|
132
|
+
}
|
|
133
|
+
declare const createWidget: <TSchema extends AnyZodObject>({ widgetType, schema, render, }: UIWidgetDefinition<TSchema>) => UIWidgetDefinition<TSchema>;
|
|
134
|
+
|
|
103
135
|
interface ChatWidgetStyles {
|
|
104
136
|
primaryColor?: string;
|
|
105
137
|
primaryTextColor?: string;
|
|
@@ -162,13 +194,13 @@ interface PopupAnchorConfig {
|
|
|
162
194
|
render?: (options: {
|
|
163
195
|
isOpen: boolean;
|
|
164
196
|
toggle: () => void;
|
|
165
|
-
}) => React.ReactNode;
|
|
197
|
+
}) => React$1.ReactNode;
|
|
166
198
|
closeButton?: PopupCloseConfig;
|
|
167
199
|
}
|
|
168
200
|
interface PopupCloseConfig {
|
|
169
201
|
render?: (options: {
|
|
170
202
|
toggle: () => void;
|
|
171
|
-
}) => React.ReactNode;
|
|
203
|
+
}) => React$1.ReactNode;
|
|
172
204
|
position?: 'top-end' | 'top-start';
|
|
173
205
|
show?: boolean;
|
|
174
206
|
}
|
|
@@ -188,12 +220,19 @@ interface PopupChatWidgetProps extends ChatWidgetConfig {
|
|
|
188
220
|
}
|
|
189
221
|
declare function PopupChatWidget({ anchor, ...props }: PopupChatWidgetProps): react_jsx_runtime.JSX.Element;
|
|
190
222
|
|
|
191
|
-
interface
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
unmount: () => void;
|
|
223
|
+
interface ToolCallDisplayProps {
|
|
224
|
+
toolCall: ToolCallContent;
|
|
225
|
+
className?: string;
|
|
195
226
|
}
|
|
196
|
-
declare
|
|
227
|
+
declare function ToolCallDisplay({ toolCall, className }: ToolCallDisplayProps): react_jsx_runtime.JSX.Element;
|
|
228
|
+
|
|
229
|
+
interface TagGroupDisplayProps {
|
|
230
|
+
tagId: string;
|
|
231
|
+
isExpanded: boolean;
|
|
232
|
+
onToggle: () => void;
|
|
233
|
+
children: React.ReactNode;
|
|
234
|
+
}
|
|
235
|
+
declare function TagGroupDisplay({ tagId, isExpanded, onToggle, children, }: TagGroupDisplayProps): react_jsx_runtime.JSX.Element;
|
|
197
236
|
|
|
198
237
|
type RegisterChatWidgetsParams = {
|
|
199
238
|
api: ApiConfig;
|
|
@@ -205,6 +244,13 @@ type RegisterChatWidgetsParams = {
|
|
|
205
244
|
*/
|
|
206
245
|
declare function registerChatWidgets({ api, threadId, widgets, }: RegisterChatWidgetsParams): Promise<void>;
|
|
207
246
|
|
|
247
|
+
interface ChatWidgetInstance {
|
|
248
|
+
updateProps: (props: Partial<ChatWidgetConfig>) => void;
|
|
249
|
+
updateTheme: (styles: ChatWidgetStyles) => void;
|
|
250
|
+
unmount: () => void;
|
|
251
|
+
}
|
|
252
|
+
declare const createChatWidget: (target: HTMLElement, props: ChatWidgetConfig) => ChatWidgetInstance;
|
|
253
|
+
|
|
208
254
|
/**
|
|
209
255
|
* Embeddable Chat Widget
|
|
210
256
|
*
|
|
@@ -231,4 +277,4 @@ declare const defaultChatWidgets: UIWidgetDefinition[];
|
|
|
231
277
|
|
|
232
278
|
declare function cn(...inputs: ClassValue[]): string;
|
|
233
279
|
|
|
234
|
-
export { type ApiConfig, type ChatMessage, ChatWidget, type ChatWidgetFeedbackOptions, type ChatWidgetInstance, type ChatWidgetConfig as ChatWidgetProps, type ChatWidgetSpeechToTextOptions, type ChatWidgetStyles, type ChatWidgetVoiceOptions, type EmbeddableChatWidgetConfig, type FeedbackRating, type FeedbackState, type MessageFeedback, type PopupAnchorConfig, PopupChatWidget, type PopupChatWidgetProps, type SubmitFeedbackParams,
|
|
280
|
+
export { type ApiConfig, type ChatContentItem, type ChatMessage, ChatWidget, type ChatWidgetFeedbackOptions, type ChatWidgetInstance, type ChatWidgetConfig as ChatWidgetProps, type ChatWidgetSpeechToTextOptions, type ChatWidgetStyles, type ChatWidgetVoiceOptions, type EmbeddableChatWidgetConfig, type FeedbackRating, type FeedbackState, type MessageFeedback, type MessageSection, type PopupAnchorConfig, PopupChatWidget, type PopupChatWidgetProps, type SubmitFeedbackParams, type TagGroup, TagGroupDisplay, type TagGroupDisplayProps, type ToolCallContent, ToolCallDisplay, type ToolCallDisplayProps, type UIWidgetDefinition, type UseChatConfig, type UseFeedbackConfig, cn, createChatWidget, createWidget, defaultChatWidgets, registerChatWidgets, useChat, useFeedback };
|