@railtownai/railtracks-visualizer 0.0.23 → 0.0.25
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/cjs/index.js +335 -223
- package/dist/esm/index.js +334 -222
- package/dist/types/components/nodes/AgentNode.d.ts +7 -1
- package/dist/types/components/nodes/AgentNodeInputRenderer.d.ts +7 -0
- package/dist/types/components/nodes/CodeBlock.d.ts +8 -0
- package/dist/types/components/nodes/OutputRenderer.d.ts +9 -0
- package/dist/types/components/ui/header.d.ts +2 -0
- package/dist/types/components/ui/json-tree.d.ts +2 -0
- package/dist/types/dto/AgentRunEdge.d.ts +2 -26
- package/dist/types/dto/AgentRunEdgeDetails.d.ts +13 -0
- package/dist/types/dto/AgentRunEdgeStamp.d.ts +11 -0
- package/dist/types/dto/AgentRunNode.d.ts +35 -2
- package/dist/types/hooks/index.d.ts +1 -0
- package/dist/types/hooks/useRailtracksStream.d.ts +14 -0
- package/dist/types/lib/theme.d.ts +2 -0
- package/dist/types/lib/utils.d.ts +12 -0
- package/package.json +3 -2
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
+
import { LLMDetails, NodeDetails } from "../../dto/AgentRunNode";
|
|
2
3
|
interface NodeData {
|
|
3
4
|
label: string;
|
|
4
5
|
nodeType?: "Tool" | "Agent" | "Coordinator";
|
|
5
|
-
details?:
|
|
6
|
+
details?: NodeDetails;
|
|
6
7
|
id?: string;
|
|
7
8
|
edges?: any[];
|
|
8
9
|
edgeDetails?: {
|
|
@@ -18,5 +19,10 @@ interface AgentNodeProps {
|
|
|
18
19
|
id: string;
|
|
19
20
|
onInspect?: (nodeData: NodeData) => void;
|
|
20
21
|
}
|
|
22
|
+
export declare const getOverviewLlmDetails: (llmDetails: LLMDetails[]) => LLMDetails | null;
|
|
23
|
+
export declare const sumTotalCost: (llmDetails: LLMDetails[]) => number;
|
|
24
|
+
export declare const sumTotalInputTokens: (llmDetails: LLMDetails[]) => number;
|
|
25
|
+
export declare const sumTotalOutputTokens: (llmDetails: LLMDetails[]) => number;
|
|
26
|
+
export declare const sumTotalLatency: (llmDetails: LLMDetails[]) => number;
|
|
21
27
|
export declare const AgentNode: React.FC<AgentNodeProps>;
|
|
22
28
|
export {};
|
|
@@ -18,6 +18,8 @@ interface HeaderProps {
|
|
|
18
18
|
onAgentRunSelect: (runIndex: number) => void;
|
|
19
19
|
showTimeline: boolean;
|
|
20
20
|
onTimelineToggle: (checked: boolean) => void;
|
|
21
|
+
sseConnected?: boolean;
|
|
22
|
+
sseConnecting?: boolean;
|
|
21
23
|
}
|
|
22
24
|
export declare const Header: React.FC<HeaderProps>;
|
|
23
25
|
export {};
|
|
@@ -3,8 +3,10 @@ interface JsonTreeViewerProps {
|
|
|
3
3
|
data: any;
|
|
4
4
|
maxDepth?: number;
|
|
5
5
|
initialExpanded?: boolean;
|
|
6
|
+
expanded?: boolean;
|
|
6
7
|
className?: string;
|
|
7
8
|
priorityKeys?: string[];
|
|
9
|
+
excludeKeys?: string[];
|
|
8
10
|
}
|
|
9
11
|
declare const JsonTreeViewer: React.FC<JsonTreeViewerProps>;
|
|
10
12
|
export { JsonTreeViewer };
|
|
@@ -1,29 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
*/
|
|
4
|
-
export interface EdgeStamp {
|
|
5
|
-
/** The sequential step number in the agent execution */
|
|
6
|
-
step: number;
|
|
7
|
-
/** Unix timestamp when this event occurred */
|
|
8
|
-
time: number;
|
|
9
|
-
/** Unique identifier for this stamp */
|
|
10
|
-
identifier: string;
|
|
11
|
-
}
|
|
12
|
-
/**
|
|
13
|
-
* Represents detailed information about an edge
|
|
14
|
-
*/
|
|
15
|
-
export interface EdgeDetails {
|
|
16
|
-
/** Optional state of the edge (e.g., "pending", "completed", "failed") */
|
|
17
|
-
state?: string;
|
|
18
|
-
/** Optional status information for the edge */
|
|
19
|
-
status?: string;
|
|
20
|
-
/** Optional array of input arguments passed to the target node */
|
|
21
|
-
input_args?: any[];
|
|
22
|
-
/** Optional object of input keyword arguments passed to the target node */
|
|
23
|
-
input_kwargs?: any;
|
|
24
|
-
/** Optional output data from the source node */
|
|
25
|
-
output?: any;
|
|
26
|
-
}
|
|
1
|
+
import { EdgeStamp } from "./AgentRunEdgeStamp";
|
|
2
|
+
import { EdgeDetails } from "./AgentRunEdgeDetails";
|
|
27
3
|
/**
|
|
28
4
|
* Represents an edge connecting nodes in the agent execution flow
|
|
29
5
|
*
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Represents detailed information about an edge
|
|
3
|
+
*/
|
|
4
|
+
export interface EdgeDetails {
|
|
5
|
+
/** Optional status information for the edge */
|
|
6
|
+
status?: string;
|
|
7
|
+
/** Optional array of input arguments passed to the target node */
|
|
8
|
+
input_args?: any[];
|
|
9
|
+
/** Optional object of input keyword arguments passed to the target node */
|
|
10
|
+
input_kwargs?: any;
|
|
11
|
+
/** Optional output data from the source node */
|
|
12
|
+
output?: any;
|
|
13
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Represents a timestamped event for an edge
|
|
3
|
+
*/
|
|
4
|
+
export interface EdgeStamp {
|
|
5
|
+
/** The sequential step number in the agent execution */
|
|
6
|
+
step: number;
|
|
7
|
+
/** Unix timestamp when this event occurred */
|
|
8
|
+
time: number;
|
|
9
|
+
/** Unique identifier for this stamp */
|
|
10
|
+
identifier: string;
|
|
11
|
+
}
|
|
@@ -15,7 +15,10 @@ export interface NodeStamp {
|
|
|
15
15
|
export interface LLMContent {
|
|
16
16
|
/** Role of the message sender (e.g., "user", "assistant", "system") */
|
|
17
17
|
role: string;
|
|
18
|
-
/** The actual content of the message
|
|
18
|
+
/** The actual content of the message.
|
|
19
|
+
* For tool calls, they can be a function call.
|
|
20
|
+
* For tool responses, it can be json.
|
|
21
|
+
* For LLM responses, it can be a string or a json object. */
|
|
19
22
|
content: any;
|
|
20
23
|
}
|
|
21
24
|
/**
|
|
@@ -38,12 +41,16 @@ export interface LLMDetails {
|
|
|
38
41
|
total_cost: number | null;
|
|
39
42
|
/** System fingerprint for the model (null if not available) */
|
|
40
43
|
system_fingerprint: string | null;
|
|
44
|
+
/** Total time taken for the node to execute in SECONDS.
|
|
45
|
+
* Older agent runs (backwards compatible) won't have latency parameter
|
|
46
|
+
* so we need to make it optional. */
|
|
47
|
+
latency?: number | null;
|
|
41
48
|
}
|
|
42
49
|
/**
|
|
43
50
|
* Represents latency information for a node execution
|
|
44
51
|
*/
|
|
45
52
|
export interface NodeLatency {
|
|
46
|
-
/** Total time taken for the node to execute in
|
|
53
|
+
/** Total time taken for the node to execute in SECONDS */
|
|
47
54
|
total_time: number;
|
|
48
55
|
}
|
|
49
56
|
/**
|
|
@@ -113,3 +120,29 @@ export interface AgentRunNode {
|
|
|
113
120
|
/** Reference to the parent node, or null if this is a root node */
|
|
114
121
|
parent: AgentRunNode | null;
|
|
115
122
|
}
|
|
123
|
+
/**
|
|
124
|
+
* Represents a tool call with identifier, name, and arguments
|
|
125
|
+
*/
|
|
126
|
+
export interface ToolCall {
|
|
127
|
+
/** Unique identifier for this tool call */
|
|
128
|
+
identifier: string;
|
|
129
|
+
/** Name of the tool being called */
|
|
130
|
+
name: string;
|
|
131
|
+
/** Arguments passed to the tool */
|
|
132
|
+
arguments: Record<string, any>;
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* Represents a tool response with identifier, name, and result
|
|
136
|
+
*/
|
|
137
|
+
export interface ToolResponse {
|
|
138
|
+
/** Unique identifier for this tool response */
|
|
139
|
+
identifier: string;
|
|
140
|
+
/** Name of the tool that generated this response */
|
|
141
|
+
name: string;
|
|
142
|
+
/** The result of the tool call */
|
|
143
|
+
result: any;
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* Union type for different content types that can be rendered
|
|
147
|
+
*/
|
|
148
|
+
export type Content = string | ToolCall[] | ToolResponse | any;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export { useApi } from "./useApi";
|
|
2
2
|
export { useFlowData } from "./useFlowData";
|
|
3
|
+
export { useRailtracksStream } from "./useRailtracksStream";
|
|
3
4
|
export type { JsonFile, ApiError } from "./useApi";
|
|
4
5
|
export type { FlowDataState } from "./useFlowData";
|
|
5
6
|
export type { AgentRunNode } from "../dto/AgentRunNode";
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
interface StreamMessage {
|
|
2
|
+
type: "connected" | "file_updated" | "keepalive";
|
|
3
|
+
filename?: string;
|
|
4
|
+
timestamp?: number;
|
|
5
|
+
[key: string]: any;
|
|
6
|
+
}
|
|
7
|
+
declare const useRailtracksStream: (onMessage?: (data: StreamMessage) => void) => {
|
|
8
|
+
isConnected: boolean;
|
|
9
|
+
isConnecting: boolean;
|
|
10
|
+
error: string | null;
|
|
11
|
+
reconnect: () => Promise<void>;
|
|
12
|
+
disconnect: () => void;
|
|
13
|
+
};
|
|
14
|
+
export { useRailtracksStream };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { type ClassValue } from "clsx";
|
|
2
|
+
import { ToolCall } from "../dto/AgentRunNode";
|
|
2
3
|
export declare function cn(...inputs: ClassValue[]): string;
|
|
3
4
|
/**
|
|
4
5
|
* Converts a string to title case
|
|
@@ -77,3 +78,14 @@ export declare function getSafeThemeValue(theme: any, path: string, fallback: an
|
|
|
77
78
|
* @returns A safe theme object with fallbacks
|
|
78
79
|
*/
|
|
79
80
|
export declare function createSafeTheme(theme?: any): any;
|
|
81
|
+
/**
|
|
82
|
+
* Detects the type of content for rendering
|
|
83
|
+
*/
|
|
84
|
+
export declare const detectContentType: (output: {
|
|
85
|
+
role: string;
|
|
86
|
+
content: any;
|
|
87
|
+
}) => "string" | "toolResponse" | "toolCallList" | "other";
|
|
88
|
+
/**
|
|
89
|
+
* Formats tool calls for display in a code block
|
|
90
|
+
*/
|
|
91
|
+
export declare const formatToolCalls: (toolCalls: ToolCall[]) => string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@railtownai/railtracks-visualizer",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.25",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"author": "Railtown AI",
|
|
6
6
|
"description": "A visualizer for RailTracks agentic flows",
|
|
@@ -48,6 +48,7 @@
|
|
|
48
48
|
"lucide-react": "0.525.0",
|
|
49
49
|
"moment": "2.30.1",
|
|
50
50
|
"react-countup": "6.5.3",
|
|
51
|
+
"react-textarea-autosize": "8.5.9",
|
|
51
52
|
"vaul": "1.1.2"
|
|
52
53
|
},
|
|
53
54
|
"scripts": {
|
|
@@ -57,7 +58,7 @@
|
|
|
57
58
|
"build:size": "npm pack --dry-run",
|
|
58
59
|
"build": "npm run build:types && npm run build:lib && npm run build:spa",
|
|
59
60
|
"clean": "rm -rf dist build test-results .railtracks/ui/*",
|
|
60
|
-
"dev
|
|
61
|
+
"dev": "rm -rf .railtracks/ui/* && vite build && cp -r build/* .railtracks/ui",
|
|
61
62
|
"lint:fix": "prettier --write \"src/**/*.{js,jsx,ts,tsx,json,css,md}\"",
|
|
62
63
|
"lint": "prettier --check \"src/**/*.{js,jsx,ts,tsx,json,css,md}\"",
|
|
63
64
|
"start": "storybook dev -p 6006",
|