@ensembleapp/client-sdk 0.0.11 → 0.0.12

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.
Files changed (2) hide show
  1. package/dist/index.d.ts +55 -3
  2. package/package.json +1 -2
package/dist/index.d.ts CHANGED
@@ -1,12 +1,64 @@
1
1
  import * as ai from 'ai';
2
2
  import { UIMessage } from 'ai';
3
- import { UIWidget, WidgetEnrichConfig } from '@repo/agent-sdk/schemas';
4
- export { WidgetEnrichConfig } from '@repo/agent-sdk/schemas';
5
3
  import * as react_jsx_runtime from 'react/jsx-runtime';
6
4
  import React$1, { ReactNode } from 'react';
7
5
  import z, { AnyZodObject } from 'zod';
8
6
  import { ClassValue } from 'clsx';
9
7
 
8
+ /**
9
+ * Version selector for tools. This should mirror VersionSelector on server-side
10
+ * - 'latest': prefer draft (v0), fallback to last published
11
+ * - 'published': prefer last published, fallback to draft
12
+ * - number: specific version (1+)
13
+ */
14
+ type VersionSelector = 'latest' | 'published' | number;
15
+ /**
16
+ * Configuration for enriching widget data server-side by calling a tool.
17
+ * Uses JEXL expressions to build tool inputs from the widget payload.
18
+ */
19
+ type WidgetEnrichConfig = {
20
+ /** Tool ID to call for enrichment */
21
+ toolId: string;
22
+ /**
23
+ * Tool version selector. Defaults to 'latest'.
24
+ * - 'latest': prefer draft, fallback to published
25
+ * - 'published': prefer published, fallback to draft
26
+ * - number: specific version (1+)
27
+ */
28
+ version?: VersionSelector;
29
+ /**
30
+ * Maps tool input names to JEXL expressions.
31
+ * Expressions are evaluated with $ as the payload root (auto-normalized).
32
+ * Use ${...} syntax for JEXL expressions, or literal values.
33
+ *
34
+ * Examples:
35
+ * - "${vendors|map('id')|join(',')}" → "v1,v2,v3"
36
+ * - "${limit}" → 10
37
+ * - "static value" → "static value"
38
+ *
39
+ * If omitted, the entire payload is passed as tool input.
40
+ */
41
+ inputs?: Record<string, unknown>;
42
+ };
43
+ /** Enrichment result containing the full tool response. TThis should mirror ToolResult on server-side. */
44
+ type EnrichmentResult$1 = {
45
+ success: boolean;
46
+ error?: {
47
+ message: string;
48
+ code?: string;
49
+ };
50
+ data?: unknown;
51
+ metadata?: Record<string, unknown>;
52
+ };
53
+ /** Widget output shape sent to the client */
54
+ type UIWidget = {
55
+ widgetType: string;
56
+ /** LLM-generated data based on the widget schema specified by the client */
57
+ payload: unknown;
58
+ /** Server-injected enrichment result from tool call. This mirror ToolResult on server-side. */
59
+ enrichedResult?: EnrichmentResult$1;
60
+ };
61
+
10
62
  type DeprecatedChatConfig = {
11
63
  /** @deprecated use agentId instead */
12
64
  agentExecutionId?: string;
@@ -301,4 +353,4 @@ declare const defaultChatWidgets: UIWidgetDefinition[];
301
353
 
302
354
  declare function cn(...inputs: ClassValue[]): string;
303
355
 
304
- 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 EnrichmentResult, 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, type WidgetRenderProps, cn, createChatWidget, createWidget, defaultChatWidgets, registerChatWidgets, useChat, useFeedback };
356
+ 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 EnrichmentResult, 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, type WidgetEnrichConfig, type WidgetRenderProps, cn, createChatWidget, createWidget, defaultChatWidgets, registerChatWidgets, useChat, useFeedback };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ensembleapp/client-sdk",
3
- "version": "0.0.11",
3
+ "version": "0.0.12",
4
4
  "description": "React client SDK for chat functionality",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -37,7 +37,6 @@
37
37
  "react-dom": ">=18.0.0"
38
38
  },
39
39
  "dependencies": {
40
- "@repo/agent-sdk": "*",
41
40
  "@ai-sdk/react": "^3.0.41",
42
41
  "camelcase-css": "^2.0.1",
43
42
  "clsx": "^2.1.1",