@axiom-lattice/react-sdk 2.0.2 → 2.0.4
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 +27 -0
- package/dist/index.d.mts +28 -1
- package/dist/index.d.ts +28 -1
- package/dist/index.js +384 -103
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +386 -92
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -333,6 +333,33 @@ function AgentGraph() {
|
|
|
333
333
|
}
|
|
334
334
|
```
|
|
335
335
|
|
|
336
|
+
### File Explorer Component
|
|
337
|
+
|
|
338
|
+
Use the `FileExplorer` component to display and explore files from the agent state:
|
|
339
|
+
|
|
340
|
+
```tsx
|
|
341
|
+
import { FileExplorer, useChat } from "@axiom-lattice/react-sdk";
|
|
342
|
+
|
|
343
|
+
function AgentFiles({ threadId }) {
|
|
344
|
+
// Ensure enableReturnStateWhenStreamCompleted is true to get the agent state
|
|
345
|
+
const { agentState } = useChat(threadId, {
|
|
346
|
+
streaming: true,
|
|
347
|
+
enableReturnStateWhenStreamCompleted: true,
|
|
348
|
+
});
|
|
349
|
+
|
|
350
|
+
// Extract files from agent state values
|
|
351
|
+
// Assuming agent returns files in agentState.values.files
|
|
352
|
+
const files = agentState?.values?.files || [];
|
|
353
|
+
|
|
354
|
+
return (
|
|
355
|
+
<div style={{ height: "500px" }}>
|
|
356
|
+
<h3>Agent Files</h3>
|
|
357
|
+
<FileExplorer files={files} />
|
|
358
|
+
</div>
|
|
359
|
+
);
|
|
360
|
+
}
|
|
361
|
+
```
|
|
362
|
+
|
|
336
363
|
## Complete Example
|
|
337
364
|
|
|
338
365
|
See the `examples` directory for a complete example of a chat application using the React SDK.
|
package/dist/index.d.mts
CHANGED
|
@@ -72,6 +72,10 @@ interface AgentState {
|
|
|
72
72
|
* Chat hook state
|
|
73
73
|
*/
|
|
74
74
|
interface ChatState {
|
|
75
|
+
todos?: Array<{
|
|
76
|
+
content: string;
|
|
77
|
+
status: "pending" | "in_progress" | "completed";
|
|
78
|
+
}>;
|
|
75
79
|
/**
|
|
76
80
|
* Array of messages in the chat
|
|
77
81
|
*/
|
|
@@ -258,6 +262,7 @@ declare function useChat<T extends UseChatOptions>(threadId: string | null, opti
|
|
|
258
262
|
stopStreaming: () => void;
|
|
259
263
|
loadMessages: (limit?: number) => Promise<void>;
|
|
260
264
|
clearMessages: () => void;
|
|
265
|
+
clearError: () => void;
|
|
261
266
|
};
|
|
262
267
|
|
|
263
268
|
/**
|
|
@@ -353,12 +358,18 @@ declare const elements: Record<string, ElementMeta>;
|
|
|
353
358
|
declare const getElement: (language: string | undefined) => ElementMeta | null;
|
|
354
359
|
declare const regsiterElement: (language: string, ElementMeta: ElementMeta) => ElementMeta;
|
|
355
360
|
|
|
361
|
+
interface TodoItem {
|
|
362
|
+
content: string;
|
|
363
|
+
status: "completed" | "in_progress" | "pending";
|
|
364
|
+
}
|
|
365
|
+
|
|
356
366
|
interface ChatingProps {
|
|
357
367
|
name?: string;
|
|
358
368
|
description?: string;
|
|
359
369
|
tenant_id: string;
|
|
360
370
|
messages: any[];
|
|
361
371
|
isLoading: boolean;
|
|
372
|
+
error?: Error | null;
|
|
362
373
|
sendMessage: (params: any) => void;
|
|
363
374
|
stopStreaming: () => void;
|
|
364
375
|
default_submit_message?: string;
|
|
@@ -367,6 +378,7 @@ interface ChatingProps {
|
|
|
367
378
|
uploadAction?: string;
|
|
368
379
|
onOpenSidePanel: (data: any) => void;
|
|
369
380
|
onReminderClick: () => void;
|
|
381
|
+
onClearError?: () => void;
|
|
370
382
|
styles: any;
|
|
371
383
|
reminderCount: number;
|
|
372
384
|
handleMDResponseEvent: (action: string, data?: any, message?: string, agent?: string) => void;
|
|
@@ -375,6 +387,8 @@ interface ChatingProps {
|
|
|
375
387
|
extraMeta?: Array<{
|
|
376
388
|
id: string;
|
|
377
389
|
}>;
|
|
390
|
+
files?: any[];
|
|
391
|
+
todos?: TodoItem[];
|
|
378
392
|
}
|
|
379
393
|
declare const Chating: React__default.FC<ChatingProps>;
|
|
380
394
|
|
|
@@ -421,4 +435,17 @@ declare const chatContext: React$1.Context<{
|
|
|
421
435
|
eventHandler: (component_key: string, data: any, message: string) => void;
|
|
422
436
|
}>;
|
|
423
437
|
|
|
424
|
-
|
|
438
|
+
interface ExplorerFile {
|
|
439
|
+
name: string;
|
|
440
|
+
content: string;
|
|
441
|
+
language?: string;
|
|
442
|
+
}
|
|
443
|
+
interface FileExplorerProps {
|
|
444
|
+
files?: ExplorerFile[] | Record<string, string>;
|
|
445
|
+
className?: string;
|
|
446
|
+
style?: React__default.CSSProperties;
|
|
447
|
+
title?: string;
|
|
448
|
+
}
|
|
449
|
+
declare const FileExplorer: React__default.FC<FileExplorerProps>;
|
|
450
|
+
|
|
451
|
+
export { type AgentState, type AttachFile, AxiomLatticeProvider, type AxiomLatticeProviderProps, type ChatResponse, type ChatState, type ChatStateWithAgent, Chating, type ClientConfig, type ElementEventHandler, type ElementProps, type ExplorerFile, FileExplorer, type FileExplorerProps, MDMermaid, MDResponse, MDViewFormItem, SideAppViewBrowser, type StreamEventHandlerOptions, ThinkingChain, ThinkingChainGroup, type Thread, type ThreadState, type UIMessage, type UseAgentStateOptions, type UseAgentStateReturn, type UseChatOptions, chatContext, elements, getElement, regsiterElement, useAgentGraph, useAgentState, useAxiomLattice, useChat, useThread };
|
package/dist/index.d.ts
CHANGED
|
@@ -72,6 +72,10 @@ interface AgentState {
|
|
|
72
72
|
* Chat hook state
|
|
73
73
|
*/
|
|
74
74
|
interface ChatState {
|
|
75
|
+
todos?: Array<{
|
|
76
|
+
content: string;
|
|
77
|
+
status: "pending" | "in_progress" | "completed";
|
|
78
|
+
}>;
|
|
75
79
|
/**
|
|
76
80
|
* Array of messages in the chat
|
|
77
81
|
*/
|
|
@@ -258,6 +262,7 @@ declare function useChat<T extends UseChatOptions>(threadId: string | null, opti
|
|
|
258
262
|
stopStreaming: () => void;
|
|
259
263
|
loadMessages: (limit?: number) => Promise<void>;
|
|
260
264
|
clearMessages: () => void;
|
|
265
|
+
clearError: () => void;
|
|
261
266
|
};
|
|
262
267
|
|
|
263
268
|
/**
|
|
@@ -353,12 +358,18 @@ declare const elements: Record<string, ElementMeta>;
|
|
|
353
358
|
declare const getElement: (language: string | undefined) => ElementMeta | null;
|
|
354
359
|
declare const regsiterElement: (language: string, ElementMeta: ElementMeta) => ElementMeta;
|
|
355
360
|
|
|
361
|
+
interface TodoItem {
|
|
362
|
+
content: string;
|
|
363
|
+
status: "completed" | "in_progress" | "pending";
|
|
364
|
+
}
|
|
365
|
+
|
|
356
366
|
interface ChatingProps {
|
|
357
367
|
name?: string;
|
|
358
368
|
description?: string;
|
|
359
369
|
tenant_id: string;
|
|
360
370
|
messages: any[];
|
|
361
371
|
isLoading: boolean;
|
|
372
|
+
error?: Error | null;
|
|
362
373
|
sendMessage: (params: any) => void;
|
|
363
374
|
stopStreaming: () => void;
|
|
364
375
|
default_submit_message?: string;
|
|
@@ -367,6 +378,7 @@ interface ChatingProps {
|
|
|
367
378
|
uploadAction?: string;
|
|
368
379
|
onOpenSidePanel: (data: any) => void;
|
|
369
380
|
onReminderClick: () => void;
|
|
381
|
+
onClearError?: () => void;
|
|
370
382
|
styles: any;
|
|
371
383
|
reminderCount: number;
|
|
372
384
|
handleMDResponseEvent: (action: string, data?: any, message?: string, agent?: string) => void;
|
|
@@ -375,6 +387,8 @@ interface ChatingProps {
|
|
|
375
387
|
extraMeta?: Array<{
|
|
376
388
|
id: string;
|
|
377
389
|
}>;
|
|
390
|
+
files?: any[];
|
|
391
|
+
todos?: TodoItem[];
|
|
378
392
|
}
|
|
379
393
|
declare const Chating: React__default.FC<ChatingProps>;
|
|
380
394
|
|
|
@@ -421,4 +435,17 @@ declare const chatContext: React$1.Context<{
|
|
|
421
435
|
eventHandler: (component_key: string, data: any, message: string) => void;
|
|
422
436
|
}>;
|
|
423
437
|
|
|
424
|
-
|
|
438
|
+
interface ExplorerFile {
|
|
439
|
+
name: string;
|
|
440
|
+
content: string;
|
|
441
|
+
language?: string;
|
|
442
|
+
}
|
|
443
|
+
interface FileExplorerProps {
|
|
444
|
+
files?: ExplorerFile[] | Record<string, string>;
|
|
445
|
+
className?: string;
|
|
446
|
+
style?: React__default.CSSProperties;
|
|
447
|
+
title?: string;
|
|
448
|
+
}
|
|
449
|
+
declare const FileExplorer: React__default.FC<FileExplorerProps>;
|
|
450
|
+
|
|
451
|
+
export { type AgentState, type AttachFile, AxiomLatticeProvider, type AxiomLatticeProviderProps, type ChatResponse, type ChatState, type ChatStateWithAgent, Chating, type ClientConfig, type ElementEventHandler, type ElementProps, type ExplorerFile, FileExplorer, type FileExplorerProps, MDMermaid, MDResponse, MDViewFormItem, SideAppViewBrowser, type StreamEventHandlerOptions, ThinkingChain, ThinkingChainGroup, type Thread, type ThreadState, type UIMessage, type UseAgentStateOptions, type UseAgentStateReturn, type UseChatOptions, chatContext, elements, getElement, regsiterElement, useAgentGraph, useAgentState, useAxiomLattice, useChat, useThread };
|