@wallavi/widget 1.6.8 → 1.7.1
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.mts +152 -6
- package/dist/index.d.ts +152 -6
- package/dist/index.js +1923 -436
- package/dist/index.mjs +1921 -438
- package/dist/styles.css +1 -0
- package/package.json +12 -8
package/dist/index.d.mts
CHANGED
|
@@ -66,6 +66,36 @@ interface UserContext {
|
|
|
66
66
|
pageContext?: PageContext;
|
|
67
67
|
metadata?: Record<string, unknown>;
|
|
68
68
|
}
|
|
69
|
+
/**
|
|
70
|
+
* Plug-in backend for non-AI modes (e.g. human support chat).
|
|
71
|
+
* When provided, ChatWidget/useChat skip all Wallavi AI API calls and
|
|
72
|
+
* use these values directly — same UI, different message source.
|
|
73
|
+
*/
|
|
74
|
+
interface CustomBackend {
|
|
75
|
+
messages: Message[];
|
|
76
|
+
streaming: boolean;
|
|
77
|
+
send: (text: string, attachments?: AttachmentPayload[]) => Promise<void>;
|
|
78
|
+
reset?: () => void;
|
|
79
|
+
/** Current chat mode — used to display a status indicator in the widget. */
|
|
80
|
+
mode?: "ai" | "human";
|
|
81
|
+
/** Optional action button rendered between messages and input (e.g. "Talk to a human"). */
|
|
82
|
+
footerAction?: {
|
|
83
|
+
label: string;
|
|
84
|
+
sublabel?: string;
|
|
85
|
+
icon?: "human" | "ai";
|
|
86
|
+
onClick: () => Promise<void>;
|
|
87
|
+
loading?: boolean;
|
|
88
|
+
};
|
|
89
|
+
voiceCall?: {
|
|
90
|
+
active: boolean;
|
|
91
|
+
token: string | null;
|
|
92
|
+
serverUrl: string | null;
|
|
93
|
+
start: () => Promise<void>;
|
|
94
|
+
stop: () => void;
|
|
95
|
+
loading: boolean;
|
|
96
|
+
error: string | null;
|
|
97
|
+
};
|
|
98
|
+
}
|
|
69
99
|
interface ChatWidgetConfig {
|
|
70
100
|
agentId: string;
|
|
71
101
|
workspaceId?: string;
|
|
@@ -95,6 +125,7 @@ interface ChatWidgetConfig {
|
|
|
95
125
|
*/
|
|
96
126
|
hideCloseButton?: boolean;
|
|
97
127
|
source?: string;
|
|
128
|
+
envId?: string;
|
|
98
129
|
userContext?: UserContext;
|
|
99
130
|
/** Per-session tool overrides used by Playground (not persisted) */
|
|
100
131
|
playgroundOverrides?: {
|
|
@@ -120,6 +151,10 @@ interface ChatWidgetConfig {
|
|
|
120
151
|
* Default: false.
|
|
121
152
|
*/
|
|
122
153
|
enableAttachments?: boolean;
|
|
154
|
+
/** When set, bypasses Wallavi AI and routes messages through this backend instead. */
|
|
155
|
+
customBackend?: CustomBackend;
|
|
156
|
+
/** Callback fired when a debug-trace event arrives from the pipeline. Only emitted for source="playground". */
|
|
157
|
+
onDebugTrace?: (trace: Record<string, unknown>) => void;
|
|
123
158
|
}
|
|
124
159
|
interface ChatWidgetProps extends ChatWidgetConfig {
|
|
125
160
|
className?: string;
|
|
@@ -129,6 +164,8 @@ interface ChatWidgetProps extends ChatWidgetConfig {
|
|
|
129
164
|
onExpand?: () => void;
|
|
130
165
|
/** Controls which icon the expand button shows (expand vs minimize). */
|
|
131
166
|
expanded?: boolean;
|
|
167
|
+
/** When true, removes border-radius, border, and shadow — use when ChatWidget is rendered inside an iframe whose container already provides those styles. */
|
|
168
|
+
embedded?: boolean;
|
|
132
169
|
}
|
|
133
170
|
type AttachmentContentType = "text" | "image" | "unsupported";
|
|
134
171
|
/** Wire-format DTO included in /api/chat/stream request when files are attached. */
|
|
@@ -159,7 +196,18 @@ interface Attachment {
|
|
|
159
196
|
declare function getContrastColor(hex: string): string;
|
|
160
197
|
declare function formatToolName(name: string): string;
|
|
161
198
|
|
|
162
|
-
interface BubbleWidgetProps extends ChatWidgetConfig {
|
|
199
|
+
interface BubbleWidgetProps extends Partial<ChatWidgetConfig> {
|
|
200
|
+
/**
|
|
201
|
+
* Inbox token from Wallavi Support dashboard.
|
|
202
|
+
* When provided, the widget connects to the support inbox (human agents + optional AI)
|
|
203
|
+
* instead of a direct AI agent. Mutually exclusive with agentId.
|
|
204
|
+
*/
|
|
205
|
+
inboxToken?: string;
|
|
206
|
+
/**
|
|
207
|
+
* Base URL of the Wallavi app. Only needed when using inboxToken from an external domain.
|
|
208
|
+
* @default "https://app.wallavi.com"
|
|
209
|
+
*/
|
|
210
|
+
supportApiBase?: string;
|
|
163
211
|
/** Where the bubble is anchored. Default: "bottom-right" */
|
|
164
212
|
position?: "bottom-right" | "bottom-left";
|
|
165
213
|
/** Chat panel width in px. Default: 360 */
|
|
@@ -213,14 +261,26 @@ interface BubbleWidgetProps extends ChatWidgetConfig {
|
|
|
213
261
|
* Use together with isOpen to fully control open/close from outside.
|
|
214
262
|
*/
|
|
215
263
|
onOpenChange?: (open: boolean) => void;
|
|
264
|
+
/**
|
|
265
|
+
* Label for the footer button shown while AI mode is active (prompts user to escalate).
|
|
266
|
+
* @default "Hablar con un agente"
|
|
267
|
+
*/
|
|
268
|
+
requestHumanLabel?: string;
|
|
269
|
+
/**
|
|
270
|
+
* Label for the footer button shown while a human agent is handling the chat.
|
|
271
|
+
* When omitted the button is not rendered and the user cannot return to AI.
|
|
272
|
+
* @example "Volver a chatear con la IA"
|
|
273
|
+
*/
|
|
274
|
+
returnToAiLabel?: string;
|
|
216
275
|
}
|
|
217
|
-
declare function BubbleWidget({ position: positionProp, width: widthProp, height: heightProp, expandedWidth, expandedHeight, keyboardShortcut: keyboardShortcutProp, shortcutKey, autoOpen: autoOpenProp, bubbleIconUrl: bubbleIconUrlProp, bubbleSize: bubbleSizeProp, panelClassName, autoConfig, hideBubble, isOpen: isOpenProp, onOpenChange, ...chatProps }: BubbleWidgetProps): react_jsx_runtime.JSX.Element;
|
|
276
|
+
declare function BubbleWidget({ inboxToken, supportApiBase, requestHumanLabel, returnToAiLabel, position: positionProp, width: widthProp, height: heightProp, expandedWidth, expandedHeight, keyboardShortcut: keyboardShortcutProp, shortcutKey, autoOpen: autoOpenProp, bubbleIconUrl: bubbleIconUrlProp, bubbleSize: bubbleSizeProp, panelClassName, autoConfig, hideBubble, isOpen: isOpenProp, onOpenChange, ...chatProps }: BubbleWidgetProps): react_jsx_runtime.JSX.Element;
|
|
218
277
|
|
|
219
|
-
declare function ChatWidget({ agentId, workspaceId, agentName, displayName, profilePicture, userMessageColor, initialMessages, suggestedMessages, messagePlaceholder, watermark, watermarkLogoUrl, footer, theme, showThinking, regenerateMessage, persist, onNavigate, hideCloseButton, source, userContext, playgroundOverrides, enableVoice, voiceAutoSend, enableAttachments, className, onClose, onReset, onExpand, expanded, }: ChatWidgetProps): react_jsx_runtime.JSX.Element;
|
|
278
|
+
declare function ChatWidget({ agentId, workspaceId, agentName, displayName, profilePicture, userMessageColor, initialMessages, suggestedMessages, messagePlaceholder, watermark, watermarkLogoUrl, footer, theme, showThinking, regenerateMessage, persist, onNavigate, hideCloseButton, source, userContext, playgroundOverrides, enableVoice, voiceAutoSend, enableAttachments, customBackend, className, onClose, onReset, onExpand, expanded, embedded, envId, onDebugTrace, }: ChatWidgetProps): react_jsx_runtime.JSX.Element;
|
|
220
279
|
|
|
221
280
|
interface UseChatOptions {
|
|
222
281
|
agentId: string;
|
|
223
282
|
workspaceId?: string;
|
|
283
|
+
envId?: string;
|
|
224
284
|
source?: string;
|
|
225
285
|
userContext?: UserContext;
|
|
226
286
|
persist?: boolean;
|
|
@@ -230,6 +290,7 @@ interface UseChatOptions {
|
|
|
230
290
|
mcpIds?: string[];
|
|
231
291
|
actionIds?: string[];
|
|
232
292
|
};
|
|
293
|
+
customBackend?: CustomBackend;
|
|
233
294
|
}
|
|
234
295
|
interface UseChatReturn {
|
|
235
296
|
messages: Message[];
|
|
@@ -243,8 +304,93 @@ interface UseChatReturn {
|
|
|
243
304
|
regenerate: () => Promise<void>;
|
|
244
305
|
reset: () => void;
|
|
245
306
|
selectPickerOption: (pickerId: string, paramName: string, value: string, label: string) => Promise<void>;
|
|
307
|
+
/** Pipeline debug traces — only populated when source="playground" */
|
|
308
|
+
debugTraces: DebugTrace[];
|
|
309
|
+
voiceCall?: {
|
|
310
|
+
active: boolean;
|
|
311
|
+
token: string | null;
|
|
312
|
+
serverUrl: string | null;
|
|
313
|
+
start: () => Promise<void>;
|
|
314
|
+
stop: () => void;
|
|
315
|
+
loading: boolean;
|
|
316
|
+
error: string | null;
|
|
317
|
+
};
|
|
318
|
+
}
|
|
319
|
+
/** Structured pipeline execution data emitted per-turn from the backend */
|
|
320
|
+
interface DebugTrace {
|
|
321
|
+
threadId: string;
|
|
322
|
+
agentId: string;
|
|
323
|
+
sessionId: string;
|
|
324
|
+
turn: number;
|
|
325
|
+
timestamp: number;
|
|
326
|
+
durationMs: number;
|
|
327
|
+
userMessage: string;
|
|
328
|
+
assistantResponse: string;
|
|
329
|
+
router: {
|
|
330
|
+
intent: string;
|
|
331
|
+
capability: string;
|
|
332
|
+
complexity?: string;
|
|
333
|
+
};
|
|
334
|
+
tools: {
|
|
335
|
+
available: number;
|
|
336
|
+
selected: number;
|
|
337
|
+
executed: string[];
|
|
338
|
+
targetTool?: string;
|
|
339
|
+
selectedNames?: string[];
|
|
340
|
+
};
|
|
341
|
+
params: {
|
|
342
|
+
available: Record<string, string>;
|
|
343
|
+
missing: string[];
|
|
344
|
+
};
|
|
345
|
+
provider: {
|
|
346
|
+
name: string;
|
|
347
|
+
model: string;
|
|
348
|
+
fallbackCount: number;
|
|
349
|
+
};
|
|
350
|
+
tokens: {
|
|
351
|
+
input: number;
|
|
352
|
+
output: number;
|
|
353
|
+
total: number;
|
|
354
|
+
};
|
|
355
|
+
executionStatus: string;
|
|
356
|
+
flags: string[];
|
|
357
|
+
}
|
|
358
|
+
declare function useChat({ agentId, workspaceId, envId, source, userContext, persist, onNavigate, playgroundOverrides, customBackend, }: UseChatOptions): UseChatReturn;
|
|
359
|
+
|
|
360
|
+
declare function PlanCard({ part, onSend, disabled, }: {
|
|
361
|
+
part: PlanPart;
|
|
362
|
+
onSend?: (text: string) => void;
|
|
363
|
+
disabled?: boolean;
|
|
364
|
+
}): react_jsx_runtime.JSX.Element;
|
|
365
|
+
|
|
366
|
+
declare function ToolCallBadge({ part }: {
|
|
367
|
+
part: ToolPart;
|
|
368
|
+
}): react_jsx_runtime.JSX.Element;
|
|
369
|
+
declare function ReasoningBlock({ text }: {
|
|
370
|
+
text: string;
|
|
371
|
+
}): react_jsx_runtime.JSX.Element;
|
|
372
|
+
|
|
373
|
+
interface UseSupportChatOptions {
|
|
374
|
+
/** Inbox token from Wallavi Support dashboard. */
|
|
375
|
+
inboxToken: string;
|
|
376
|
+
/**
|
|
377
|
+
* Base URL of the Wallavi app that hosts the support-chat API routes.
|
|
378
|
+
* @default "https://app.wallavi.com"
|
|
379
|
+
*/
|
|
380
|
+
apiBase?: string;
|
|
381
|
+
/**
|
|
382
|
+
* Label for the footer button shown when AI mode is active.
|
|
383
|
+
* @default "Hablar con un agente"
|
|
384
|
+
*/
|
|
385
|
+
requestHumanLabel?: string;
|
|
386
|
+
/**
|
|
387
|
+
* Label for the footer button shown when human agent mode is active.
|
|
388
|
+
* If not set, no "return to AI" button is shown.
|
|
389
|
+
* @example "Volver a chatear con la IA"
|
|
390
|
+
*/
|
|
391
|
+
returnToAiLabel?: string;
|
|
246
392
|
}
|
|
247
|
-
declare function
|
|
393
|
+
declare function useSupportChat({ inboxToken, apiBase, requestHumanLabel, returnToAiLabel, }: UseSupportChatOptions): CustomBackend;
|
|
248
394
|
|
|
249
395
|
type VoiceState = "idle" | "recording" | "transcribing" | "error";
|
|
250
396
|
interface UseVoiceOptions {
|
|
@@ -262,7 +408,7 @@ interface UseVoiceReturn {
|
|
|
262
408
|
start: () => Promise<void>;
|
|
263
409
|
stop: () => void;
|
|
264
410
|
}
|
|
265
|
-
declare function useVoice({ agentId, apiUrl, onTranscript, onError }: UseVoiceOptions): UseVoiceReturn;
|
|
411
|
+
declare function useVoice({ agentId, apiUrl, onTranscript, onError, }: UseVoiceOptions): UseVoiceReturn;
|
|
266
412
|
|
|
267
413
|
interface UseAttachmentsOptions {
|
|
268
414
|
agentId: string;
|
|
@@ -284,4 +430,4 @@ interface UseAttachmentsReturn {
|
|
|
284
430
|
}
|
|
285
431
|
declare function useAttachments({ agentId, apiUrl, maxFiles, }: UseAttachmentsOptions): UseAttachmentsReturn;
|
|
286
432
|
|
|
287
|
-
export { type Attachment, type AttachmentContentType, type AttachmentPayload, type AttachmentStatus, BubbleWidget, type BubbleWidgetProps, ChatWidget, type ChatWidgetConfig, type ChatWidgetProps, type Message, type MessagePart, type PageContext, type ToolPart, type UseAttachmentsOptions, type UseAttachmentsReturn, type UseVoiceOptions, type UseVoiceReturn, type UserContext, type VoiceState, formatToolName, getContrastColor, useAttachments, useChat, useVoice };
|
|
433
|
+
export { type Attachment, type AttachmentContentType, type AttachmentPayload, type AttachmentStatus, BubbleWidget, type BubbleWidgetProps, ChatWidget, type ChatWidgetConfig, type ChatWidgetProps, type CustomBackend, type DebugTrace, type Message, type MessagePart, type PageContext, PlanCard, type PlanPart, ReasoningBlock, ToolCallBadge, type ToolPart, type UseAttachmentsOptions, type UseAttachmentsReturn, type UseChatOptions, type UseChatReturn, type UseSupportChatOptions, type UseVoiceOptions, type UseVoiceReturn, type UserContext, type VoiceState, formatToolName, getContrastColor, useAttachments, useChat, useSupportChat, useVoice };
|
package/dist/index.d.ts
CHANGED
|
@@ -66,6 +66,36 @@ interface UserContext {
|
|
|
66
66
|
pageContext?: PageContext;
|
|
67
67
|
metadata?: Record<string, unknown>;
|
|
68
68
|
}
|
|
69
|
+
/**
|
|
70
|
+
* Plug-in backend for non-AI modes (e.g. human support chat).
|
|
71
|
+
* When provided, ChatWidget/useChat skip all Wallavi AI API calls and
|
|
72
|
+
* use these values directly — same UI, different message source.
|
|
73
|
+
*/
|
|
74
|
+
interface CustomBackend {
|
|
75
|
+
messages: Message[];
|
|
76
|
+
streaming: boolean;
|
|
77
|
+
send: (text: string, attachments?: AttachmentPayload[]) => Promise<void>;
|
|
78
|
+
reset?: () => void;
|
|
79
|
+
/** Current chat mode — used to display a status indicator in the widget. */
|
|
80
|
+
mode?: "ai" | "human";
|
|
81
|
+
/** Optional action button rendered between messages and input (e.g. "Talk to a human"). */
|
|
82
|
+
footerAction?: {
|
|
83
|
+
label: string;
|
|
84
|
+
sublabel?: string;
|
|
85
|
+
icon?: "human" | "ai";
|
|
86
|
+
onClick: () => Promise<void>;
|
|
87
|
+
loading?: boolean;
|
|
88
|
+
};
|
|
89
|
+
voiceCall?: {
|
|
90
|
+
active: boolean;
|
|
91
|
+
token: string | null;
|
|
92
|
+
serverUrl: string | null;
|
|
93
|
+
start: () => Promise<void>;
|
|
94
|
+
stop: () => void;
|
|
95
|
+
loading: boolean;
|
|
96
|
+
error: string | null;
|
|
97
|
+
};
|
|
98
|
+
}
|
|
69
99
|
interface ChatWidgetConfig {
|
|
70
100
|
agentId: string;
|
|
71
101
|
workspaceId?: string;
|
|
@@ -95,6 +125,7 @@ interface ChatWidgetConfig {
|
|
|
95
125
|
*/
|
|
96
126
|
hideCloseButton?: boolean;
|
|
97
127
|
source?: string;
|
|
128
|
+
envId?: string;
|
|
98
129
|
userContext?: UserContext;
|
|
99
130
|
/** Per-session tool overrides used by Playground (not persisted) */
|
|
100
131
|
playgroundOverrides?: {
|
|
@@ -120,6 +151,10 @@ interface ChatWidgetConfig {
|
|
|
120
151
|
* Default: false.
|
|
121
152
|
*/
|
|
122
153
|
enableAttachments?: boolean;
|
|
154
|
+
/** When set, bypasses Wallavi AI and routes messages through this backend instead. */
|
|
155
|
+
customBackend?: CustomBackend;
|
|
156
|
+
/** Callback fired when a debug-trace event arrives from the pipeline. Only emitted for source="playground". */
|
|
157
|
+
onDebugTrace?: (trace: Record<string, unknown>) => void;
|
|
123
158
|
}
|
|
124
159
|
interface ChatWidgetProps extends ChatWidgetConfig {
|
|
125
160
|
className?: string;
|
|
@@ -129,6 +164,8 @@ interface ChatWidgetProps extends ChatWidgetConfig {
|
|
|
129
164
|
onExpand?: () => void;
|
|
130
165
|
/** Controls which icon the expand button shows (expand vs minimize). */
|
|
131
166
|
expanded?: boolean;
|
|
167
|
+
/** When true, removes border-radius, border, and shadow — use when ChatWidget is rendered inside an iframe whose container already provides those styles. */
|
|
168
|
+
embedded?: boolean;
|
|
132
169
|
}
|
|
133
170
|
type AttachmentContentType = "text" | "image" | "unsupported";
|
|
134
171
|
/** Wire-format DTO included in /api/chat/stream request when files are attached. */
|
|
@@ -159,7 +196,18 @@ interface Attachment {
|
|
|
159
196
|
declare function getContrastColor(hex: string): string;
|
|
160
197
|
declare function formatToolName(name: string): string;
|
|
161
198
|
|
|
162
|
-
interface BubbleWidgetProps extends ChatWidgetConfig {
|
|
199
|
+
interface BubbleWidgetProps extends Partial<ChatWidgetConfig> {
|
|
200
|
+
/**
|
|
201
|
+
* Inbox token from Wallavi Support dashboard.
|
|
202
|
+
* When provided, the widget connects to the support inbox (human agents + optional AI)
|
|
203
|
+
* instead of a direct AI agent. Mutually exclusive with agentId.
|
|
204
|
+
*/
|
|
205
|
+
inboxToken?: string;
|
|
206
|
+
/**
|
|
207
|
+
* Base URL of the Wallavi app. Only needed when using inboxToken from an external domain.
|
|
208
|
+
* @default "https://app.wallavi.com"
|
|
209
|
+
*/
|
|
210
|
+
supportApiBase?: string;
|
|
163
211
|
/** Where the bubble is anchored. Default: "bottom-right" */
|
|
164
212
|
position?: "bottom-right" | "bottom-left";
|
|
165
213
|
/** Chat panel width in px. Default: 360 */
|
|
@@ -213,14 +261,26 @@ interface BubbleWidgetProps extends ChatWidgetConfig {
|
|
|
213
261
|
* Use together with isOpen to fully control open/close from outside.
|
|
214
262
|
*/
|
|
215
263
|
onOpenChange?: (open: boolean) => void;
|
|
264
|
+
/**
|
|
265
|
+
* Label for the footer button shown while AI mode is active (prompts user to escalate).
|
|
266
|
+
* @default "Hablar con un agente"
|
|
267
|
+
*/
|
|
268
|
+
requestHumanLabel?: string;
|
|
269
|
+
/**
|
|
270
|
+
* Label for the footer button shown while a human agent is handling the chat.
|
|
271
|
+
* When omitted the button is not rendered and the user cannot return to AI.
|
|
272
|
+
* @example "Volver a chatear con la IA"
|
|
273
|
+
*/
|
|
274
|
+
returnToAiLabel?: string;
|
|
216
275
|
}
|
|
217
|
-
declare function BubbleWidget({ position: positionProp, width: widthProp, height: heightProp, expandedWidth, expandedHeight, keyboardShortcut: keyboardShortcutProp, shortcutKey, autoOpen: autoOpenProp, bubbleIconUrl: bubbleIconUrlProp, bubbleSize: bubbleSizeProp, panelClassName, autoConfig, hideBubble, isOpen: isOpenProp, onOpenChange, ...chatProps }: BubbleWidgetProps): react_jsx_runtime.JSX.Element;
|
|
276
|
+
declare function BubbleWidget({ inboxToken, supportApiBase, requestHumanLabel, returnToAiLabel, position: positionProp, width: widthProp, height: heightProp, expandedWidth, expandedHeight, keyboardShortcut: keyboardShortcutProp, shortcutKey, autoOpen: autoOpenProp, bubbleIconUrl: bubbleIconUrlProp, bubbleSize: bubbleSizeProp, panelClassName, autoConfig, hideBubble, isOpen: isOpenProp, onOpenChange, ...chatProps }: BubbleWidgetProps): react_jsx_runtime.JSX.Element;
|
|
218
277
|
|
|
219
|
-
declare function ChatWidget({ agentId, workspaceId, agentName, displayName, profilePicture, userMessageColor, initialMessages, suggestedMessages, messagePlaceholder, watermark, watermarkLogoUrl, footer, theme, showThinking, regenerateMessage, persist, onNavigate, hideCloseButton, source, userContext, playgroundOverrides, enableVoice, voiceAutoSend, enableAttachments, className, onClose, onReset, onExpand, expanded, }: ChatWidgetProps): react_jsx_runtime.JSX.Element;
|
|
278
|
+
declare function ChatWidget({ agentId, workspaceId, agentName, displayName, profilePicture, userMessageColor, initialMessages, suggestedMessages, messagePlaceholder, watermark, watermarkLogoUrl, footer, theme, showThinking, regenerateMessage, persist, onNavigate, hideCloseButton, source, userContext, playgroundOverrides, enableVoice, voiceAutoSend, enableAttachments, customBackend, className, onClose, onReset, onExpand, expanded, embedded, envId, onDebugTrace, }: ChatWidgetProps): react_jsx_runtime.JSX.Element;
|
|
220
279
|
|
|
221
280
|
interface UseChatOptions {
|
|
222
281
|
agentId: string;
|
|
223
282
|
workspaceId?: string;
|
|
283
|
+
envId?: string;
|
|
224
284
|
source?: string;
|
|
225
285
|
userContext?: UserContext;
|
|
226
286
|
persist?: boolean;
|
|
@@ -230,6 +290,7 @@ interface UseChatOptions {
|
|
|
230
290
|
mcpIds?: string[];
|
|
231
291
|
actionIds?: string[];
|
|
232
292
|
};
|
|
293
|
+
customBackend?: CustomBackend;
|
|
233
294
|
}
|
|
234
295
|
interface UseChatReturn {
|
|
235
296
|
messages: Message[];
|
|
@@ -243,8 +304,93 @@ interface UseChatReturn {
|
|
|
243
304
|
regenerate: () => Promise<void>;
|
|
244
305
|
reset: () => void;
|
|
245
306
|
selectPickerOption: (pickerId: string, paramName: string, value: string, label: string) => Promise<void>;
|
|
307
|
+
/** Pipeline debug traces — only populated when source="playground" */
|
|
308
|
+
debugTraces: DebugTrace[];
|
|
309
|
+
voiceCall?: {
|
|
310
|
+
active: boolean;
|
|
311
|
+
token: string | null;
|
|
312
|
+
serverUrl: string | null;
|
|
313
|
+
start: () => Promise<void>;
|
|
314
|
+
stop: () => void;
|
|
315
|
+
loading: boolean;
|
|
316
|
+
error: string | null;
|
|
317
|
+
};
|
|
318
|
+
}
|
|
319
|
+
/** Structured pipeline execution data emitted per-turn from the backend */
|
|
320
|
+
interface DebugTrace {
|
|
321
|
+
threadId: string;
|
|
322
|
+
agentId: string;
|
|
323
|
+
sessionId: string;
|
|
324
|
+
turn: number;
|
|
325
|
+
timestamp: number;
|
|
326
|
+
durationMs: number;
|
|
327
|
+
userMessage: string;
|
|
328
|
+
assistantResponse: string;
|
|
329
|
+
router: {
|
|
330
|
+
intent: string;
|
|
331
|
+
capability: string;
|
|
332
|
+
complexity?: string;
|
|
333
|
+
};
|
|
334
|
+
tools: {
|
|
335
|
+
available: number;
|
|
336
|
+
selected: number;
|
|
337
|
+
executed: string[];
|
|
338
|
+
targetTool?: string;
|
|
339
|
+
selectedNames?: string[];
|
|
340
|
+
};
|
|
341
|
+
params: {
|
|
342
|
+
available: Record<string, string>;
|
|
343
|
+
missing: string[];
|
|
344
|
+
};
|
|
345
|
+
provider: {
|
|
346
|
+
name: string;
|
|
347
|
+
model: string;
|
|
348
|
+
fallbackCount: number;
|
|
349
|
+
};
|
|
350
|
+
tokens: {
|
|
351
|
+
input: number;
|
|
352
|
+
output: number;
|
|
353
|
+
total: number;
|
|
354
|
+
};
|
|
355
|
+
executionStatus: string;
|
|
356
|
+
flags: string[];
|
|
357
|
+
}
|
|
358
|
+
declare function useChat({ agentId, workspaceId, envId, source, userContext, persist, onNavigate, playgroundOverrides, customBackend, }: UseChatOptions): UseChatReturn;
|
|
359
|
+
|
|
360
|
+
declare function PlanCard({ part, onSend, disabled, }: {
|
|
361
|
+
part: PlanPart;
|
|
362
|
+
onSend?: (text: string) => void;
|
|
363
|
+
disabled?: boolean;
|
|
364
|
+
}): react_jsx_runtime.JSX.Element;
|
|
365
|
+
|
|
366
|
+
declare function ToolCallBadge({ part }: {
|
|
367
|
+
part: ToolPart;
|
|
368
|
+
}): react_jsx_runtime.JSX.Element;
|
|
369
|
+
declare function ReasoningBlock({ text }: {
|
|
370
|
+
text: string;
|
|
371
|
+
}): react_jsx_runtime.JSX.Element;
|
|
372
|
+
|
|
373
|
+
interface UseSupportChatOptions {
|
|
374
|
+
/** Inbox token from Wallavi Support dashboard. */
|
|
375
|
+
inboxToken: string;
|
|
376
|
+
/**
|
|
377
|
+
* Base URL of the Wallavi app that hosts the support-chat API routes.
|
|
378
|
+
* @default "https://app.wallavi.com"
|
|
379
|
+
*/
|
|
380
|
+
apiBase?: string;
|
|
381
|
+
/**
|
|
382
|
+
* Label for the footer button shown when AI mode is active.
|
|
383
|
+
* @default "Hablar con un agente"
|
|
384
|
+
*/
|
|
385
|
+
requestHumanLabel?: string;
|
|
386
|
+
/**
|
|
387
|
+
* Label for the footer button shown when human agent mode is active.
|
|
388
|
+
* If not set, no "return to AI" button is shown.
|
|
389
|
+
* @example "Volver a chatear con la IA"
|
|
390
|
+
*/
|
|
391
|
+
returnToAiLabel?: string;
|
|
246
392
|
}
|
|
247
|
-
declare function
|
|
393
|
+
declare function useSupportChat({ inboxToken, apiBase, requestHumanLabel, returnToAiLabel, }: UseSupportChatOptions): CustomBackend;
|
|
248
394
|
|
|
249
395
|
type VoiceState = "idle" | "recording" | "transcribing" | "error";
|
|
250
396
|
interface UseVoiceOptions {
|
|
@@ -262,7 +408,7 @@ interface UseVoiceReturn {
|
|
|
262
408
|
start: () => Promise<void>;
|
|
263
409
|
stop: () => void;
|
|
264
410
|
}
|
|
265
|
-
declare function useVoice({ agentId, apiUrl, onTranscript, onError }: UseVoiceOptions): UseVoiceReturn;
|
|
411
|
+
declare function useVoice({ agentId, apiUrl, onTranscript, onError, }: UseVoiceOptions): UseVoiceReturn;
|
|
266
412
|
|
|
267
413
|
interface UseAttachmentsOptions {
|
|
268
414
|
agentId: string;
|
|
@@ -284,4 +430,4 @@ interface UseAttachmentsReturn {
|
|
|
284
430
|
}
|
|
285
431
|
declare function useAttachments({ agentId, apiUrl, maxFiles, }: UseAttachmentsOptions): UseAttachmentsReturn;
|
|
286
432
|
|
|
287
|
-
export { type Attachment, type AttachmentContentType, type AttachmentPayload, type AttachmentStatus, BubbleWidget, type BubbleWidgetProps, ChatWidget, type ChatWidgetConfig, type ChatWidgetProps, type Message, type MessagePart, type PageContext, type ToolPart, type UseAttachmentsOptions, type UseAttachmentsReturn, type UseVoiceOptions, type UseVoiceReturn, type UserContext, type VoiceState, formatToolName, getContrastColor, useAttachments, useChat, useVoice };
|
|
433
|
+
export { type Attachment, type AttachmentContentType, type AttachmentPayload, type AttachmentStatus, BubbleWidget, type BubbleWidgetProps, ChatWidget, type ChatWidgetConfig, type ChatWidgetProps, type CustomBackend, type DebugTrace, type Message, type MessagePart, type PageContext, PlanCard, type PlanPart, ReasoningBlock, ToolCallBadge, type ToolPart, type UseAttachmentsOptions, type UseAttachmentsReturn, type UseChatOptions, type UseChatReturn, type UseSupportChatOptions, type UseVoiceOptions, type UseVoiceReturn, type UserContext, type VoiceState, formatToolName, getContrastColor, useAttachments, useChat, useSupportChat, useVoice };
|