@wallavi/widget 1.12.7 → 1.13.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 CHANGED
@@ -53,15 +53,37 @@ interface ContextEntity {
53
53
  name: string;
54
54
  }
55
55
  /** RAG topic summary surfaced in the Command Center sidebar. */
56
+ /**
57
+ * Keywords of a topic or document: a plain list, or a list per language.
58
+ * Mirrors RagKeywords in @wallavi/protocol (checked in protocol-compat.ts).
59
+ */
60
+ type RagKeywords = string[] | Record<string, string[]>;
61
+ /** RAG topic surfaced in the Command Center sidebar. */
56
62
  interface RagTopicInfo {
57
63
  name: string;
58
64
  summary: string | null;
65
+ keywords?: RagKeywords | null;
59
66
  }
60
67
  /** RAG document summary surfaced in the Command Center sidebar. */
61
68
  interface RagDocumentInfo {
62
69
  name: string;
63
70
  summary: string | null;
64
71
  url: string | null;
72
+ keywords?: RagKeywords | null;
73
+ }
74
+ /**
75
+ * A client-side interface the agent can run. The public widget types are
76
+ * self-contained because the published .d.ts cannot import a private package;
77
+ * protocol-compat.ts makes the compiler fail if they drift from
78
+ * PublicClientAction in @wallavi/protocol.
79
+ */
80
+ interface WidgetClientAction {
81
+ name: string;
82
+ description: string;
83
+ /** Declarative browser steps; each has at least its action name. */
84
+ steps: Array<{
85
+ action: string;
86
+ }>;
65
87
  }
66
88
  interface PageContext {
67
89
  /** Current URL or path (e.g. "/dashboard/agent/abc/agent-studio") */
@@ -73,8 +95,14 @@ interface PageContext {
73
95
  /** Any custom key-value pairs the developer wants the agent to know about */
74
96
  vars?: Record<string, unknown>;
75
97
  }
98
+ /**
99
+ * Headers the host wants forwarded to tools with `authType: forwarded`. Pass a
100
+ * function when they carry a short-lived token: it is called before every
101
+ * message, e.g. `async () => ({ Authorization: `Bearer ${await getToken()}` })`.
102
+ */
103
+ type UserHeaders = Record<string, string> | (() => Record<string, string> | Promise<Record<string, string>>);
76
104
  interface UserContext {
77
- headers?: Record<string, string>;
105
+ headers?: UserHeaders;
78
106
  userId?: string;
79
107
  userName?: string;
80
108
  userEmail?: string;
@@ -114,6 +142,12 @@ interface CustomBackend {
114
142
  }
115
143
  interface ChatWidgetConfig {
116
144
  agentId: string;
145
+ /**
146
+ * Origin of the Wallavi API (e.g. "https://api.wallavi.com"). Defaults to
147
+ * NEXT_PUBLIC_API_URL, then Wallavi production. Hosts whose API origin is
148
+ * decided at runtime pass it here.
149
+ */
150
+ apiUrl?: string;
117
151
  workspaceId?: string;
118
152
  agentName: string;
119
153
  displayName?: string | null;
@@ -132,7 +166,7 @@ interface ChatWidgetConfig {
132
166
  showRagDocuments?: boolean;
133
167
  showQuickActions?: boolean;
134
168
  locale?: "en" | "es" | null;
135
- clientActions?: any[];
169
+ clientActions?: WidgetClientAction[];
136
170
  /** RAG topics from the agent's knowledge base — used in Command Center */
137
171
  ragTopics?: RagTopicInfo[];
138
172
  /** RAG documents from the agent's knowledge base — used in Command Center */
@@ -302,7 +336,7 @@ interface BubbleWidgetProps extends Partial<ChatWidgetConfig> {
302
336
  }
303
337
  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;
304
338
 
305
- 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, widgetLayout, showCommandPanel, showRagTopics, showRagDocuments, showQuickActions, locale, clientActions, ragTopics, ragDocuments, }: ChatWidgetProps): react_jsx_runtime.JSX.Element;
339
+ declare function ChatWidget({ agentId, apiUrl, 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, widgetLayout, showCommandPanel, showRagTopics, showRagDocuments, showQuickActions, locale, clientActions, ragTopics, ragDocuments, }: ChatWidgetProps): react_jsx_runtime.JSX.Element;
306
340
 
307
341
  declare function IconTarget({ className }: {
308
342
  className?: string;
@@ -318,7 +352,7 @@ interface CommandPanelProps {
318
352
  pageParams?: Record<string, string>;
319
353
  pageVars?: Record<string, unknown>;
320
354
  metadata?: Record<string, unknown>;
321
- clientActions?: any[];
355
+ clientActions?: WidgetClientAction[];
322
356
  ragTopics?: RagTopicInfo[];
323
357
  ragDocuments?: RagDocumentInfo[];
324
358
  onSend: (text: string) => void;
@@ -334,6 +368,8 @@ declare function CommandPanel({ mode, pageUrl, pageTitle, pageParams, pageVars,
334
368
 
335
369
  interface UseChatOptions {
336
370
  agentId: string;
371
+ /** Overrides NEXT_PUBLIC_API_URL for every chat request. */
372
+ apiUrl?: string;
337
373
  workspaceId?: string;
338
374
  envId?: string;
339
375
  source?: string;
@@ -346,6 +382,12 @@ interface UseChatOptions {
346
382
  actionIds?: string[];
347
383
  };
348
384
  customBackend?: CustomBackend;
385
+ copilotColor?: string;
386
+ /**
387
+ * Page context for a request when the host passes none in `userContext`.
388
+ * Called at send time so client-side navigation is reflected.
389
+ */
390
+ resolvePageContext?: () => PageContext | undefined;
349
391
  }
350
392
  interface UseChatReturn {
351
393
  messages: Message[];
@@ -412,7 +454,7 @@ interface DebugTrace {
412
454
  executionStatus: string;
413
455
  flags: string[];
414
456
  }
415
- declare function useChat({ agentId, workspaceId, envId, source, userContext, persist, onNavigate, playgroundOverrides, customBackend, }: UseChatOptions): UseChatReturn;
457
+ declare function useChat({ agentId, apiUrl, workspaceId, envId, source, userContext, persist, onNavigate, playgroundOverrides, customBackend, copilotColor, resolvePageContext, }: UseChatOptions): UseChatReturn;
416
458
 
417
459
  declare function PlanCard({ part, onSend, disabled, locale, }: {
418
460
  part: PlanPart;
@@ -491,4 +533,4 @@ interface UseAttachmentsReturn {
491
533
  }
492
534
  declare function useAttachments({ agentId, apiUrl, maxFiles, }: UseAttachmentsOptions): UseAttachmentsReturn;
493
535
 
494
- export { type Attachment, type AttachmentContentType, type AttachmentPayload, type AttachmentStatus, BubbleWidget, type BubbleWidgetProps, ChatWidget, type ChatWidgetConfig, type ChatWidgetProps, CommandPanel, type CustomBackend, type DebugTrace, IconTarget, LiveDot, type Message, type MessagePart, type PageContext, PlanCard, type PlanPart, type RagDocumentInfo, type RagTopicInfo, 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 };
536
+ export { type Attachment, type AttachmentContentType, type AttachmentPayload, type AttachmentStatus, BubbleWidget, type BubbleWidgetProps, ChatWidget, type ChatWidgetConfig, type ChatWidgetProps, CommandPanel, type CustomBackend, type DebugTrace, IconTarget, LiveDot, type Message, type MessagePart, type PageContext, PlanCard, type PlanPart, type RagDocumentInfo, type RagTopicInfo, ReasoningBlock, ToolCallBadge, type ToolPart, type UseAttachmentsOptions, type UseAttachmentsReturn, type UseChatOptions, type UseChatReturn, type UseSupportChatOptions, type UseVoiceOptions, type UseVoiceReturn, type UserContext, type UserHeaders, type VoiceState, formatToolName, getContrastColor, useAttachments, useChat, useSupportChat, useVoice };
package/dist/index.d.ts CHANGED
@@ -53,15 +53,37 @@ interface ContextEntity {
53
53
  name: string;
54
54
  }
55
55
  /** RAG topic summary surfaced in the Command Center sidebar. */
56
+ /**
57
+ * Keywords of a topic or document: a plain list, or a list per language.
58
+ * Mirrors RagKeywords in @wallavi/protocol (checked in protocol-compat.ts).
59
+ */
60
+ type RagKeywords = string[] | Record<string, string[]>;
61
+ /** RAG topic surfaced in the Command Center sidebar. */
56
62
  interface RagTopicInfo {
57
63
  name: string;
58
64
  summary: string | null;
65
+ keywords?: RagKeywords | null;
59
66
  }
60
67
  /** RAG document summary surfaced in the Command Center sidebar. */
61
68
  interface RagDocumentInfo {
62
69
  name: string;
63
70
  summary: string | null;
64
71
  url: string | null;
72
+ keywords?: RagKeywords | null;
73
+ }
74
+ /**
75
+ * A client-side interface the agent can run. The public widget types are
76
+ * self-contained because the published .d.ts cannot import a private package;
77
+ * protocol-compat.ts makes the compiler fail if they drift from
78
+ * PublicClientAction in @wallavi/protocol.
79
+ */
80
+ interface WidgetClientAction {
81
+ name: string;
82
+ description: string;
83
+ /** Declarative browser steps; each has at least its action name. */
84
+ steps: Array<{
85
+ action: string;
86
+ }>;
65
87
  }
66
88
  interface PageContext {
67
89
  /** Current URL or path (e.g. "/dashboard/agent/abc/agent-studio") */
@@ -73,8 +95,14 @@ interface PageContext {
73
95
  /** Any custom key-value pairs the developer wants the agent to know about */
74
96
  vars?: Record<string, unknown>;
75
97
  }
98
+ /**
99
+ * Headers the host wants forwarded to tools with `authType: forwarded`. Pass a
100
+ * function when they carry a short-lived token: it is called before every
101
+ * message, e.g. `async () => ({ Authorization: `Bearer ${await getToken()}` })`.
102
+ */
103
+ type UserHeaders = Record<string, string> | (() => Record<string, string> | Promise<Record<string, string>>);
76
104
  interface UserContext {
77
- headers?: Record<string, string>;
105
+ headers?: UserHeaders;
78
106
  userId?: string;
79
107
  userName?: string;
80
108
  userEmail?: string;
@@ -114,6 +142,12 @@ interface CustomBackend {
114
142
  }
115
143
  interface ChatWidgetConfig {
116
144
  agentId: string;
145
+ /**
146
+ * Origin of the Wallavi API (e.g. "https://api.wallavi.com"). Defaults to
147
+ * NEXT_PUBLIC_API_URL, then Wallavi production. Hosts whose API origin is
148
+ * decided at runtime pass it here.
149
+ */
150
+ apiUrl?: string;
117
151
  workspaceId?: string;
118
152
  agentName: string;
119
153
  displayName?: string | null;
@@ -132,7 +166,7 @@ interface ChatWidgetConfig {
132
166
  showRagDocuments?: boolean;
133
167
  showQuickActions?: boolean;
134
168
  locale?: "en" | "es" | null;
135
- clientActions?: any[];
169
+ clientActions?: WidgetClientAction[];
136
170
  /** RAG topics from the agent's knowledge base — used in Command Center */
137
171
  ragTopics?: RagTopicInfo[];
138
172
  /** RAG documents from the agent's knowledge base — used in Command Center */
@@ -302,7 +336,7 @@ interface BubbleWidgetProps extends Partial<ChatWidgetConfig> {
302
336
  }
303
337
  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;
304
338
 
305
- 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, widgetLayout, showCommandPanel, showRagTopics, showRagDocuments, showQuickActions, locale, clientActions, ragTopics, ragDocuments, }: ChatWidgetProps): react_jsx_runtime.JSX.Element;
339
+ declare function ChatWidget({ agentId, apiUrl, 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, widgetLayout, showCommandPanel, showRagTopics, showRagDocuments, showQuickActions, locale, clientActions, ragTopics, ragDocuments, }: ChatWidgetProps): react_jsx_runtime.JSX.Element;
306
340
 
307
341
  declare function IconTarget({ className }: {
308
342
  className?: string;
@@ -318,7 +352,7 @@ interface CommandPanelProps {
318
352
  pageParams?: Record<string, string>;
319
353
  pageVars?: Record<string, unknown>;
320
354
  metadata?: Record<string, unknown>;
321
- clientActions?: any[];
355
+ clientActions?: WidgetClientAction[];
322
356
  ragTopics?: RagTopicInfo[];
323
357
  ragDocuments?: RagDocumentInfo[];
324
358
  onSend: (text: string) => void;
@@ -334,6 +368,8 @@ declare function CommandPanel({ mode, pageUrl, pageTitle, pageParams, pageVars,
334
368
 
335
369
  interface UseChatOptions {
336
370
  agentId: string;
371
+ /** Overrides NEXT_PUBLIC_API_URL for every chat request. */
372
+ apiUrl?: string;
337
373
  workspaceId?: string;
338
374
  envId?: string;
339
375
  source?: string;
@@ -346,6 +382,12 @@ interface UseChatOptions {
346
382
  actionIds?: string[];
347
383
  };
348
384
  customBackend?: CustomBackend;
385
+ copilotColor?: string;
386
+ /**
387
+ * Page context for a request when the host passes none in `userContext`.
388
+ * Called at send time so client-side navigation is reflected.
389
+ */
390
+ resolvePageContext?: () => PageContext | undefined;
349
391
  }
350
392
  interface UseChatReturn {
351
393
  messages: Message[];
@@ -412,7 +454,7 @@ interface DebugTrace {
412
454
  executionStatus: string;
413
455
  flags: string[];
414
456
  }
415
- declare function useChat({ agentId, workspaceId, envId, source, userContext, persist, onNavigate, playgroundOverrides, customBackend, }: UseChatOptions): UseChatReturn;
457
+ declare function useChat({ agentId, apiUrl, workspaceId, envId, source, userContext, persist, onNavigate, playgroundOverrides, customBackend, copilotColor, resolvePageContext, }: UseChatOptions): UseChatReturn;
416
458
 
417
459
  declare function PlanCard({ part, onSend, disabled, locale, }: {
418
460
  part: PlanPart;
@@ -491,4 +533,4 @@ interface UseAttachmentsReturn {
491
533
  }
492
534
  declare function useAttachments({ agentId, apiUrl, maxFiles, }: UseAttachmentsOptions): UseAttachmentsReturn;
493
535
 
494
- export { type Attachment, type AttachmentContentType, type AttachmentPayload, type AttachmentStatus, BubbleWidget, type BubbleWidgetProps, ChatWidget, type ChatWidgetConfig, type ChatWidgetProps, CommandPanel, type CustomBackend, type DebugTrace, IconTarget, LiveDot, type Message, type MessagePart, type PageContext, PlanCard, type PlanPart, type RagDocumentInfo, type RagTopicInfo, 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 };
536
+ export { type Attachment, type AttachmentContentType, type AttachmentPayload, type AttachmentStatus, BubbleWidget, type BubbleWidgetProps, ChatWidget, type ChatWidgetConfig, type ChatWidgetProps, CommandPanel, type CustomBackend, type DebugTrace, IconTarget, LiveDot, type Message, type MessagePart, type PageContext, PlanCard, type PlanPart, type RagDocumentInfo, type RagTopicInfo, ReasoningBlock, ToolCallBadge, type ToolPart, type UseAttachmentsOptions, type UseAttachmentsReturn, type UseChatOptions, type UseChatReturn, type UseSupportChatOptions, type UseVoiceOptions, type UseVoiceReturn, type UserContext, type UserHeaders, type VoiceState, formatToolName, getContrastColor, useAttachments, useChat, useSupportChat, useVoice };