@axiom-lattice/react-sdk 2.0.3 → 2.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/README.md +27 -0
- package/dist/index.d.mts +36 -3
- package/dist/index.d.ts +36 -3
- package/dist/index.js +1302 -176
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1323 -171
- package/dist/index.mjs.map +1 -1
- package/package.json +5 -3
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
|
*/
|
|
@@ -344,16 +348,28 @@ type ElementProps<T = any> = {
|
|
|
344
348
|
interactive?: boolean;
|
|
345
349
|
default_open_in_side_app?: boolean;
|
|
346
350
|
};
|
|
347
|
-
|
|
348
351
|
interface ElementMeta {
|
|
349
352
|
card_view: React.FC<ElementProps>;
|
|
350
353
|
side_app_view?: React.FC<ElementProps>;
|
|
351
354
|
action?: (data: any) => void;
|
|
352
355
|
}
|
|
353
|
-
|
|
356
|
+
interface ToolCallData {
|
|
357
|
+
id: string;
|
|
358
|
+
name: string;
|
|
359
|
+
args: Record<string, any>;
|
|
360
|
+
type: "tool_call";
|
|
361
|
+
response?: string;
|
|
362
|
+
status?: "success" | "pending" | "error";
|
|
363
|
+
}
|
|
364
|
+
|
|
354
365
|
declare const getElement: (language: string | undefined) => ElementMeta | null;
|
|
355
366
|
declare const regsiterElement: (language: string, ElementMeta: ElementMeta) => ElementMeta;
|
|
356
367
|
|
|
368
|
+
interface TodoItem {
|
|
369
|
+
content: string;
|
|
370
|
+
status: "completed" | "in_progress" | "pending";
|
|
371
|
+
}
|
|
372
|
+
|
|
357
373
|
interface ChatingProps {
|
|
358
374
|
name?: string;
|
|
359
375
|
description?: string;
|
|
@@ -378,6 +394,8 @@ interface ChatingProps {
|
|
|
378
394
|
extraMeta?: Array<{
|
|
379
395
|
id: string;
|
|
380
396
|
}>;
|
|
397
|
+
files?: any;
|
|
398
|
+
todos?: TodoItem[];
|
|
381
399
|
}
|
|
382
400
|
declare const Chating: React__default.FC<ChatingProps>;
|
|
383
401
|
|
|
@@ -424,4 +442,19 @@ declare const chatContext: React$1.Context<{
|
|
|
424
442
|
eventHandler: (component_key: string, data: any, message: string) => void;
|
|
425
443
|
}>;
|
|
426
444
|
|
|
427
|
-
|
|
445
|
+
interface ExplorerFile {
|
|
446
|
+
name: string;
|
|
447
|
+
content: string[];
|
|
448
|
+
language?: string;
|
|
449
|
+
created_at?: string;
|
|
450
|
+
modified_at?: string;
|
|
451
|
+
}
|
|
452
|
+
interface FileExplorerProps {
|
|
453
|
+
files?: Record<string, ExplorerFile>;
|
|
454
|
+
className?: string;
|
|
455
|
+
style?: React__default.CSSProperties;
|
|
456
|
+
title?: string;
|
|
457
|
+
}
|
|
458
|
+
declare const FileExplorer: React__default.FC<ElementProps>;
|
|
459
|
+
|
|
460
|
+
export { type AgentState, type AttachFile, AxiomLatticeProvider, type AxiomLatticeProviderProps, type ChatResponse, type ChatState, type ChatStateWithAgent, Chating, type ClientConfig, type ElementEventHandler, type ElementMeta, type ElementProps, type ExplorerFile, FileExplorer, type FileExplorerProps, MDMermaid, MDResponse, MDViewFormItem, SideAppViewBrowser, type StreamEventHandlerOptions, ThinkingChain, ThinkingChainGroup, type Thread, type ThreadState, type ToolCallData, type UIMessage, type UseAgentStateOptions, type UseAgentStateReturn, type UseChatOptions, chatContext, 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
|
*/
|
|
@@ -344,16 +348,28 @@ type ElementProps<T = any> = {
|
|
|
344
348
|
interactive?: boolean;
|
|
345
349
|
default_open_in_side_app?: boolean;
|
|
346
350
|
};
|
|
347
|
-
|
|
348
351
|
interface ElementMeta {
|
|
349
352
|
card_view: React.FC<ElementProps>;
|
|
350
353
|
side_app_view?: React.FC<ElementProps>;
|
|
351
354
|
action?: (data: any) => void;
|
|
352
355
|
}
|
|
353
|
-
|
|
356
|
+
interface ToolCallData {
|
|
357
|
+
id: string;
|
|
358
|
+
name: string;
|
|
359
|
+
args: Record<string, any>;
|
|
360
|
+
type: "tool_call";
|
|
361
|
+
response?: string;
|
|
362
|
+
status?: "success" | "pending" | "error";
|
|
363
|
+
}
|
|
364
|
+
|
|
354
365
|
declare const getElement: (language: string | undefined) => ElementMeta | null;
|
|
355
366
|
declare const regsiterElement: (language: string, ElementMeta: ElementMeta) => ElementMeta;
|
|
356
367
|
|
|
368
|
+
interface TodoItem {
|
|
369
|
+
content: string;
|
|
370
|
+
status: "completed" | "in_progress" | "pending";
|
|
371
|
+
}
|
|
372
|
+
|
|
357
373
|
interface ChatingProps {
|
|
358
374
|
name?: string;
|
|
359
375
|
description?: string;
|
|
@@ -378,6 +394,8 @@ interface ChatingProps {
|
|
|
378
394
|
extraMeta?: Array<{
|
|
379
395
|
id: string;
|
|
380
396
|
}>;
|
|
397
|
+
files?: any;
|
|
398
|
+
todos?: TodoItem[];
|
|
381
399
|
}
|
|
382
400
|
declare const Chating: React__default.FC<ChatingProps>;
|
|
383
401
|
|
|
@@ -424,4 +442,19 @@ declare const chatContext: React$1.Context<{
|
|
|
424
442
|
eventHandler: (component_key: string, data: any, message: string) => void;
|
|
425
443
|
}>;
|
|
426
444
|
|
|
427
|
-
|
|
445
|
+
interface ExplorerFile {
|
|
446
|
+
name: string;
|
|
447
|
+
content: string[];
|
|
448
|
+
language?: string;
|
|
449
|
+
created_at?: string;
|
|
450
|
+
modified_at?: string;
|
|
451
|
+
}
|
|
452
|
+
interface FileExplorerProps {
|
|
453
|
+
files?: Record<string, ExplorerFile>;
|
|
454
|
+
className?: string;
|
|
455
|
+
style?: React__default.CSSProperties;
|
|
456
|
+
title?: string;
|
|
457
|
+
}
|
|
458
|
+
declare const FileExplorer: React__default.FC<ElementProps>;
|
|
459
|
+
|
|
460
|
+
export { type AgentState, type AttachFile, AxiomLatticeProvider, type AxiomLatticeProviderProps, type ChatResponse, type ChatState, type ChatStateWithAgent, Chating, type ClientConfig, type ElementEventHandler, type ElementMeta, type ElementProps, type ExplorerFile, FileExplorer, type FileExplorerProps, MDMermaid, MDResponse, MDViewFormItem, SideAppViewBrowser, type StreamEventHandlerOptions, ThinkingChain, ThinkingChainGroup, type Thread, type ThreadState, type ToolCallData, type UIMessage, type UseAgentStateOptions, type UseAgentStateReturn, type UseChatOptions, chatContext, getElement, regsiterElement, useAgentGraph, useAgentState, useAxiomLattice, useChat, useThread };
|