@ensembleapp/client-sdk 0.0.11 → 0.0.13
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 +55 -3
- package/dist/index.js +4 -1
- package/dist/index.js.map +1 -1
- package/dist/widget/widget.global.js +2 -2
- package/dist/widget/widget.global.js.map +1 -1
- 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/dist/index.js
CHANGED
|
@@ -18751,7 +18751,7 @@ function useChat({
|
|
|
18751
18751
|
} else if (part.type === "data-ui") {
|
|
18752
18752
|
part.data.forEach((widget) => addContent(widget));
|
|
18753
18753
|
} else if (part.type === "data-thoughts") {
|
|
18754
|
-
const thoughtOutputs = part.data.map((t) => t.output);
|
|
18754
|
+
const thoughtOutputs = part.data.map((t) => t.output).filter((output) => output != null);
|
|
18755
18755
|
thoughts.push(...thoughtOutputs);
|
|
18756
18756
|
} else if (part.type === "data-transfer") {
|
|
18757
18757
|
} else if (part.type === "step-start") {
|
|
@@ -24251,6 +24251,9 @@ function MessageItemComponent({
|
|
|
24251
24251
|
onFeedbackSubmit
|
|
24252
24252
|
}) {
|
|
24253
24253
|
const renderContentItem = (item, key) => {
|
|
24254
|
+
if (item == null) {
|
|
24255
|
+
return null;
|
|
24256
|
+
}
|
|
24254
24257
|
if (typeof item === "string") {
|
|
24255
24258
|
return /* @__PURE__ */ jsx5("div", { className: "chat-widget__markdown", children: /* @__PURE__ */ jsx5(FormattedMarkdown, { children: item }) }, key);
|
|
24256
24259
|
}
|