@erdoai/ui 0.1.5 → 0.1.9
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/README.md +77 -39
- package/dist/index.d.ts +296 -53
- package/dist/index.js +26 -4043
- package/package.json +6 -1
package/README.md
CHANGED
|
@@ -18,16 +18,13 @@ npm install react react-dom @tanstack/react-query
|
|
|
18
18
|
|
|
19
19
|
### 1. Set up the Provider
|
|
20
20
|
|
|
21
|
+
**Important**: Never expose your API key to the browser. Keep it server-side only.
|
|
22
|
+
|
|
21
23
|
```tsx
|
|
22
24
|
import { ErdoProvider } from '@erdoai/ui';
|
|
23
|
-
import { ErdoClient } from '@erdoai/server';
|
|
24
25
|
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
|
|
25
26
|
|
|
26
27
|
const queryClient = new QueryClient();
|
|
27
|
-
const erdoClient = new ErdoClient({
|
|
28
|
-
endpoint: 'https://api.erdo.ai',
|
|
29
|
-
authToken: process.env.ERDO_API_KEY,
|
|
30
|
-
});
|
|
31
28
|
|
|
32
29
|
function App() {
|
|
33
30
|
return (
|
|
@@ -35,7 +32,7 @@ function App() {
|
|
|
35
32
|
<ErdoProvider
|
|
36
33
|
config={{
|
|
37
34
|
baseUrl: 'https://api.erdo.ai',
|
|
38
|
-
|
|
35
|
+
sessionToken: 'user-session-token', // Short-lived token from your server
|
|
39
36
|
}}
|
|
40
37
|
>
|
|
41
38
|
<YourApp />
|
|
@@ -45,32 +42,72 @@ function App() {
|
|
|
45
42
|
}
|
|
46
43
|
```
|
|
47
44
|
|
|
48
|
-
### 2. Invoke Agents and Render Results
|
|
45
|
+
### 2. Invoke Agents (Server-Side) and Render Results
|
|
46
|
+
|
|
47
|
+
Agent invocations must happen on your server to keep your API key secret:
|
|
49
48
|
|
|
50
49
|
```tsx
|
|
51
|
-
|
|
50
|
+
// app/api/analyze/route.ts (SERVER SIDE)
|
|
51
|
+
import { ErdoClient } from '@erdoai/server';
|
|
52
52
|
|
|
53
|
-
|
|
54
|
-
|
|
53
|
+
const client = new ErdoClient({
|
|
54
|
+
authToken: process.env.ERDO_API_KEY, // Secret - never exposed to browser
|
|
55
|
+
});
|
|
55
56
|
|
|
56
|
-
|
|
57
|
-
|
|
57
|
+
export async function POST(request: Request) {
|
|
58
|
+
const { query } = await request.json();
|
|
59
|
+
|
|
60
|
+
const encoder = new TextEncoder();
|
|
61
|
+
const stream = new ReadableStream({
|
|
62
|
+
async start(controller) {
|
|
63
|
+
for await (const event of client.invokeStream('data-analyst', {
|
|
64
|
+
messages: [{ role: 'user', content: query }],
|
|
65
|
+
})) {
|
|
66
|
+
controller.enqueue(encoder.encode(`data: ${JSON.stringify(event)}\n\n`));
|
|
67
|
+
}
|
|
68
|
+
controller.close();
|
|
69
|
+
},
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
return new Response(stream, {
|
|
73
|
+
headers: { 'Content-Type': 'text/event-stream' },
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
```tsx
|
|
79
|
+
// components/chat-interface.tsx (CLIENT SIDE)
|
|
80
|
+
import { useState } from 'react';
|
|
81
|
+
import { Content, type ContentItem } from '@erdoai/ui';
|
|
82
|
+
|
|
83
|
+
function ChatInterface() {
|
|
84
|
+
const [contents, setContents] = useState<ContentItem[]>([]);
|
|
85
|
+
const [isLoading, setIsLoading] = useState(false);
|
|
86
|
+
|
|
87
|
+
const handleSubmit = async (e: React.FormEvent<HTMLFormElement>) => {
|
|
88
|
+
e.preventDefault();
|
|
89
|
+
const query = new FormData(e.currentTarget).get('query') as string;
|
|
90
|
+
setIsLoading(true);
|
|
91
|
+
|
|
92
|
+
const response = await fetch('/api/analyze', {
|
|
93
|
+
method: 'POST',
|
|
94
|
+
body: JSON.stringify({ query }),
|
|
95
|
+
});
|
|
96
|
+
// Parse SSE stream and update contents...
|
|
97
|
+
setIsLoading(false);
|
|
58
98
|
};
|
|
59
99
|
|
|
60
100
|
return (
|
|
61
101
|
<div>
|
|
62
|
-
<form onSubmit={
|
|
63
|
-
e.preventDefault();
|
|
64
|
-
handleSubmit(e.target.query.value);
|
|
65
|
-
}}>
|
|
102
|
+
<form onSubmit={handleSubmit}>
|
|
66
103
|
<input name="query" placeholder="Ask a question..." />
|
|
67
|
-
<button type="submit" disabled={
|
|
68
|
-
{
|
|
104
|
+
<button type="submit" disabled={isLoading}>
|
|
105
|
+
{isLoading ? 'Analyzing...' : 'Send'}
|
|
69
106
|
</button>
|
|
70
107
|
</form>
|
|
71
108
|
|
|
72
|
-
{
|
|
73
|
-
<Content key={content.id}
|
|
109
|
+
{contents.map((content) => (
|
|
110
|
+
<Content key={content.id} content={content} />
|
|
74
111
|
))}
|
|
75
112
|
</div>
|
|
76
113
|
);
|
|
@@ -86,9 +123,20 @@ Automatically renders the appropriate component based on content type:
|
|
|
86
123
|
```tsx
|
|
87
124
|
import { Content } from '@erdoai/ui';
|
|
88
125
|
|
|
89
|
-
<Content
|
|
126
|
+
<Content content={contentItem} />
|
|
127
|
+
|
|
128
|
+
// Override specific content type renderers
|
|
129
|
+
<Content
|
|
130
|
+
content={contentItem}
|
|
131
|
+
components={{
|
|
132
|
+
'bot_invocation': MyBotInvocationComponent,
|
|
133
|
+
'my_custom_type': MyCustomRenderer,
|
|
134
|
+
}}
|
|
135
|
+
/>
|
|
90
136
|
```
|
|
91
137
|
|
|
138
|
+
The `components` prop lets you override how specific content types are rendered. The component receives `{ content, className }` props.
|
|
139
|
+
|
|
92
140
|
### Individual Renderers
|
|
93
141
|
|
|
94
142
|
```tsx
|
|
@@ -234,41 +282,31 @@ const { zoomDomain, setZoomDomain, resetZoom } = useChartZoom();
|
|
|
234
282
|
|
|
235
283
|
## Provider Configuration
|
|
236
284
|
|
|
237
|
-
|
|
285
|
+
> **Security**: Never use `authToken` on the client side. Your API key must stay server-side only.
|
|
238
286
|
|
|
239
|
-
|
|
240
|
-
<ErdoProvider
|
|
241
|
-
config={{
|
|
242
|
-
baseUrl: 'https://api.erdo.ai',
|
|
243
|
-
authToken: 'your-api-key',
|
|
244
|
-
}}
|
|
245
|
-
>
|
|
246
|
-
```
|
|
287
|
+
### With Session Token (Recommended for B2B2C)
|
|
247
288
|
|
|
248
|
-
|
|
289
|
+
Session tokens are short-lived tokens created by your server for end users:
|
|
249
290
|
|
|
250
291
|
```tsx
|
|
251
|
-
import { ErdoClient } from '@erdoai/server';
|
|
252
|
-
|
|
253
|
-
const client = new ErdoClient({ authToken: 'your-api-key' });
|
|
254
|
-
|
|
255
292
|
<ErdoProvider
|
|
256
293
|
config={{
|
|
257
294
|
baseUrl: 'https://api.erdo.ai',
|
|
258
|
-
|
|
295
|
+
sessionToken: userSessionToken, // Created by your server
|
|
259
296
|
}}
|
|
260
297
|
>
|
|
261
298
|
```
|
|
262
299
|
|
|
263
300
|
### Custom Data Fetcher
|
|
264
301
|
|
|
265
|
-
For custom backends or
|
|
302
|
+
For custom backends or when proxying through your server:
|
|
266
303
|
|
|
267
304
|
```tsx
|
|
268
305
|
const customFetcher = {
|
|
269
306
|
fetchDatasetContents: async (slug, invocationId) => {
|
|
270
|
-
|
|
271
|
-
|
|
307
|
+
// Fetch through your server which adds authentication
|
|
308
|
+
const response = await fetch(`/api/datasets/${slug}?invocationId=${invocationId}`);
|
|
309
|
+
return response.json();
|
|
272
310
|
},
|
|
273
311
|
};
|
|
274
312
|
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import React__default from 'react';
|
|
4
|
-
import { ErdoClient, ContentItem, SSEEvent, InvokeResult, InvokeParams } from '@erdoai/types';
|
|
4
|
+
import { ErdoClient, ContentItem, LogEntry, ToolGroup, InvocationStatus as InvocationStatus$1, SSEEvent, InvokeResult, 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';
|
|
@@ -280,6 +280,100 @@ declare class ErrorBoundary extends React__default.Component<{
|
|
|
280
280
|
render(): React__default.ReactNode;
|
|
281
281
|
}
|
|
282
282
|
|
|
283
|
+
/** Props passed to all content components */
|
|
284
|
+
interface ContentComponentProps {
|
|
285
|
+
content: ContentItem;
|
|
286
|
+
className?: string;
|
|
287
|
+
}
|
|
288
|
+
interface ContentProps {
|
|
289
|
+
content: ContentItem;
|
|
290
|
+
className?: string;
|
|
291
|
+
/**
|
|
292
|
+
* Override renderers for specific content types.
|
|
293
|
+
* Key is the content_type or ui_content_type string.
|
|
294
|
+
* Component receives { content, className, ...otherProps } props.
|
|
295
|
+
* Components can accept additional props beyond ContentComponentProps.
|
|
296
|
+
*
|
|
297
|
+
* @example
|
|
298
|
+
* ```tsx
|
|
299
|
+
* <Content
|
|
300
|
+
* content={contentItem}
|
|
301
|
+
* components={{
|
|
302
|
+
* 'bot_invocation': MyBotInvocation,
|
|
303
|
+
* 'authorize_integration': AuthorizeIntegration,
|
|
304
|
+
* 'my_custom_type': MyCustomRenderer,
|
|
305
|
+
* }}
|
|
306
|
+
* />
|
|
307
|
+
* ```
|
|
308
|
+
*/
|
|
309
|
+
components?: Record<string, React__default.ComponentType<any>>;
|
|
310
|
+
}
|
|
311
|
+
/**
|
|
312
|
+
* Routes content to the appropriate renderer based on content_type and ui_content_type.
|
|
313
|
+
*
|
|
314
|
+
* This is the main entry point for rendering content items from Erdo bot invocations.
|
|
315
|
+
* It checks for custom component overrides first, then falls back to built-in renderers.
|
|
316
|
+
*
|
|
317
|
+
* @example
|
|
318
|
+
* ```tsx
|
|
319
|
+
* // Basic usage - uses built-in renderers
|
|
320
|
+
* <Content content={contentItem} />
|
|
321
|
+
*
|
|
322
|
+
* // With custom overrides
|
|
323
|
+
* <Content
|
|
324
|
+
* content={contentItem}
|
|
325
|
+
* components={{
|
|
326
|
+
* 'bot_invocation': MyBotInvocation,
|
|
327
|
+
* 'authorize_integration': AuthorizeIntegration,
|
|
328
|
+
* }}
|
|
329
|
+
* />
|
|
330
|
+
* ```
|
|
331
|
+
*/
|
|
332
|
+
declare function Content({ content, className, components }: ContentProps): react_jsx_runtime.JSX.Element | null;
|
|
333
|
+
|
|
334
|
+
interface TextContentProps {
|
|
335
|
+
content: string;
|
|
336
|
+
className?: string;
|
|
337
|
+
}
|
|
338
|
+
declare function TextContent({ content, className }: TextContentProps): react_jsx_runtime.JSX.Element | null;
|
|
339
|
+
|
|
340
|
+
interface JsonContentProps {
|
|
341
|
+
content: unknown;
|
|
342
|
+
className?: string;
|
|
343
|
+
}
|
|
344
|
+
declare function JsonContent({ content, className }: JsonContentProps): react_jsx_runtime.JSX.Element | null;
|
|
345
|
+
|
|
346
|
+
interface MarkdownContentProps {
|
|
347
|
+
/** The markdown content to render */
|
|
348
|
+
content: string;
|
|
349
|
+
/** Additional CSS class names */
|
|
350
|
+
className?: string;
|
|
351
|
+
}
|
|
352
|
+
/**
|
|
353
|
+
* Renders markdown content with GitHub Flavored Markdown support.
|
|
354
|
+
*
|
|
355
|
+
* @example
|
|
356
|
+
* ```tsx
|
|
357
|
+
* <MarkdownContent content="# Hello\n\nThis is **bold** text." />
|
|
358
|
+
* ```
|
|
359
|
+
*/
|
|
360
|
+
declare function MarkdownContent({ content, className }: MarkdownContentProps): react_jsx_runtime.JSX.Element | null;
|
|
361
|
+
|
|
362
|
+
interface TableColumn {
|
|
363
|
+
column_name: string;
|
|
364
|
+
key: string;
|
|
365
|
+
format?: string;
|
|
366
|
+
value_type?: 'number' | 'category' | 'date';
|
|
367
|
+
}
|
|
368
|
+
interface TableContentProps {
|
|
369
|
+
title?: string;
|
|
370
|
+
columns: TableColumn[];
|
|
371
|
+
data: any[];
|
|
372
|
+
className?: string;
|
|
373
|
+
maxRows?: number;
|
|
374
|
+
}
|
|
375
|
+
declare function TableContent({ title, columns, data, className, maxRows }: TableContentProps): react_jsx_runtime.JSX.Element;
|
|
376
|
+
|
|
283
377
|
interface Axis {
|
|
284
378
|
axis_label: string;
|
|
285
379
|
key: string;
|
|
@@ -325,78 +419,227 @@ interface ChartContentProps {
|
|
|
325
419
|
}
|
|
326
420
|
declare function ChartContent({ config, data, className }: ChartContentProps): react_jsx_runtime.JSX.Element;
|
|
327
421
|
|
|
328
|
-
interface
|
|
422
|
+
interface ThinkingContentProps {
|
|
329
423
|
item: ContentItem;
|
|
330
424
|
className?: string;
|
|
331
|
-
components?: Partial<{
|
|
332
|
-
text: React__default.ComponentType<{
|
|
333
|
-
content: string;
|
|
334
|
-
className?: string;
|
|
335
|
-
}>;
|
|
336
|
-
json: React__default.ComponentType<{
|
|
337
|
-
content: string | object;
|
|
338
|
-
className?: string;
|
|
339
|
-
}>;
|
|
340
|
-
chart: React__default.ComponentType<{
|
|
341
|
-
config: ContentChartConfig;
|
|
342
|
-
data: any[];
|
|
343
|
-
className?: string;
|
|
344
|
-
}>;
|
|
345
|
-
table: React__default.ComponentType<{
|
|
346
|
-
title?: string;
|
|
347
|
-
columns: any[];
|
|
348
|
-
data: any[];
|
|
349
|
-
className?: string;
|
|
350
|
-
}>;
|
|
351
|
-
}>;
|
|
352
425
|
}
|
|
353
426
|
/**
|
|
354
|
-
*
|
|
427
|
+
* Renders Claude's thinking/reasoning content in a collapsible panel.
|
|
428
|
+
* Handles both regular thinking and redacted (encrypted) thinking.
|
|
355
429
|
*/
|
|
356
|
-
declare function
|
|
430
|
+
declare function ThinkingContent({ item, className }: ThinkingContentProps): react_jsx_runtime.JSX.Element;
|
|
357
431
|
|
|
358
|
-
interface
|
|
359
|
-
|
|
432
|
+
interface LogContentProps {
|
|
433
|
+
item: ContentItem;
|
|
360
434
|
className?: string;
|
|
361
435
|
}
|
|
362
|
-
|
|
436
|
+
interface LogProps {
|
|
437
|
+
log: LogEntry;
|
|
438
|
+
}
|
|
439
|
+
declare function Log({ log }: LogProps): react_jsx_runtime.JSX.Element;
|
|
440
|
+
/**
|
|
441
|
+
* Renders log entries with level-based styling (info, error, requires_info).
|
|
442
|
+
*/
|
|
443
|
+
declare function LogContent({ item, className }: LogContentProps): react_jsx_runtime.JSX.Element;
|
|
363
444
|
|
|
364
|
-
interface
|
|
365
|
-
|
|
445
|
+
interface WebSearchContentProps {
|
|
446
|
+
item: ContentItem;
|
|
366
447
|
className?: string;
|
|
367
448
|
}
|
|
368
|
-
|
|
449
|
+
/**
|
|
450
|
+
* Renders web search results as a list of clickable cards.
|
|
451
|
+
*/
|
|
452
|
+
declare function WebSearchContent({ item, className }: WebSearchContentProps): react_jsx_runtime.JSX.Element | null;
|
|
369
453
|
|
|
370
|
-
interface
|
|
371
|
-
|
|
372
|
-
text: string;
|
|
373
|
-
/** Additional CSS class names */
|
|
454
|
+
interface WebParseContentProps {
|
|
455
|
+
item: ContentItem;
|
|
374
456
|
className?: string;
|
|
375
457
|
}
|
|
376
458
|
/**
|
|
377
|
-
* Renders
|
|
378
|
-
*
|
|
379
|
-
* @example
|
|
380
|
-
* ```tsx
|
|
381
|
-
* <MarkdownContent text="# Hello\n\nThis is **bold** text." />
|
|
382
|
-
* ```
|
|
459
|
+
* Renders parsed web page content with title, description, and markdown body.
|
|
383
460
|
*/
|
|
384
|
-
declare function
|
|
461
|
+
declare function WebParseContent({ item, className }: WebParseContentProps): react_jsx_runtime.JSX.Element | null;
|
|
385
462
|
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
463
|
+
type WrapperType = 'standard' | 'info' | 'warning';
|
|
464
|
+
interface ExpandableOutputContentProps {
|
|
465
|
+
children: React__default.ReactNode;
|
|
466
|
+
defaultOpen?: boolean;
|
|
467
|
+
wrapperType?: WrapperType;
|
|
468
|
+
compact?: boolean;
|
|
469
|
+
className?: string;
|
|
391
470
|
}
|
|
392
|
-
|
|
471
|
+
/**
|
|
472
|
+
* An expandable container for code output with max-height and scroll.
|
|
473
|
+
*/
|
|
474
|
+
declare function ExpandableOutputContent({ children, defaultOpen, wrapperType, compact, className, }: ExpandableOutputContentProps): react_jsx_runtime.JSX.Element;
|
|
475
|
+
interface OutputLineProps {
|
|
476
|
+
children: React__default.ReactNode;
|
|
477
|
+
timestamp?: string;
|
|
478
|
+
}
|
|
479
|
+
/**
|
|
480
|
+
* Standard output text line with optional timestamp.
|
|
481
|
+
*/
|
|
482
|
+
declare function StdoutText({ children, timestamp }: OutputLineProps): react_jsx_runtime.JSX.Element;
|
|
483
|
+
/**
|
|
484
|
+
* Error/stderr output text line with info styling.
|
|
485
|
+
*/
|
|
486
|
+
declare function StderrText({ children, timestamp }: OutputLineProps): react_jsx_runtime.JSX.Element;
|
|
487
|
+
/**
|
|
488
|
+
* Warning output text line with warning styling.
|
|
489
|
+
*/
|
|
490
|
+
declare function StdwarnText({ children, timestamp }: OutputLineProps): react_jsx_runtime.JSX.Element;
|
|
491
|
+
|
|
492
|
+
interface CollapsibleCodeBlockProps {
|
|
493
|
+
language: string;
|
|
494
|
+
value: string;
|
|
495
|
+
defaultOpen?: boolean;
|
|
393
496
|
title?: string;
|
|
394
|
-
|
|
395
|
-
data: any[];
|
|
497
|
+
closeTitle?: string;
|
|
396
498
|
className?: string;
|
|
397
|
-
|
|
499
|
+
/** Theme: 'dark' | 'light' | 'auto'. Auto uses prefers-color-scheme. Default: 'auto' */
|
|
500
|
+
theme?: 'dark' | 'light' | 'auto';
|
|
398
501
|
}
|
|
399
|
-
|
|
502
|
+
/**
|
|
503
|
+
* A collapsible code block with syntax highlighting.
|
|
504
|
+
*/
|
|
505
|
+
declare function CollapsibleCodeBlock({ language, value, defaultOpen, title, closeTitle, className, theme, }: CollapsibleCodeBlockProps): react_jsx_runtime.JSX.Element;
|
|
506
|
+
|
|
507
|
+
interface SqlContentProps {
|
|
508
|
+
item: ContentItem;
|
|
509
|
+
className?: string;
|
|
510
|
+
}
|
|
511
|
+
/**
|
|
512
|
+
* Renders SQL generation content with thinking text and collapsible SQL code.
|
|
513
|
+
*/
|
|
514
|
+
declare function SqlContent({ item, className }: SqlContentProps): react_jsx_runtime.JSX.Element | null;
|
|
515
|
+
|
|
516
|
+
interface CodegenContentProps {
|
|
517
|
+
item: ContentItem;
|
|
518
|
+
className?: string;
|
|
519
|
+
}
|
|
520
|
+
/**
|
|
521
|
+
* Renders code generation content with step-by-step explanation, code, and warnings.
|
|
522
|
+
*/
|
|
523
|
+
declare function CodegenContent({ item, className }: CodegenContentProps): react_jsx_runtime.JSX.Element | null;
|
|
524
|
+
|
|
525
|
+
interface CodeexecContentProps {
|
|
526
|
+
item: ContentItem;
|
|
527
|
+
className?: string;
|
|
528
|
+
}
|
|
529
|
+
/**
|
|
530
|
+
* Renders code execution output (stdout, stderr, warnings).
|
|
531
|
+
*/
|
|
532
|
+
declare function CodeexecContent({ item, className }: CodeexecContentProps): react_jsx_runtime.JSX.Element | null;
|
|
533
|
+
|
|
534
|
+
interface ToolGroupContentProps {
|
|
535
|
+
/** The tool group data */
|
|
536
|
+
toolGroup: ToolGroup;
|
|
537
|
+
/** Optional Content component for rendering nested results (avoids circular imports) */
|
|
538
|
+
ContentComponent?: React__default.ComponentType<{
|
|
539
|
+
content: ContentItem;
|
|
540
|
+
className?: string;
|
|
541
|
+
}>;
|
|
542
|
+
className?: string;
|
|
543
|
+
}
|
|
544
|
+
/**
|
|
545
|
+
* Renders tool invocations and their results in a collapsible format.
|
|
546
|
+
*/
|
|
547
|
+
declare function ToolGroupContent({ toolGroup, ContentComponent, className, }: ToolGroupContentProps): react_jsx_runtime.JSX.Element;
|
|
548
|
+
|
|
549
|
+
/** Content data for a bot invocation (passed in ContentItem.content) */
|
|
550
|
+
interface BotInvocationContentData {
|
|
551
|
+
/** Unique invocation ID */
|
|
552
|
+
invocation_id: string;
|
|
553
|
+
/** Bot ID */
|
|
554
|
+
bot_id: string;
|
|
555
|
+
/** Bot display name */
|
|
556
|
+
bot_name: string;
|
|
557
|
+
/** Whether this invocation is transparent (embedded) */
|
|
558
|
+
transparent?: boolean;
|
|
559
|
+
}
|
|
560
|
+
/** Status information for a bot invocation */
|
|
561
|
+
interface BotInvocationStatusInfo {
|
|
562
|
+
/** Current status of the invocation */
|
|
563
|
+
status: InvocationStatus$1 | string;
|
|
564
|
+
/** Optional status message */
|
|
565
|
+
message?: string | {
|
|
566
|
+
Valid: boolean;
|
|
567
|
+
String: string;
|
|
568
|
+
};
|
|
569
|
+
}
|
|
570
|
+
/** Event within a bot invocation */
|
|
571
|
+
interface BotInvocationEventInfo {
|
|
572
|
+
/** Unique event ID */
|
|
573
|
+
id: string;
|
|
574
|
+
/** Event type (output, step, etc.) */
|
|
575
|
+
type: string;
|
|
576
|
+
/** When the event was created */
|
|
577
|
+
created_at?: string;
|
|
578
|
+
/** Event data - structure depends on type */
|
|
579
|
+
data?: unknown;
|
|
580
|
+
}
|
|
581
|
+
/** Resolved bot invocation with status and events */
|
|
582
|
+
interface ResolvedBotInvocation {
|
|
583
|
+
/** Current status of the invocation */
|
|
584
|
+
currentStatus?: BotInvocationStatusInfo | null;
|
|
585
|
+
/** Map of events by ID */
|
|
586
|
+
eventsByID?: Record<string, BotInvocationEventInfo>;
|
|
587
|
+
/** Additional invocation details */
|
|
588
|
+
[key: string]: unknown;
|
|
589
|
+
}
|
|
590
|
+
interface BotInvocationContentProps {
|
|
591
|
+
/** The content data containing invocation_id, bot_id, bot_name */
|
|
592
|
+
content: BotInvocationContentData;
|
|
593
|
+
/** Resolved bot invocation data with events and status */
|
|
594
|
+
botInvocation?: ResolvedBotInvocation | null;
|
|
595
|
+
/** Whether the invocation is still loading */
|
|
596
|
+
isLoading?: boolean;
|
|
597
|
+
/** Whether this should be open by default */
|
|
598
|
+
defaultOpen?: boolean;
|
|
599
|
+
/** Optional admin link href (e.g., to agent designer) */
|
|
600
|
+
adminLinkHref?: string;
|
|
601
|
+
/** Optional admin link text */
|
|
602
|
+
adminLinkText?: string;
|
|
603
|
+
/** Whether to show the admin link */
|
|
604
|
+
showAdminLink?: boolean;
|
|
605
|
+
/** Callback when admin link is clicked */
|
|
606
|
+
onAdminClick?: (invocationId: string, botId: string) => void;
|
|
607
|
+
/** Callback when invocation is expanded */
|
|
608
|
+
onExpand?: (invocationId: string, botId: string, botName: string) => void;
|
|
609
|
+
/** Component for rendering nested events */
|
|
610
|
+
EventsComponent?: React__default.ComponentType<{
|
|
611
|
+
eventsByID: Record<string, BotInvocationEventInfo>;
|
|
612
|
+
defaultOpen?: boolean;
|
|
613
|
+
}>;
|
|
614
|
+
/** Component for rendering individual content items */
|
|
615
|
+
ContentComponent?: React__default.ComponentType<{
|
|
616
|
+
content: ContentItem;
|
|
617
|
+
className?: string;
|
|
618
|
+
}>;
|
|
619
|
+
className?: string;
|
|
620
|
+
}
|
|
621
|
+
/**
|
|
622
|
+
* Renders a bot invocation with status, collapsible events, and optional admin link.
|
|
623
|
+
*
|
|
624
|
+
* This component is designed to receive already-processed invocation data.
|
|
625
|
+
* Data fetching should be handled by the consuming application.
|
|
626
|
+
*/
|
|
627
|
+
declare function BotInvocationContent({ content, botInvocation, isLoading, defaultOpen, adminLinkHref, adminLinkText, showAdminLink, onAdminClick, onExpand, EventsComponent, ContentComponent: _ContentComponent, className, }: BotInvocationContentProps): react_jsx_runtime.JSX.Element | null;
|
|
628
|
+
|
|
629
|
+
type SpinnerStatus = 'loading' | 'finished' | 'failed';
|
|
630
|
+
interface StatusSpinnerProps {
|
|
631
|
+
status: SpinnerStatus;
|
|
632
|
+
/** Icon color - if not provided, auto-detects from theme (white for dark, black for light) */
|
|
633
|
+
color?: string;
|
|
634
|
+
/** Size in pixels - defaults to 16 */
|
|
635
|
+
size?: number;
|
|
636
|
+
className?: string;
|
|
637
|
+
}
|
|
638
|
+
/**
|
|
639
|
+
* Animated status spinner using Lordicon/Lottie animations.
|
|
640
|
+
* Shows a spinning loader when loading, checkmark when finished, and alert when failed.
|
|
641
|
+
*/
|
|
642
|
+
declare function StatusSpinner({ status, color, size, className }: StatusSpinnerProps): react_jsx_runtime.JSX.Element;
|
|
400
643
|
|
|
401
644
|
interface ZoomState {
|
|
402
645
|
refAreaLeft: number | null;
|
|
@@ -928,4 +1171,4 @@ declare function handleIncrementalMixedJsonParsing(outputContent: MessageContent
|
|
|
928
1171
|
*/
|
|
929
1172
|
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;
|
|
930
1173
|
|
|
931
|
-
export { BarChart, type BaseChartProps, type BotInvocation, type BotInvocationData, Chart, type ChartConfig, ChartContainer, ChartContent, type ChartContentProps, ChartLegend, ChartLegendContent, ChartStyle, ChartTooltip, ChartTooltipContent, Content, type ContentChartConfig, type ContentChunk, type ContentProps, type ContentType, type DataFetcher, DatasetChart, type DatasetChartProps, type Entity, type EntityType, ErdoProvider, type ErdoProviderConfig, type ErdoProviderProps, ErrorBoundary, ExecutionStatus, HeatmapChart, type InvocationEvent, InvocationStatus, JSONStreamParser, type JSONValue, JsonContent, type JsonContentProps, LineChart, MarkdownContent, type MarkdownContentProps, type Message, type MessageContent, type MessageStreamingState, type MessageWithContents, type Output, type OutputContent, type OutputWithContents, PieChart, type ResultHandler, type SSEEventData, ScatterChart, type Status, type StatusEvent, type Step, TableContent, type TableContentProps, TextContent, type TextContentProps, type UseInvocationOptions, type UseInvocationReturn, cn, formatValue, handleIncrementalMixedJsonParsing, handleSSEEvent, isJsonLike, isParsingComplete, isParsingInProgress, isWhitespaceChar, parseCompleteJson, parseMixedJson, parseToDate, resolveKeyFromData, toSnakeCase, useChartZoom, useDatasetContents, useErdoConfig, useErdoConfigOptional, useInvocation, useMultipleDatasetContents };
|
|
1174
|
+
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, type Entity, type EntityType, ErdoProvider, type ErdoProviderConfig, type ErdoProviderProps, ErrorBoundary, ExecutionStatus, ExpandableOutputContent, type ExpandableOutputContentProps, HeatmapChart, type InvocationEvent, 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, type Output, type OutputContent, 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, 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 };
|