@axiom-lattice/react-sdk 2.0.3 → 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 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
  */
@@ -354,6 +358,11 @@ declare const elements: Record<string, ElementMeta>;
354
358
  declare const getElement: (language: string | undefined) => ElementMeta | null;
355
359
  declare const regsiterElement: (language: string, ElementMeta: ElementMeta) => ElementMeta;
356
360
 
361
+ interface TodoItem {
362
+ content: string;
363
+ status: "completed" | "in_progress" | "pending";
364
+ }
365
+
357
366
  interface ChatingProps {
358
367
  name?: string;
359
368
  description?: string;
@@ -378,6 +387,8 @@ interface ChatingProps {
378
387
  extraMeta?: Array<{
379
388
  id: string;
380
389
  }>;
390
+ files?: any[];
391
+ todos?: TodoItem[];
381
392
  }
382
393
  declare const Chating: React__default.FC<ChatingProps>;
383
394
 
@@ -424,4 +435,17 @@ declare const chatContext: React$1.Context<{
424
435
  eventHandler: (component_key: string, data: any, message: string) => void;
425
436
  }>;
426
437
 
427
- export { type AgentState, type AttachFile, AxiomLatticeProvider, type AxiomLatticeProviderProps, type ChatResponse, type ChatState, type ChatStateWithAgent, Chating, type ClientConfig, type ElementEventHandler, type ElementProps, 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 };
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
  */
@@ -354,6 +358,11 @@ declare const elements: Record<string, ElementMeta>;
354
358
  declare const getElement: (language: string | undefined) => ElementMeta | null;
355
359
  declare const regsiterElement: (language: string, ElementMeta: ElementMeta) => ElementMeta;
356
360
 
361
+ interface TodoItem {
362
+ content: string;
363
+ status: "completed" | "in_progress" | "pending";
364
+ }
365
+
357
366
  interface ChatingProps {
358
367
  name?: string;
359
368
  description?: string;
@@ -378,6 +387,8 @@ interface ChatingProps {
378
387
  extraMeta?: Array<{
379
388
  id: string;
380
389
  }>;
390
+ files?: any[];
391
+ todos?: TodoItem[];
381
392
  }
382
393
  declare const Chating: React__default.FC<ChatingProps>;
383
394
 
@@ -424,4 +435,17 @@ declare const chatContext: React$1.Context<{
424
435
  eventHandler: (component_key: string, data: any, message: string) => void;
425
436
  }>;
426
437
 
427
- export { type AgentState, type AttachFile, AxiomLatticeProvider, type AxiomLatticeProviderProps, type ChatResponse, type ChatState, type ChatStateWithAgent, Chating, type ClientConfig, type ElementEventHandler, type ElementProps, 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 };
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 };