@ensembleapp/client-sdk 0.0.55 → 0.0.57

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.
@@ -0,0 +1,35 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __commonJS = (cb, mod) => function __require() {
8
+ try {
9
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
10
+ } catch (e) {
11
+ throw mod = 0, e;
12
+ }
13
+ };
14
+ var __copyProps = (to, from, except, desc) => {
15
+ if (from && typeof from === "object" || typeof from === "function") {
16
+ for (let key of __getOwnPropNames(from))
17
+ if (!__hasOwnProp.call(to, key) && key !== except)
18
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
19
+ }
20
+ return to;
21
+ };
22
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
23
+ // If the importer is in node compatibility mode or this is not an ESM
24
+ // file that has been converted to a CommonJS file using a Babel-
25
+ // compatible transform (i.e. "__esModule" has not been set), then set
26
+ // "default" to the CommonJS "module.exports" for node compatibility.
27
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
28
+ mod
29
+ ));
30
+
31
+ export {
32
+ __commonJS,
33
+ __toESM
34
+ };
35
+ //# sourceMappingURL=chunk-YLJ4XMA6.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
package/dist/index.d.ts CHANGED
@@ -86,6 +86,12 @@ interface ChatUsageData {
86
86
  * part is not a usage part.
87
87
  */
88
88
  declare function extractUsageData(dataPart: unknown): ChatUsageData | null;
89
+ /**
90
+ * Build the GET /chat/messages URL for loading initial history. Appends
91
+ * `?limit=<n>` when `messagesToLoad` is provided (a positive number), otherwise
92
+ * returns the base URL so the server default applies.
93
+ */
94
+ declare function buildMessagesUrl(baseUrl: string, messagesToLoad?: number): string;
89
95
  type UseChatConfig = DeprecatedChatConfig & {
90
96
  /** The server API configuration */
91
97
  api: ApiConfig;
@@ -97,6 +103,8 @@ type UseChatConfig = DeprecatedChatConfig & {
97
103
  agentVersion?: AgentVersion;
98
104
  /** additional context (anything) that needs to be passed to the LLM */
99
105
  dataContext?: unknown;
106
+ /** Number of most-recent messages to load into the chat on open/reload. Defaults to the server's default. */
107
+ messagesToLoad?: number;
100
108
  onError?: (error: Error) => void;
101
109
  /** Called when API returns 401/unauthorized (e.g., token expiry). Return a new token to retry the request. */
102
110
  onAuthError?: () => Promise<string | null>;
@@ -106,8 +114,9 @@ type UseChatConfig = DeprecatedChatConfig & {
106
114
  /** Called when usage data is received (token counts/percentages and message-history stats) */
107
115
  onUsage?: (usage: ChatUsageData) => void;
108
116
  };
109
- declare function useChat({ api, threadId, agentId, agentVersion, agentExecutionId, dataContext, onError, onAuthError, onFinish, onData, onMessage, onUsage, }: UseChatConfig): {
117
+ declare function useChat({ api, threadId, agentId, agentVersion, agentExecutionId, dataContext, messagesToLoad, onError, onAuthError, onFinish, onData, onMessage, onUsage, }: UseChatConfig): {
110
118
  messages: ChatMessage[];
119
+ rawMessages: UIMessage<unknown, ai.UIDataTypes, ai.UITools>[];
111
120
  status: ai.ChatStatus;
112
121
  isLoadingInitial: boolean;
113
122
  canSendMessage: boolean;
@@ -341,6 +350,11 @@ declare const createWidget: <TEnriched extends EnrichedResults = EnrichedResults
341
350
  render(payload: any, enriched: TEnriched, options: WidgetRenderOptions): unknown;
342
351
  }) => UIWidgetDefinition<FlexibleSchema, TEnriched>;
343
352
 
353
+ interface RealtimeVoiceOptions {
354
+ enabled?: boolean;
355
+ avatar?: boolean;
356
+ }
357
+
344
358
  type DisplayMode = 'full' | 'brief' | 'hide-tools';
345
359
 
346
360
  interface ChatWidgetStyles {
@@ -427,6 +441,8 @@ interface ChatWidgetConfig extends UseChatConfig {
427
441
  className?: string;
428
442
  styles?: ChatWidgetStyles;
429
443
  voice?: ChatWidgetVoiceOptions;
444
+ /** Opt-in LiveKit/ElevenLabs calls; prepared Tavus avatar is optional. */
445
+ realtimeVoice?: RealtimeVoiceOptions;
430
446
  speechToText?: ChatWidgetSpeechToTextOptions;
431
447
  widgets?: AnyUIWidgetDefinition[];
432
448
  /** Feedback options for assistant messages. Enabled by default. */
@@ -661,4 +677,4 @@ declare const getVendorCardsWidget: (isProd?: boolean) => SDKUIWidgetDefinition[
661
677
 
662
678
  declare function cn(...inputs: ClassValue[]): string;
663
679
 
664
- export { type AgentVersion, type AnyUIWidgetDefinition, type ApiConfig, type ApprovalUIConfig, BriefDisplayMode, BriefDisplayMode as BriefRenderer, type ChatMessage, type ChatMessageSection, type ChatUsageData, ChatWidget, type ChatWidgetFeedbackOptions, type ChatWidgetHandle, type ChatWidgetConfig as ChatWidgetProps, type ChatWidgetSpeechToTextOptions, type ChatWidgetStyles, type ChatWidgetVoiceOptions, type CustomerReactDOM, type DisplayMode, type DisplayModeProps, type EmbeddableChatWidgetConfig, type EnrichedResults, type FeedbackConfig, type FeedbackHandlers, type FetchApprovalConfigOptions, FullDisplayMode, FullDisplayMode as FullRenderer, HideToolsDisplayMode, HideToolsDisplayMode as HideToolsRenderer, type InvokeTool, type MessageContext, MessageRenderer, type MessageRendererProps, type PendingToolApproval, type PendingToolOutput, type PopupAnchorConfig, PopupChatWidget, type PopupChatWidgetProps, type DisplayModeProps as RendererProps, type SDKUIWidgetDefinition, SDK_WIDGET_MARKER, type StructuredMessagePayload, type SubmitFeedbackParams, TagGroupDisplay, type TagGroupDisplayProps, ToolCallDisplay, type ToolCallDisplayProps, type ToolInvokeRequest, type ToolInvokeResult, type ToolPart, type UIMessagePart, type UIWidgetDefinition, type UseChatConfig, type UseFeedbackConfig, type WidgetRenderOptions, cn, createSDKWidget, createWidget, defaultChatWidgets, extractUsageData, fetchApprovalConfig, getVendorCardsWidget, isSDKWidget, registerChatWidgets, transformMessage, useChat, useFeedback };
680
+ export { type AgentVersion, type AnyUIWidgetDefinition, type ApiConfig, type ApprovalUIConfig, BriefDisplayMode, BriefDisplayMode as BriefRenderer, type ChatMessage, type ChatMessageSection, type ChatUsageData, ChatWidget, type ChatWidgetFeedbackOptions, type ChatWidgetHandle, type ChatWidgetConfig as ChatWidgetProps, type ChatWidgetSpeechToTextOptions, type ChatWidgetStyles, type ChatWidgetVoiceOptions, type CustomerReactDOM, type DisplayMode, type DisplayModeProps, type EmbeddableChatWidgetConfig, type EnrichedResults, type FeedbackConfig, type FeedbackHandlers, type FetchApprovalConfigOptions, FullDisplayMode, FullDisplayMode as FullRenderer, HideToolsDisplayMode, HideToolsDisplayMode as HideToolsRenderer, type InvokeTool, type MessageContext, MessageRenderer, type MessageRendererProps, type PendingToolApproval, type PendingToolOutput, type PopupAnchorConfig, PopupChatWidget, type PopupChatWidgetProps, type RealtimeVoiceOptions, type DisplayModeProps as RendererProps, type SDKUIWidgetDefinition, SDK_WIDGET_MARKER, type StructuredMessagePayload, type SubmitFeedbackParams, TagGroupDisplay, type TagGroupDisplayProps, ToolCallDisplay, type ToolCallDisplayProps, type ToolInvokeRequest, type ToolInvokeResult, type ToolPart, type UIMessagePart, type UIWidgetDefinition, type UseChatConfig, type UseFeedbackConfig, type WidgetRenderOptions, buildMessagesUrl, cn, createSDKWidget, createWidget, defaultChatWidgets, extractUsageData, fetchApprovalConfig, getVendorCardsWidget, isSDKWidget, registerChatWidgets, transformMessage, useChat, useFeedback };