@aigentyc/chat-sdk 0.1.0
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/LICENSE +21 -0
- package/README.md +156 -0
- package/dist/JsonRenderResult-Ftw4AKwb.d.cts +18 -0
- package/dist/JsonRenderResult-Ftw4AKwb.d.ts +18 -0
- package/dist/JsonRenderResult-GQOYPLVH.cjs +15 -0
- package/dist/JsonRenderResult-GQOYPLVH.cjs.map +1 -0
- package/dist/JsonRenderResult-ZFJ6VWMS.js +6 -0
- package/dist/JsonRenderResult-ZFJ6VWMS.js.map +1 -0
- package/dist/SlotsContext-CBtt36al.d.ts +148 -0
- package/dist/SlotsContext-CHvISDJT.d.cts +148 -0
- package/dist/VisualizationRenderer-FNFYNN66.js +5 -0
- package/dist/VisualizationRenderer-FNFYNN66.js.map +1 -0
- package/dist/VisualizationRenderer-VKMZXRUX.cjs +20 -0
- package/dist/VisualizationRenderer-VKMZXRUX.cjs.map +1 -0
- package/dist/ai-elements.cjs +4608 -0
- package/dist/ai-elements.cjs.map +1 -0
- package/dist/ai-elements.d.cts +897 -0
- package/dist/ai-elements.d.ts +897 -0
- package/dist/ai-elements.js +4363 -0
- package/dist/ai-elements.js.map +1 -0
- package/dist/chunk-3MP2EGEJ.cjs +270 -0
- package/dist/chunk-3MP2EGEJ.cjs.map +1 -0
- package/dist/chunk-3RW7O444.js +26 -0
- package/dist/chunk-3RW7O444.js.map +1 -0
- package/dist/chunk-42ARGQXE.js +51 -0
- package/dist/chunk-42ARGQXE.js.map +1 -0
- package/dist/chunk-4FBVV64J.js +257 -0
- package/dist/chunk-4FBVV64J.js.map +1 -0
- package/dist/chunk-4QT25AXI.js +21 -0
- package/dist/chunk-4QT25AXI.js.map +1 -0
- package/dist/chunk-525KS5HM.cjs +30 -0
- package/dist/chunk-525KS5HM.cjs.map +1 -0
- package/dist/chunk-5F3O3ZJH.js +299 -0
- package/dist/chunk-5F3O3ZJH.js.map +1 -0
- package/dist/chunk-5QSXB6UL.cjs +259 -0
- package/dist/chunk-5QSXB6UL.cjs.map +1 -0
- package/dist/chunk-5T4FJ2SR.js +664 -0
- package/dist/chunk-5T4FJ2SR.js.map +1 -0
- package/dist/chunk-7BNYTOTE.cjs +67 -0
- package/dist/chunk-7BNYTOTE.cjs.map +1 -0
- package/dist/chunk-AWAJOSFP.cjs +96 -0
- package/dist/chunk-AWAJOSFP.cjs.map +1 -0
- package/dist/chunk-BKDV2H6Z.js +224 -0
- package/dist/chunk-BKDV2H6Z.js.map +1 -0
- package/dist/chunk-FQN6OBGN.cjs +171 -0
- package/dist/chunk-FQN6OBGN.cjs.map +1 -0
- package/dist/chunk-FYPJSHCL.js +190 -0
- package/dist/chunk-FYPJSHCL.js.map +1 -0
- package/dist/chunk-J2H6MLQF.cjs +680 -0
- package/dist/chunk-J2H6MLQF.cjs.map +1 -0
- package/dist/chunk-J2K7EJYP.cjs +198 -0
- package/dist/chunk-J2K7EJYP.cjs.map +1 -0
- package/dist/chunk-JI5KCSOI.cjs +23 -0
- package/dist/chunk-JI5KCSOI.cjs.map +1 -0
- package/dist/chunk-JOO6C3XT.cjs +44 -0
- package/dist/chunk-JOO6C3XT.cjs.map +1 -0
- package/dist/chunk-KBGPBUTI.cjs +78 -0
- package/dist/chunk-KBGPBUTI.cjs.map +1 -0
- package/dist/chunk-MT2AMINB.js +75 -0
- package/dist/chunk-MT2AMINB.js.map +1 -0
- package/dist/chunk-MZQKGNWF.js +4 -0
- package/dist/chunk-MZQKGNWF.js.map +1 -0
- package/dist/chunk-NG7OTWXQ.cjs +226 -0
- package/dist/chunk-NG7OTWXQ.cjs.map +1 -0
- package/dist/chunk-NPJKLYLV.js +68 -0
- package/dist/chunk-NPJKLYLV.js.map +1 -0
- package/dist/chunk-NW2ESHRV.js +685 -0
- package/dist/chunk-NW2ESHRV.js.map +1 -0
- package/dist/chunk-NWF735F5.js +1631 -0
- package/dist/chunk-NWF735F5.js.map +1 -0
- package/dist/chunk-NYQSM3EB.cjs +305 -0
- package/dist/chunk-NYQSM3EB.cjs.map +1 -0
- package/dist/chunk-OU7OROOE.cjs +1643 -0
- package/dist/chunk-OU7OROOE.cjs.map +1 -0
- package/dist/chunk-PS3U7T37.js +42 -0
- package/dist/chunk-PS3U7T37.js.map +1 -0
- package/dist/chunk-Q7T3VAJV.cjs +687 -0
- package/dist/chunk-Q7T3VAJV.cjs.map +1 -0
- package/dist/chunk-QYCEHFAB.js +265 -0
- package/dist/chunk-QYCEHFAB.js.map +1 -0
- package/dist/chunk-RPDJXB3U.js +676 -0
- package/dist/chunk-RPDJXB3U.js.map +1 -0
- package/dist/chunk-UKEL7FWS.js +64 -0
- package/dist/chunk-UKEL7FWS.js.map +1 -0
- package/dist/chunk-VS3NZ7FX.js +164 -0
- package/dist/chunk-VS3NZ7FX.js.map +1 -0
- package/dist/chunk-WZLWAVSS.cjs +73 -0
- package/dist/chunk-WZLWAVSS.cjs.map +1 -0
- package/dist/chunk-X5YEOOPK.cjs +758 -0
- package/dist/chunk-X5YEOOPK.cjs.map +1 -0
- package/dist/chunk-X7R334SB.cjs +5 -0
- package/dist/chunk-X7R334SB.cjs.map +1 -0
- package/dist/chunk-XXNDL5SJ.cjs +432 -0
- package/dist/chunk-XXNDL5SJ.cjs.map +1 -0
- package/dist/chunk-YQELMJW5.js +429 -0
- package/dist/chunk-YQELMJW5.js.map +1 -0
- package/dist/components.cjs +551 -0
- package/dist/components.cjs.map +1 -0
- package/dist/components.d.cts +181 -0
- package/dist/components.d.ts +181 -0
- package/dist/components.js +483 -0
- package/dist/components.js.map +1 -0
- package/dist/core.cjs +283 -0
- package/dist/core.cjs.map +1 -0
- package/dist/core.d.cts +455 -0
- package/dist/core.d.ts +455 -0
- package/dist/core.js +241 -0
- package/dist/core.js.map +1 -0
- package/dist/hooks.cjs +324 -0
- package/dist/hooks.cjs.map +1 -0
- package/dist/hooks.d.cts +163 -0
- package/dist/hooks.d.ts +163 -0
- package/dist/hooks.js +277 -0
- package/dist/hooks.js.map +1 -0
- package/dist/i18n.cjs +26 -0
- package/dist/i18n.cjs.map +1 -0
- package/dist/i18n.d.cts +50 -0
- package/dist/i18n.d.ts +50 -0
- package/dist/i18n.js +5 -0
- package/dist/i18n.js.map +1 -0
- package/dist/index.cjs +466 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +80 -0
- package/dist/index.d.ts +80 -0
- package/dist/index.js +438 -0
- package/dist/index.js.map +1 -0
- package/dist/interaction-tracker-D9P1Oq4j.d.cts +83 -0
- package/dist/interaction-tracker-D9P1Oq4j.d.ts +83 -0
- package/dist/json-render.cjs +23 -0
- package/dist/json-render.cjs.map +1 -0
- package/dist/json-render.d.cts +857 -0
- package/dist/json-render.d.ts +857 -0
- package/dist/json-render.js +6 -0
- package/dist/json-render.js.map +1 -0
- package/dist/live-chat-transport-4XLOIPOE.js +4 -0
- package/dist/live-chat-transport-4XLOIPOE.js.map +1 -0
- package/dist/live-chat-transport-ALVRGWX7.cjs +13 -0
- package/dist/live-chat-transport-ALVRGWX7.cjs.map +1 -0
- package/dist/select-B4l9yoyn.d.cts +99 -0
- package/dist/select-B4l9yoyn.d.ts +99 -0
- package/dist/styles.css +2 -0
- package/dist/theme.cjs +18 -0
- package/dist/theme.cjs.map +1 -0
- package/dist/theme.d.cts +55 -0
- package/dist/theme.d.ts +55 -0
- package/dist/theme.js +5 -0
- package/dist/theme.js.map +1 -0
- package/dist/tools.cjs +32 -0
- package/dist/tools.cjs.map +1 -0
- package/dist/tools.d.cts +117 -0
- package/dist/tools.d.ts +117 -0
- package/dist/tools.js +11 -0
- package/dist/tools.js.map +1 -0
- package/dist/types-DKJ_-nbG.d.cts +349 -0
- package/dist/types-DKJ_-nbG.d.ts +349 -0
- package/dist/ui.cjs +667 -0
- package/dist/ui.cjs.map +1 -0
- package/dist/ui.d.cts +95 -0
- package/dist/ui.d.ts +95 -0
- package/dist/ui.js +414 -0
- package/dist/ui.js.map +1 -0
- package/package.json +255 -0
package/dist/theme.d.cts
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
export { T as ThemeConfig } from './types-DKJ_-nbG.cjs';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Theme configuration for the chat widget.
|
|
7
|
+
*/
|
|
8
|
+
interface ThemeConfig {
|
|
9
|
+
primaryColor?: string;
|
|
10
|
+
accentColor?: string;
|
|
11
|
+
backgroundColor?: string;
|
|
12
|
+
textColor?: string;
|
|
13
|
+
linkColor?: string;
|
|
14
|
+
loaderColor?: string;
|
|
15
|
+
userBubbleColor?: string;
|
|
16
|
+
assistantBubbleColor?: string;
|
|
17
|
+
assistantBubbleTextColor?: string;
|
|
18
|
+
secondaryColor?: string;
|
|
19
|
+
borderColor?: string;
|
|
20
|
+
placeholderColor?: string;
|
|
21
|
+
fontFamily?: string;
|
|
22
|
+
headingFontFamily?: string;
|
|
23
|
+
borderRadius?: string;
|
|
24
|
+
assistantBubblePadding?: string;
|
|
25
|
+
assistantMaxWidth?: string;
|
|
26
|
+
/** Arbitrary CSS custom properties (key must start with `--`). */
|
|
27
|
+
customProperties?: Record<string, string>;
|
|
28
|
+
}
|
|
29
|
+
interface ThemeContextValue {
|
|
30
|
+
/** Current theme configuration. */
|
|
31
|
+
theme: ThemeConfig;
|
|
32
|
+
/** Update the theme at runtime. */
|
|
33
|
+
setTheme: (theme: ThemeConfig) => void;
|
|
34
|
+
/** Current text direction derived from language. */
|
|
35
|
+
direction: "ltr" | "rtl";
|
|
36
|
+
}
|
|
37
|
+
/** Props for the ThemeProvider component. */
|
|
38
|
+
interface ThemeProviderProps {
|
|
39
|
+
/** Theme configuration. */
|
|
40
|
+
theme?: ThemeConfig;
|
|
41
|
+
children: ReactNode;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Provides theme context and renders a wrapper `<div data-aigentyc-chat>`
|
|
45
|
+
* that sets CSS custom properties for styling.
|
|
46
|
+
* Reads direction from I18nProvider.
|
|
47
|
+
*/
|
|
48
|
+
declare function ThemeProvider({ theme: initialTheme, children, }: ThemeProviderProps): react_jsx_runtime.JSX.Element;
|
|
49
|
+
/**
|
|
50
|
+
* Returns the current theme configuration and `setTheme` updater.
|
|
51
|
+
* Must be used within a `ThemeProvider`.
|
|
52
|
+
*/
|
|
53
|
+
declare function useTheme(): ThemeContextValue;
|
|
54
|
+
|
|
55
|
+
export { ThemeProvider, useTheme };
|
package/dist/theme.d.ts
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
export { T as ThemeConfig } from './types-DKJ_-nbG.js';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Theme configuration for the chat widget.
|
|
7
|
+
*/
|
|
8
|
+
interface ThemeConfig {
|
|
9
|
+
primaryColor?: string;
|
|
10
|
+
accentColor?: string;
|
|
11
|
+
backgroundColor?: string;
|
|
12
|
+
textColor?: string;
|
|
13
|
+
linkColor?: string;
|
|
14
|
+
loaderColor?: string;
|
|
15
|
+
userBubbleColor?: string;
|
|
16
|
+
assistantBubbleColor?: string;
|
|
17
|
+
assistantBubbleTextColor?: string;
|
|
18
|
+
secondaryColor?: string;
|
|
19
|
+
borderColor?: string;
|
|
20
|
+
placeholderColor?: string;
|
|
21
|
+
fontFamily?: string;
|
|
22
|
+
headingFontFamily?: string;
|
|
23
|
+
borderRadius?: string;
|
|
24
|
+
assistantBubblePadding?: string;
|
|
25
|
+
assistantMaxWidth?: string;
|
|
26
|
+
/** Arbitrary CSS custom properties (key must start with `--`). */
|
|
27
|
+
customProperties?: Record<string, string>;
|
|
28
|
+
}
|
|
29
|
+
interface ThemeContextValue {
|
|
30
|
+
/** Current theme configuration. */
|
|
31
|
+
theme: ThemeConfig;
|
|
32
|
+
/** Update the theme at runtime. */
|
|
33
|
+
setTheme: (theme: ThemeConfig) => void;
|
|
34
|
+
/** Current text direction derived from language. */
|
|
35
|
+
direction: "ltr" | "rtl";
|
|
36
|
+
}
|
|
37
|
+
/** Props for the ThemeProvider component. */
|
|
38
|
+
interface ThemeProviderProps {
|
|
39
|
+
/** Theme configuration. */
|
|
40
|
+
theme?: ThemeConfig;
|
|
41
|
+
children: ReactNode;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Provides theme context and renders a wrapper `<div data-aigentyc-chat>`
|
|
45
|
+
* that sets CSS custom properties for styling.
|
|
46
|
+
* Reads direction from I18nProvider.
|
|
47
|
+
*/
|
|
48
|
+
declare function ThemeProvider({ theme: initialTheme, children, }: ThemeProviderProps): react_jsx_runtime.JSX.Element;
|
|
49
|
+
/**
|
|
50
|
+
* Returns the current theme configuration and `setTheme` updater.
|
|
51
|
+
* Must be used within a `ThemeProvider`.
|
|
52
|
+
*/
|
|
53
|
+
declare function useTheme(): ThemeContextValue;
|
|
54
|
+
|
|
55
|
+
export { ThemeProvider, useTheme };
|
package/dist/theme.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"theme.js"}
|
package/dist/tools.cjs
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
var chunkXXNDL5SJ_cjs = require('./chunk-XXNDL5SJ.cjs');
|
|
5
|
+
require('./chunk-J2K7EJYP.cjs');
|
|
6
|
+
require('./chunk-JOO6C3XT.cjs');
|
|
7
|
+
var chunkJ2H6MLQF_cjs = require('./chunk-J2H6MLQF.cjs');
|
|
8
|
+
var chunkQ7T3VAJV_cjs = require('./chunk-Q7T3VAJV.cjs');
|
|
9
|
+
require('./chunk-JI5KCSOI.cjs');
|
|
10
|
+
require('./chunk-AWAJOSFP.cjs');
|
|
11
|
+
require('./chunk-525KS5HM.cjs');
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
Object.defineProperty(exports, "ComponentRenderer", {
|
|
16
|
+
enumerable: true,
|
|
17
|
+
get: function () { return chunkXXNDL5SJ_cjs.ComponentRenderer; }
|
|
18
|
+
});
|
|
19
|
+
Object.defineProperty(exports, "ToolRenderer", {
|
|
20
|
+
enumerable: true,
|
|
21
|
+
get: function () { return chunkXXNDL5SJ_cjs.ToolRenderer; }
|
|
22
|
+
});
|
|
23
|
+
Object.defineProperty(exports, "JsonRenderResult", {
|
|
24
|
+
enumerable: true,
|
|
25
|
+
get: function () { return chunkJ2H6MLQF_cjs.JsonRenderResult; }
|
|
26
|
+
});
|
|
27
|
+
Object.defineProperty(exports, "VisualizationRenderer", {
|
|
28
|
+
enumerable: true,
|
|
29
|
+
get: function () { return chunkQ7T3VAJV_cjs.VisualizationRenderer; }
|
|
30
|
+
});
|
|
31
|
+
//# sourceMappingURL=tools.cjs.map
|
|
32
|
+
//# sourceMappingURL=tools.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"tools.cjs"}
|
package/dist/tools.d.cts
ADDED
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { g as ToolRendererProps } from './types-DKJ_-nbG.cjs';
|
|
3
|
+
export { d as ComponentAction, h as ToolResult } from './types-DKJ_-nbG.cjs';
|
|
4
|
+
export { J as JsonRenderResult } from './JsonRenderResult-Ftw4AKwb.cjs';
|
|
5
|
+
import 'react';
|
|
6
|
+
import '@json-render/core';
|
|
7
|
+
|
|
8
|
+
declare function ToolRenderer(props: ToolRendererProps): react_jsx_runtime.JSX.Element | null;
|
|
9
|
+
|
|
10
|
+
interface SeriesConfig {
|
|
11
|
+
dataKey: string;
|
|
12
|
+
label: string;
|
|
13
|
+
color?: string;
|
|
14
|
+
type?: "line" | "bar" | "area";
|
|
15
|
+
}
|
|
16
|
+
interface VisualizationConfig {
|
|
17
|
+
xAxis?: string;
|
|
18
|
+
series?: SeriesConfig[];
|
|
19
|
+
showGrid?: boolean;
|
|
20
|
+
showLegend?: boolean;
|
|
21
|
+
stacked?: boolean;
|
|
22
|
+
valueFormatter?: "currency" | "percent" | "number" | "compact";
|
|
23
|
+
}
|
|
24
|
+
interface MetricItem {
|
|
25
|
+
label: string;
|
|
26
|
+
value: string;
|
|
27
|
+
unit?: string;
|
|
28
|
+
trend?: string;
|
|
29
|
+
trendDirection?: "up" | "down" | "neutral";
|
|
30
|
+
description?: string;
|
|
31
|
+
}
|
|
32
|
+
interface ComparisonItem {
|
|
33
|
+
name: string;
|
|
34
|
+
highlight?: boolean;
|
|
35
|
+
features: Record<string, string | boolean | number>;
|
|
36
|
+
}
|
|
37
|
+
interface ComparisonField {
|
|
38
|
+
key: string;
|
|
39
|
+
label: string;
|
|
40
|
+
type?: "text" | "boolean" | "rating";
|
|
41
|
+
}
|
|
42
|
+
interface TimelineEvent {
|
|
43
|
+
date?: string;
|
|
44
|
+
title: string;
|
|
45
|
+
description?: string;
|
|
46
|
+
status?: "completed" | "current" | "upcoming";
|
|
47
|
+
}
|
|
48
|
+
interface GoalItem {
|
|
49
|
+
label: string;
|
|
50
|
+
current: number;
|
|
51
|
+
target: number;
|
|
52
|
+
unit?: string;
|
|
53
|
+
}
|
|
54
|
+
/** Declarative visualization spec produced by a tool. */
|
|
55
|
+
interface VisualizationSpec {
|
|
56
|
+
type: "line_chart" | "bar_chart" | "pie_chart" | "area_chart" | "radar_chart" | "composed_chart" | "metric_cards" | "comparison" | "timeline" | "progress";
|
|
57
|
+
title?: string;
|
|
58
|
+
description?: string;
|
|
59
|
+
data?: Array<Record<string, unknown>>;
|
|
60
|
+
config?: VisualizationConfig;
|
|
61
|
+
metrics?: MetricItem[];
|
|
62
|
+
items?: ComparisonItem[];
|
|
63
|
+
comparisonFields?: ComparisonField[];
|
|
64
|
+
events?: TimelineEvent[];
|
|
65
|
+
goals?: GoalItem[];
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Props for `VisualizationRenderer`.
|
|
69
|
+
*
|
|
70
|
+
* The renderer expects the visualization spec inside the tool result's `data`
|
|
71
|
+
* (or directly as `spec`).
|
|
72
|
+
*/
|
|
73
|
+
interface VisualizationRendererProps {
|
|
74
|
+
spec: VisualizationSpec;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Renders a declarative visualization spec (charts, metric cards, timelines,
|
|
78
|
+
* comparisons, progress bars) using recharts.
|
|
79
|
+
*/
|
|
80
|
+
declare function VisualizationRenderer({ spec }: VisualizationRendererProps): react_jsx_runtime.JSX.Element | null;
|
|
81
|
+
|
|
82
|
+
/** Props for `ComponentRenderer`. */
|
|
83
|
+
interface ComponentRendererProps {
|
|
84
|
+
/** Raw HTML template with `{{field}}` placeholders. */
|
|
85
|
+
htmlCode: string;
|
|
86
|
+
/** Scoped CSS for the template. */
|
|
87
|
+
cssCode: string;
|
|
88
|
+
/** Data payload — object (single render) or array (grid). */
|
|
89
|
+
data: unknown;
|
|
90
|
+
/** Columns on mobile when `data` is an array. Default: 1 */
|
|
91
|
+
mobileGridCols?: number;
|
|
92
|
+
/** Columns on desktop when `data` is an array. Default: 3 */
|
|
93
|
+
desktopGridCols?: number;
|
|
94
|
+
/** Optional interaction tracker. */
|
|
95
|
+
onInteraction?: (params: {
|
|
96
|
+
type: string;
|
|
97
|
+
target: string;
|
|
98
|
+
label: string;
|
|
99
|
+
metadata?: Record<string, unknown>;
|
|
100
|
+
messageId?: string;
|
|
101
|
+
eventId?: string;
|
|
102
|
+
}) => void;
|
|
103
|
+
messageId?: string;
|
|
104
|
+
eventId?: string;
|
|
105
|
+
/** Items per page on mobile (default: 4). */
|
|
106
|
+
mobilePageSize?: number;
|
|
107
|
+
/** Items per page on desktop (default: 4). */
|
|
108
|
+
desktopPageSize?: number;
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Renders a tool-provided HTML/CSS template against data. Strings such as
|
|
112
|
+
* `{{user.name}}` and `{{#each items}}...{{/each}}` are resolved before
|
|
113
|
+
* insertion.
|
|
114
|
+
*/
|
|
115
|
+
declare function ComponentRenderer({ htmlCode, cssCode, data, mobileGridCols, desktopGridCols, onInteraction, messageId, eventId, mobilePageSize, desktopPageSize, }: ComponentRendererProps): react_jsx_runtime.JSX.Element;
|
|
116
|
+
|
|
117
|
+
export { ComponentRenderer, ToolRenderer, ToolRendererProps, VisualizationRenderer };
|
package/dist/tools.d.ts
ADDED
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { g as ToolRendererProps } from './types-DKJ_-nbG.js';
|
|
3
|
+
export { d as ComponentAction, h as ToolResult } from './types-DKJ_-nbG.js';
|
|
4
|
+
export { J as JsonRenderResult } from './JsonRenderResult-Ftw4AKwb.js';
|
|
5
|
+
import 'react';
|
|
6
|
+
import '@json-render/core';
|
|
7
|
+
|
|
8
|
+
declare function ToolRenderer(props: ToolRendererProps): react_jsx_runtime.JSX.Element | null;
|
|
9
|
+
|
|
10
|
+
interface SeriesConfig {
|
|
11
|
+
dataKey: string;
|
|
12
|
+
label: string;
|
|
13
|
+
color?: string;
|
|
14
|
+
type?: "line" | "bar" | "area";
|
|
15
|
+
}
|
|
16
|
+
interface VisualizationConfig {
|
|
17
|
+
xAxis?: string;
|
|
18
|
+
series?: SeriesConfig[];
|
|
19
|
+
showGrid?: boolean;
|
|
20
|
+
showLegend?: boolean;
|
|
21
|
+
stacked?: boolean;
|
|
22
|
+
valueFormatter?: "currency" | "percent" | "number" | "compact";
|
|
23
|
+
}
|
|
24
|
+
interface MetricItem {
|
|
25
|
+
label: string;
|
|
26
|
+
value: string;
|
|
27
|
+
unit?: string;
|
|
28
|
+
trend?: string;
|
|
29
|
+
trendDirection?: "up" | "down" | "neutral";
|
|
30
|
+
description?: string;
|
|
31
|
+
}
|
|
32
|
+
interface ComparisonItem {
|
|
33
|
+
name: string;
|
|
34
|
+
highlight?: boolean;
|
|
35
|
+
features: Record<string, string | boolean | number>;
|
|
36
|
+
}
|
|
37
|
+
interface ComparisonField {
|
|
38
|
+
key: string;
|
|
39
|
+
label: string;
|
|
40
|
+
type?: "text" | "boolean" | "rating";
|
|
41
|
+
}
|
|
42
|
+
interface TimelineEvent {
|
|
43
|
+
date?: string;
|
|
44
|
+
title: string;
|
|
45
|
+
description?: string;
|
|
46
|
+
status?: "completed" | "current" | "upcoming";
|
|
47
|
+
}
|
|
48
|
+
interface GoalItem {
|
|
49
|
+
label: string;
|
|
50
|
+
current: number;
|
|
51
|
+
target: number;
|
|
52
|
+
unit?: string;
|
|
53
|
+
}
|
|
54
|
+
/** Declarative visualization spec produced by a tool. */
|
|
55
|
+
interface VisualizationSpec {
|
|
56
|
+
type: "line_chart" | "bar_chart" | "pie_chart" | "area_chart" | "radar_chart" | "composed_chart" | "metric_cards" | "comparison" | "timeline" | "progress";
|
|
57
|
+
title?: string;
|
|
58
|
+
description?: string;
|
|
59
|
+
data?: Array<Record<string, unknown>>;
|
|
60
|
+
config?: VisualizationConfig;
|
|
61
|
+
metrics?: MetricItem[];
|
|
62
|
+
items?: ComparisonItem[];
|
|
63
|
+
comparisonFields?: ComparisonField[];
|
|
64
|
+
events?: TimelineEvent[];
|
|
65
|
+
goals?: GoalItem[];
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Props for `VisualizationRenderer`.
|
|
69
|
+
*
|
|
70
|
+
* The renderer expects the visualization spec inside the tool result's `data`
|
|
71
|
+
* (or directly as `spec`).
|
|
72
|
+
*/
|
|
73
|
+
interface VisualizationRendererProps {
|
|
74
|
+
spec: VisualizationSpec;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Renders a declarative visualization spec (charts, metric cards, timelines,
|
|
78
|
+
* comparisons, progress bars) using recharts.
|
|
79
|
+
*/
|
|
80
|
+
declare function VisualizationRenderer({ spec }: VisualizationRendererProps): react_jsx_runtime.JSX.Element | null;
|
|
81
|
+
|
|
82
|
+
/** Props for `ComponentRenderer`. */
|
|
83
|
+
interface ComponentRendererProps {
|
|
84
|
+
/** Raw HTML template with `{{field}}` placeholders. */
|
|
85
|
+
htmlCode: string;
|
|
86
|
+
/** Scoped CSS for the template. */
|
|
87
|
+
cssCode: string;
|
|
88
|
+
/** Data payload — object (single render) or array (grid). */
|
|
89
|
+
data: unknown;
|
|
90
|
+
/** Columns on mobile when `data` is an array. Default: 1 */
|
|
91
|
+
mobileGridCols?: number;
|
|
92
|
+
/** Columns on desktop when `data` is an array. Default: 3 */
|
|
93
|
+
desktopGridCols?: number;
|
|
94
|
+
/** Optional interaction tracker. */
|
|
95
|
+
onInteraction?: (params: {
|
|
96
|
+
type: string;
|
|
97
|
+
target: string;
|
|
98
|
+
label: string;
|
|
99
|
+
metadata?: Record<string, unknown>;
|
|
100
|
+
messageId?: string;
|
|
101
|
+
eventId?: string;
|
|
102
|
+
}) => void;
|
|
103
|
+
messageId?: string;
|
|
104
|
+
eventId?: string;
|
|
105
|
+
/** Items per page on mobile (default: 4). */
|
|
106
|
+
mobilePageSize?: number;
|
|
107
|
+
/** Items per page on desktop (default: 4). */
|
|
108
|
+
desktopPageSize?: number;
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Renders a tool-provided HTML/CSS template against data. Strings such as
|
|
112
|
+
* `{{user.name}}` and `{{#each items}}...{{/each}}` are resolved before
|
|
113
|
+
* insertion.
|
|
114
|
+
*/
|
|
115
|
+
declare function ComponentRenderer({ htmlCode, cssCode, data, mobileGridCols, desktopGridCols, onInteraction, messageId, eventId, mobilePageSize, desktopPageSize, }: ComponentRendererProps): react_jsx_runtime.JSX.Element;
|
|
116
|
+
|
|
117
|
+
export { ComponentRenderer, ToolRenderer, ToolRendererProps, VisualizationRenderer };
|
package/dist/tools.js
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
export { ComponentRenderer, ToolRenderer } from './chunk-YQELMJW5.js';
|
|
3
|
+
import './chunk-FYPJSHCL.js';
|
|
4
|
+
import './chunk-PS3U7T37.js';
|
|
5
|
+
export { JsonRenderResult } from './chunk-RPDJXB3U.js';
|
|
6
|
+
export { VisualizationRenderer } from './chunk-5T4FJ2SR.js';
|
|
7
|
+
import './chunk-4QT25AXI.js';
|
|
8
|
+
import './chunk-NPJKLYLV.js';
|
|
9
|
+
import './chunk-3RW7O444.js';
|
|
10
|
+
//# sourceMappingURL=tools.js.map
|
|
11
|
+
//# sourceMappingURL=tools.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"tools.js"}
|