@erdoai/ui 0.1.18 → 0.1.20
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.cjs +8 -8
- package/dist/index.d.cts +53 -9
- package/dist/index.d.ts +53 -9
- package/dist/index.js +8 -8
- package/package.json +2 -2
package/dist/index.d.cts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import * as React from 'react';
|
|
2
|
+
import * as React$1 from 'react';
|
|
3
3
|
import React__default from 'react';
|
|
4
|
-
import { ErdoClient, ContentItem, LogEntry, ToolGroup, InvocationStatus as InvocationStatus$1, SSEEvent,
|
|
4
|
+
import { ErdoClient, ContentItem, InvokeResult, LogEntry, ToolGroup, InvocationStatus as InvocationStatus$1, SSEEvent, InvokeParams } from '@erdoai/types';
|
|
5
5
|
export { ContentItem } from '@erdoai/types';
|
|
6
6
|
import * as RechartsPrimitive from 'recharts';
|
|
7
7
|
import { UseQueryResult } from '@tanstack/react-query';
|
|
@@ -122,8 +122,8 @@ declare const THEMES: {
|
|
|
122
122
|
};
|
|
123
123
|
type ChartConfig = {
|
|
124
124
|
[k in string]: {
|
|
125
|
-
label?: React.ReactNode;
|
|
126
|
-
icon?: React.ComponentType;
|
|
125
|
+
label?: React$1.ReactNode;
|
|
126
|
+
icon?: React$1.ComponentType;
|
|
127
127
|
} & ({
|
|
128
128
|
color?: string;
|
|
129
129
|
theme?: never;
|
|
@@ -132,9 +132,9 @@ type ChartConfig = {
|
|
|
132
132
|
theme: Record<keyof typeof THEMES, string>;
|
|
133
133
|
});
|
|
134
134
|
};
|
|
135
|
-
declare function ChartContainer({ id, className, children, config, debounceResize, ...props }: React.ComponentProps<'div'> & {
|
|
135
|
+
declare function ChartContainer({ id, className, children, config, debounceResize, ...props }: React$1.ComponentProps<'div'> & {
|
|
136
136
|
config: ChartConfig;
|
|
137
|
-
children: React.ComponentProps<typeof RechartsPrimitive.ResponsiveContainer>['children'];
|
|
137
|
+
children: React$1.ComponentProps<typeof RechartsPrimitive.ResponsiveContainer>['children'];
|
|
138
138
|
/** Debounce resize events by 200ms to prevent animation restarts during streaming */
|
|
139
139
|
debounceResize?: boolean;
|
|
140
140
|
}): react_jsx_runtime.JSX.Element;
|
|
@@ -158,9 +158,9 @@ interface ChartTooltipContentProps {
|
|
|
158
158
|
indicator?: 'line' | 'dot' | 'dashed';
|
|
159
159
|
hideLabel?: boolean;
|
|
160
160
|
hideIndicator?: boolean;
|
|
161
|
-
labelFormatter?: (label: any, payload: any) => React.ReactNode;
|
|
161
|
+
labelFormatter?: (label: any, payload: any) => React$1.ReactNode;
|
|
162
162
|
labelClassName?: string;
|
|
163
|
-
formatter?: (value: any, name: any, item: any, index: number, payload: any) => React.ReactNode;
|
|
163
|
+
formatter?: (value: any, name: any, item: any, index: number, payload: any) => React$1.ReactNode;
|
|
164
164
|
color?: string;
|
|
165
165
|
nameKey?: string;
|
|
166
166
|
labelKey?: string;
|
|
@@ -764,6 +764,50 @@ interface ContentProps {
|
|
|
764
764
|
*/
|
|
765
765
|
declare function Content({ content, className, components }: ContentProps): react_jsx_runtime.JSX.Element | null;
|
|
766
766
|
|
|
767
|
+
interface ErdoUIProps {
|
|
768
|
+
/** Result from an Erdo invocation */
|
|
769
|
+
result: InvokeResult | null;
|
|
770
|
+
/** Whether the invocation is still streaming */
|
|
771
|
+
isStreaming?: boolean;
|
|
772
|
+
/** Additional CSS class name */
|
|
773
|
+
className?: string;
|
|
774
|
+
/** Override renderers for specific content types */
|
|
775
|
+
components?: Record<string, React.ComponentType<any>>;
|
|
776
|
+
/** Text to show while streaming (optional - shows accumulated text if provided) */
|
|
777
|
+
streamingText?: string;
|
|
778
|
+
}
|
|
779
|
+
/**
|
|
780
|
+
* Main component for rendering Erdo agent results
|
|
781
|
+
*
|
|
782
|
+
* @example
|
|
783
|
+
* ```tsx
|
|
784
|
+
* import { ErdoUI, useInvocation } from '@erdoai/ui';
|
|
785
|
+
*
|
|
786
|
+
* function MyComponent() {
|
|
787
|
+
* const { result, isStreaming, invoke } = useInvocation();
|
|
788
|
+
*
|
|
789
|
+
* return (
|
|
790
|
+
* <div>
|
|
791
|
+
* <button onClick={() => invoke('my-bot', { messages: [...] })}>
|
|
792
|
+
* Invoke
|
|
793
|
+
* </button>
|
|
794
|
+
* <ErdoUI result={result} isStreaming={isStreaming} />
|
|
795
|
+
* </div>
|
|
796
|
+
* );
|
|
797
|
+
* }
|
|
798
|
+
* ```
|
|
799
|
+
*/
|
|
800
|
+
declare function ErdoUI({ result, isStreaming, className, components, streamingText }: ErdoUIProps): react_jsx_runtime.JSX.Element | null;
|
|
801
|
+
|
|
802
|
+
/**
|
|
803
|
+
* Extract visible content items from SSE events in an InvokeResult.
|
|
804
|
+
* This finds content from result events with user_visibility='visible'
|
|
805
|
+
* and properly sets ui_content_type for rendering.
|
|
806
|
+
*/
|
|
807
|
+
declare function extractContentItems(result: InvokeResult): Array<ContentItem & {
|
|
808
|
+
id: string;
|
|
809
|
+
}>;
|
|
810
|
+
|
|
767
811
|
interface TextContentProps {
|
|
768
812
|
content: string;
|
|
769
813
|
className?: string;
|
|
@@ -1269,4 +1313,4 @@ declare function handleIncrementalMixedJsonParsing(outputContent: MessageContent
|
|
|
1269
1313
|
*/
|
|
1270
1314
|
declare function handleSSEEvent(eventType: string, event: SSEEventData, path: string[], threadID: string, activeMessagesByID: Record<string, MessageWithContents>, currentEntity?: Entity | null, parents?: Entity[], entityIds?: Record<string, string>): Entity | null;
|
|
1271
1315
|
|
|
1272
|
-
export { BarChart, type BaseChartProps, type BotInvocation, BotInvocationContent, type BotInvocationContentData, type BotInvocationContentProps, type BotInvocationData, type BotInvocationEventInfo, type BotInvocationStatusInfo, Chart, type ChartConfig, ChartContainer, ChartContent, type ChartContentProps, ChartLegend, ChartLegendContent, ChartStyle, ChartTooltip, ChartTooltipContent, CodeexecContent, type CodeexecContentProps, CodegenContent, type CodegenContentProps, CollapsibleCodeBlock, type CollapsibleCodeBlockProps, Content, type ContentChartConfig, type ContentChunk, type ContentComponentProps, type ContentProps, type ContentType, type DataFetcher, DatasetChart, type DatasetChartProps, DatasetTable, type DatasetTableProps, type Entity, type EntityType, ErdoProvider, type ErdoProviderConfig, type ErdoProviderProps, ErrorBoundary, ExecutionStatus, ExpandableOutputContent, type ExpandableOutputContentProps, HeatmapChart, InvocationEvent, type InvocationEventProps, InvocationEvents, type InvocationEventsProps, InvocationStatus, JSONStreamParser, type JSONValue, JsonContent, type JsonContentProps, LineChart, Log, LogContent, type LogContentProps, type LogProps, MarkdownContent, type MarkdownContentProps, type Message, type MessageContent, type MessageStreamingState, type MessageWithContents, Output, type OutputContent, type OutputProps, type OutputWithContents, PieChart, type ResolvedBotInvocation, type ResultHandler, type SSEEventData, ScatterChart, type SpinnerStatus, SqlContent, type SqlContentProps, type Status, type StatusEvent, StatusSpinner, type StatusSpinnerProps, StderrText, StdoutText, StdwarnText, type Step, StepInvocation, type StepInvocationProps, StepInvocationStatus, type StepInvocationStatusProps, TableContent, type TableContentProps, TextContent, type TextContentProps, ThinkingContent, type ThinkingContentProps, ToolGroupContent, type ToolGroupContentProps, type UseInvocationOptions, type UseInvocationReturn, WebParseContent, type WebParseContentProps, WebSearchContent, type WebSearchContentProps, type WrapperType, cn, formatValue, handleIncrementalMixedJsonParsing, handleSSEEvent, isJsonLike, isParsingComplete, isParsingInProgress, isWhitespaceChar, parseCompleteJson, parseMixedJson, parseToDate, resolveKeyFromData, toSnakeCase, useChartZoom, useDatasetContents, useErdoConfig, useErdoConfigOptional, useInvocation, useMultipleDatasetContents };
|
|
1316
|
+
export { BarChart, type BaseChartProps, type BotInvocation, BotInvocationContent, type BotInvocationContentData, type BotInvocationContentProps, type BotInvocationData, type BotInvocationEventInfo, type BotInvocationStatusInfo, Chart, type ChartConfig, ChartContainer, ChartContent, type ChartContentProps, ChartLegend, ChartLegendContent, ChartStyle, ChartTooltip, ChartTooltipContent, CodeexecContent, type CodeexecContentProps, CodegenContent, type CodegenContentProps, CollapsibleCodeBlock, type CollapsibleCodeBlockProps, Content, type ContentChartConfig, type ContentChunk, type ContentComponentProps, type ContentProps, type ContentType, type DataFetcher, DatasetChart, type DatasetChartProps, DatasetTable, type DatasetTableProps, type Entity, type EntityType, ErdoProvider, type ErdoProviderConfig, type ErdoProviderProps, ErdoUI, type ErdoUIProps, ErrorBoundary, ExecutionStatus, ExpandableOutputContent, type ExpandableOutputContentProps, HeatmapChart, InvocationEvent, type InvocationEventProps, InvocationEvents, type InvocationEventsProps, InvocationStatus, JSONStreamParser, type JSONValue, JsonContent, type JsonContentProps, LineChart, Log, LogContent, type LogContentProps, type LogProps, MarkdownContent, type MarkdownContentProps, type Message, type MessageContent, type MessageStreamingState, type MessageWithContents, Output, type OutputContent, type OutputProps, type OutputWithContents, PieChart, type ResolvedBotInvocation, type ResultHandler, type SSEEventData, ScatterChart, type SpinnerStatus, SqlContent, type SqlContentProps, type Status, type StatusEvent, StatusSpinner, type StatusSpinnerProps, StderrText, StdoutText, StdwarnText, type Step, StepInvocation, type StepInvocationProps, StepInvocationStatus, type StepInvocationStatusProps, TableContent, type TableContentProps, TextContent, type TextContentProps, ThinkingContent, type ThinkingContentProps, ToolGroupContent, type ToolGroupContentProps, type UseInvocationOptions, type UseInvocationReturn, WebParseContent, type WebParseContentProps, WebSearchContent, type WebSearchContentProps, type WrapperType, cn, extractContentItems, formatValue, handleIncrementalMixedJsonParsing, handleSSEEvent, isJsonLike, isParsingComplete, isParsingInProgress, isWhitespaceChar, parseCompleteJson, parseMixedJson, parseToDate, resolveKeyFromData, toSnakeCase, useChartZoom, useDatasetContents, useErdoConfig, useErdoConfigOptional, useInvocation, useMultipleDatasetContents };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import * as React from 'react';
|
|
2
|
+
import * as React$1 from 'react';
|
|
3
3
|
import React__default from 'react';
|
|
4
|
-
import { ErdoClient, ContentItem, LogEntry, ToolGroup, InvocationStatus as InvocationStatus$1, SSEEvent,
|
|
4
|
+
import { ErdoClient, ContentItem, InvokeResult, LogEntry, ToolGroup, InvocationStatus as InvocationStatus$1, SSEEvent, InvokeParams } from '@erdoai/types';
|
|
5
5
|
export { ContentItem } from '@erdoai/types';
|
|
6
6
|
import * as RechartsPrimitive from 'recharts';
|
|
7
7
|
import { UseQueryResult } from '@tanstack/react-query';
|
|
@@ -122,8 +122,8 @@ declare const THEMES: {
|
|
|
122
122
|
};
|
|
123
123
|
type ChartConfig = {
|
|
124
124
|
[k in string]: {
|
|
125
|
-
label?: React.ReactNode;
|
|
126
|
-
icon?: React.ComponentType;
|
|
125
|
+
label?: React$1.ReactNode;
|
|
126
|
+
icon?: React$1.ComponentType;
|
|
127
127
|
} & ({
|
|
128
128
|
color?: string;
|
|
129
129
|
theme?: never;
|
|
@@ -132,9 +132,9 @@ type ChartConfig = {
|
|
|
132
132
|
theme: Record<keyof typeof THEMES, string>;
|
|
133
133
|
});
|
|
134
134
|
};
|
|
135
|
-
declare function ChartContainer({ id, className, children, config, debounceResize, ...props }: React.ComponentProps<'div'> & {
|
|
135
|
+
declare function ChartContainer({ id, className, children, config, debounceResize, ...props }: React$1.ComponentProps<'div'> & {
|
|
136
136
|
config: ChartConfig;
|
|
137
|
-
children: React.ComponentProps<typeof RechartsPrimitive.ResponsiveContainer>['children'];
|
|
137
|
+
children: React$1.ComponentProps<typeof RechartsPrimitive.ResponsiveContainer>['children'];
|
|
138
138
|
/** Debounce resize events by 200ms to prevent animation restarts during streaming */
|
|
139
139
|
debounceResize?: boolean;
|
|
140
140
|
}): react_jsx_runtime.JSX.Element;
|
|
@@ -158,9 +158,9 @@ interface ChartTooltipContentProps {
|
|
|
158
158
|
indicator?: 'line' | 'dot' | 'dashed';
|
|
159
159
|
hideLabel?: boolean;
|
|
160
160
|
hideIndicator?: boolean;
|
|
161
|
-
labelFormatter?: (label: any, payload: any) => React.ReactNode;
|
|
161
|
+
labelFormatter?: (label: any, payload: any) => React$1.ReactNode;
|
|
162
162
|
labelClassName?: string;
|
|
163
|
-
formatter?: (value: any, name: any, item: any, index: number, payload: any) => React.ReactNode;
|
|
163
|
+
formatter?: (value: any, name: any, item: any, index: number, payload: any) => React$1.ReactNode;
|
|
164
164
|
color?: string;
|
|
165
165
|
nameKey?: string;
|
|
166
166
|
labelKey?: string;
|
|
@@ -764,6 +764,50 @@ interface ContentProps {
|
|
|
764
764
|
*/
|
|
765
765
|
declare function Content({ content, className, components }: ContentProps): react_jsx_runtime.JSX.Element | null;
|
|
766
766
|
|
|
767
|
+
interface ErdoUIProps {
|
|
768
|
+
/** Result from an Erdo invocation */
|
|
769
|
+
result: InvokeResult | null;
|
|
770
|
+
/** Whether the invocation is still streaming */
|
|
771
|
+
isStreaming?: boolean;
|
|
772
|
+
/** Additional CSS class name */
|
|
773
|
+
className?: string;
|
|
774
|
+
/** Override renderers for specific content types */
|
|
775
|
+
components?: Record<string, React.ComponentType<any>>;
|
|
776
|
+
/** Text to show while streaming (optional - shows accumulated text if provided) */
|
|
777
|
+
streamingText?: string;
|
|
778
|
+
}
|
|
779
|
+
/**
|
|
780
|
+
* Main component for rendering Erdo agent results
|
|
781
|
+
*
|
|
782
|
+
* @example
|
|
783
|
+
* ```tsx
|
|
784
|
+
* import { ErdoUI, useInvocation } from '@erdoai/ui';
|
|
785
|
+
*
|
|
786
|
+
* function MyComponent() {
|
|
787
|
+
* const { result, isStreaming, invoke } = useInvocation();
|
|
788
|
+
*
|
|
789
|
+
* return (
|
|
790
|
+
* <div>
|
|
791
|
+
* <button onClick={() => invoke('my-bot', { messages: [...] })}>
|
|
792
|
+
* Invoke
|
|
793
|
+
* </button>
|
|
794
|
+
* <ErdoUI result={result} isStreaming={isStreaming} />
|
|
795
|
+
* </div>
|
|
796
|
+
* );
|
|
797
|
+
* }
|
|
798
|
+
* ```
|
|
799
|
+
*/
|
|
800
|
+
declare function ErdoUI({ result, isStreaming, className, components, streamingText }: ErdoUIProps): react_jsx_runtime.JSX.Element | null;
|
|
801
|
+
|
|
802
|
+
/**
|
|
803
|
+
* Extract visible content items from SSE events in an InvokeResult.
|
|
804
|
+
* This finds content from result events with user_visibility='visible'
|
|
805
|
+
* and properly sets ui_content_type for rendering.
|
|
806
|
+
*/
|
|
807
|
+
declare function extractContentItems(result: InvokeResult): Array<ContentItem & {
|
|
808
|
+
id: string;
|
|
809
|
+
}>;
|
|
810
|
+
|
|
767
811
|
interface TextContentProps {
|
|
768
812
|
content: string;
|
|
769
813
|
className?: string;
|
|
@@ -1269,4 +1313,4 @@ declare function handleIncrementalMixedJsonParsing(outputContent: MessageContent
|
|
|
1269
1313
|
*/
|
|
1270
1314
|
declare function handleSSEEvent(eventType: string, event: SSEEventData, path: string[], threadID: string, activeMessagesByID: Record<string, MessageWithContents>, currentEntity?: Entity | null, parents?: Entity[], entityIds?: Record<string, string>): Entity | null;
|
|
1271
1315
|
|
|
1272
|
-
export { BarChart, type BaseChartProps, type BotInvocation, BotInvocationContent, type BotInvocationContentData, type BotInvocationContentProps, type BotInvocationData, type BotInvocationEventInfo, type BotInvocationStatusInfo, Chart, type ChartConfig, ChartContainer, ChartContent, type ChartContentProps, ChartLegend, ChartLegendContent, ChartStyle, ChartTooltip, ChartTooltipContent, CodeexecContent, type CodeexecContentProps, CodegenContent, type CodegenContentProps, CollapsibleCodeBlock, type CollapsibleCodeBlockProps, Content, type ContentChartConfig, type ContentChunk, type ContentComponentProps, type ContentProps, type ContentType, type DataFetcher, DatasetChart, type DatasetChartProps, DatasetTable, type DatasetTableProps, type Entity, type EntityType, ErdoProvider, type ErdoProviderConfig, type ErdoProviderProps, ErrorBoundary, ExecutionStatus, ExpandableOutputContent, type ExpandableOutputContentProps, HeatmapChart, InvocationEvent, type InvocationEventProps, InvocationEvents, type InvocationEventsProps, InvocationStatus, JSONStreamParser, type JSONValue, JsonContent, type JsonContentProps, LineChart, Log, LogContent, type LogContentProps, type LogProps, MarkdownContent, type MarkdownContentProps, type Message, type MessageContent, type MessageStreamingState, type MessageWithContents, Output, type OutputContent, type OutputProps, type OutputWithContents, PieChart, type ResolvedBotInvocation, type ResultHandler, type SSEEventData, ScatterChart, type SpinnerStatus, SqlContent, type SqlContentProps, type Status, type StatusEvent, StatusSpinner, type StatusSpinnerProps, StderrText, StdoutText, StdwarnText, type Step, StepInvocation, type StepInvocationProps, StepInvocationStatus, type StepInvocationStatusProps, TableContent, type TableContentProps, TextContent, type TextContentProps, ThinkingContent, type ThinkingContentProps, ToolGroupContent, type ToolGroupContentProps, type UseInvocationOptions, type UseInvocationReturn, WebParseContent, type WebParseContentProps, WebSearchContent, type WebSearchContentProps, type WrapperType, cn, formatValue, handleIncrementalMixedJsonParsing, handleSSEEvent, isJsonLike, isParsingComplete, isParsingInProgress, isWhitespaceChar, parseCompleteJson, parseMixedJson, parseToDate, resolveKeyFromData, toSnakeCase, useChartZoom, useDatasetContents, useErdoConfig, useErdoConfigOptional, useInvocation, useMultipleDatasetContents };
|
|
1316
|
+
export { BarChart, type BaseChartProps, type BotInvocation, BotInvocationContent, type BotInvocationContentData, type BotInvocationContentProps, type BotInvocationData, type BotInvocationEventInfo, type BotInvocationStatusInfo, Chart, type ChartConfig, ChartContainer, ChartContent, type ChartContentProps, ChartLegend, ChartLegendContent, ChartStyle, ChartTooltip, ChartTooltipContent, CodeexecContent, type CodeexecContentProps, CodegenContent, type CodegenContentProps, CollapsibleCodeBlock, type CollapsibleCodeBlockProps, Content, type ContentChartConfig, type ContentChunk, type ContentComponentProps, type ContentProps, type ContentType, type DataFetcher, DatasetChart, type DatasetChartProps, DatasetTable, type DatasetTableProps, type Entity, type EntityType, ErdoProvider, type ErdoProviderConfig, type ErdoProviderProps, ErdoUI, type ErdoUIProps, ErrorBoundary, ExecutionStatus, ExpandableOutputContent, type ExpandableOutputContentProps, HeatmapChart, InvocationEvent, type InvocationEventProps, InvocationEvents, type InvocationEventsProps, InvocationStatus, JSONStreamParser, type JSONValue, JsonContent, type JsonContentProps, LineChart, Log, LogContent, type LogContentProps, type LogProps, MarkdownContent, type MarkdownContentProps, type Message, type MessageContent, type MessageStreamingState, type MessageWithContents, Output, type OutputContent, type OutputProps, type OutputWithContents, PieChart, type ResolvedBotInvocation, type ResultHandler, type SSEEventData, ScatterChart, type SpinnerStatus, SqlContent, type SqlContentProps, type Status, type StatusEvent, StatusSpinner, type StatusSpinnerProps, StderrText, StdoutText, StdwarnText, type Step, StepInvocation, type StepInvocationProps, StepInvocationStatus, type StepInvocationStatusProps, TableContent, type TableContentProps, TextContent, type TextContentProps, ThinkingContent, type ThinkingContentProps, ToolGroupContent, type ToolGroupContentProps, type UseInvocationOptions, type UseInvocationReturn, WebParseContent, type WebParseContentProps, WebSearchContent, type WebSearchContentProps, type WrapperType, cn, extractContentItems, formatValue, handleIncrementalMixedJsonParsing, handleSSEEvent, isJsonLike, isParsingComplete, isParsingInProgress, isWhitespaceChar, parseCompleteJson, parseMixedJson, parseToDate, resolveKeyFromData, toSnakeCase, useChartZoom, useDatasetContents, useErdoConfig, useErdoConfigOptional, useInvocation, useMultipleDatasetContents };
|