@railtownai/railtracks-visualizer 0.0.25 → 0.0.26

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.
@@ -1,10 +1,11 @@
1
1
  import React from "react";
2
2
  import { JsonFile } from "../../hooks/useApi";
3
- interface AgentRun {
3
+ import { RealTimeLastUpdate } from "../../hooks/useRailtracksStream";
4
+ export interface AgentRunMenuItem {
4
5
  id: number;
5
6
  name: string;
6
- runId: string;
7
- sessionId: string;
7
+ run_id: string;
8
+ session_id: string;
8
9
  }
9
10
  interface HeaderProps {
10
11
  availableFiles: JsonFile[];
@@ -13,13 +14,13 @@ interface HeaderProps {
13
14
  onRefresh: () => void;
14
15
  loading: boolean;
15
16
  isMultipleAgentRuns: boolean;
16
- agentRuns: AgentRun[];
17
- selectedAgentRun: number;
18
- onAgentRunSelect: (runIndex: number) => void;
17
+ agentRuns: AgentRunMenuItem[];
18
+ selectedAgentRunId: string | null;
19
+ onAgentRunSelect: (runId: string) => void;
19
20
  showTimeline: boolean;
20
21
  onTimelineToggle: (checked: boolean) => void;
21
- sseConnected?: boolean;
22
- sseConnecting?: boolean;
22
+ realTimeConnected?: boolean;
23
+ realTimeLastUpdate?: RealTimeLastUpdate | null;
23
24
  }
24
25
  export declare const Header: React.FC<HeaderProps>;
25
26
  export {};
@@ -8,21 +8,6 @@ import { AgentRunStep } from "./AgentRunStep";
8
8
  * This interface defines the structure for agent flow data that can be visualized
9
9
  * in the RailTracks UI. It contains the execution graph (nodes and edges) along
10
10
  * with timing information and session metadata.
11
- *
12
- * @example
13
- * ```typescript
14
- * const agentRun: AgentRun = {
15
- * session_id: "session_123",
16
- * name: "Customer Support Agent",
17
- * run_id: "run_456",
18
- * nodes: [...],
19
- * edges: [...],
20
- * stamps: [
21
- * { step: 1, time: 1640995200, identifier: "start" },
22
- * { step: 2, time: 1640995201, identifier: "user_input" }
23
- * ]
24
- * };
25
- * ```
26
11
  */
27
12
  export interface AgentRun {
28
13
  /** Unique identifier for the agent session this run belongs to */
@@ -31,6 +16,12 @@ export interface AgentRun {
31
16
  name: string;
32
17
  /** Unique identifier for this specific agent run */
33
18
  run_id: string;
19
+ /** Start time of the agent run (unix timestamp) */
20
+ start_time: number;
21
+ /** End time of the agent run (unix timestamp) */
22
+ end_time: number;
23
+ /** Status of the agent run (Completed, Failed, etc.) */
24
+ status: string;
34
25
  /** Array of nodes representing the agent's execution steps */
35
26
  nodes: AgentRunNode[];
36
27
  /** Optional array of edges connecting the nodes in the execution flow */
@@ -1,5 +1,5 @@
1
- import { EdgeStamp } from "./AgentRunEdgeStamp";
2
- import { EdgeDetails } from "./AgentRunEdgeDetails";
1
+ import { AgentRunEdgeStamp } from "./AgentRunEdgeStamp";
2
+ import { AgentRunEdgeDetails } from "./AgentRunEdgeDetails";
3
3
  /**
4
4
  * Represents an edge connecting nodes in the agent execution flow
5
5
  *
@@ -7,27 +7,6 @@ import { EdgeDetails } from "./AgentRunEdgeDetails";
7
7
  * Edges represent the flow of data and control between different execution steps,
8
8
  * with timing information and optional execution details.
9
9
  *
10
- * @example
11
- * ```typescript
12
- * const edge: AgentRunEdge = {
13
- * identifier: "edge_123",
14
- * source: "node_1",
15
- * target: "node_2",
16
- * stamp: {
17
- * step: 2,
18
- * time: 1640995201,
19
- * identifier: "edge_1_to_2"
20
- * },
21
- * details: {
22
- * state: "completed",
23
- * status: "success",
24
- * input_args: ["Hello world"],
25
- * input_kwargs: { temperature: 0.7 },
26
- * output: { response: "Hi there!" }
27
- * },
28
- * parent: null
29
- * };
30
- * ```
31
10
  */
32
11
  export interface AgentRunEdge {
33
12
  /** Unique identifier for this edge */
@@ -37,9 +16,9 @@ export interface AgentRunEdge {
37
16
  /** Identifier of the target node this edge connects to */
38
17
  target: string;
39
18
  /** Timestamp information for when this edge was traversed */
40
- stamp: EdgeStamp;
19
+ stamp: AgentRunEdgeStamp;
41
20
  /** Detailed information about the edge's execution */
42
- details: EdgeDetails;
21
+ details: AgentRunEdgeDetails;
43
22
  /** Reference to the parent edge, or null if this is a root edge */
44
23
  parent: AgentRunEdge | null;
45
24
  }
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Represents detailed information about an edge
3
3
  */
4
- export interface EdgeDetails {
4
+ export interface AgentRunEdgeDetails {
5
5
  /** Optional status information for the edge */
6
6
  status?: string;
7
7
  /** Optional array of input arguments passed to the target node */
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Represents a timestamped event for an edge
3
3
  */
4
- export interface EdgeStamp {
4
+ export interface AgentRunEdgeStamp {
5
5
  /** The sequential step number in the agent execution */
6
6
  step: number;
7
7
  /** Unix timestamp when this event occurred */
@@ -76,40 +76,11 @@ export interface NodeDetails {
76
76
  * Each node represents a discrete action or decision point in the agent's workflow,
77
77
  * with timing information, execution details, and optional LLM interaction data.
78
78
  *
79
- * @example
80
- * ```typescript
81
- * const node: AgentRunNode = {
82
- * identifier: "node_123",
83
- * node_type: "llm_call",
84
- * name: "Generate Response",
85
- * stamp: {
86
- * step: 1,
87
- * time: 1640995200,
88
- * identifier: "llm_call_1"
89
- * },
90
- * details: {
91
- * internals: {
92
- * llm_details: [{
93
- * model_name: "gpt-4",
94
- * model_provider: "openai",
95
- * input: [{ role: "user", content: "Hello" }],
96
- * output: { role: "assistant", content: "Hi there!" },
97
- * input_tokens: 5,
98
- * output_tokens: 3,
99
- * total_cost: 0.0001,
100
- * system_fingerprint: "fp_123"
101
- * }],
102
- * latency: { total_time: 1500 }
103
- * }
104
- * },
105
- * parent: null
106
- * };
107
- * ```
108
79
  */
109
80
  export interface AgentRunNode {
110
81
  /** Unique identifier for this node */
111
82
  identifier: string;
112
- /** Type of node (e.g., "llm_call", "tool_call", "decision") */
83
+ /** Type of node (e.g., "Tool", "Agent", "Coordinator") */
113
84
  node_type: string;
114
85
  /** Optional human-readable name for this node */
115
86
  name?: string;
@@ -1,2 +1,13 @@
1
1
  import { AgentRun } from "./AgentRun";
2
- export type AgentSession = AgentRun[];
2
+ export type AgentSession = {
3
+ /** Unique identifier for the agent session */
4
+ session_id: string;
5
+ /** Name of the agent session */
6
+ name: string;
7
+ /** Start time of the agent session (unix timestamp) */
8
+ start_time: number;
9
+ /** End time of the agent session (unix timestamp) */
10
+ end_time: number;
11
+ /** Array of agent runs */
12
+ runs: AgentRun[];
13
+ };
@@ -0,0 +1,9 @@
1
+ import { AgentRun } from "./AgentRun";
2
+ import { AgentRunEdge } from "./AgentRunEdge";
3
+ import { AgentRunEdgeDetails } from "./AgentRunEdgeDetails";
4
+ import { AgentRunEdgeStamp } from "./AgentRunEdgeStamp";
5
+ import { AgentRunNode } from "./AgentRunNode";
6
+ import { AgentRunStamp } from "./AgentRunStamp";
7
+ import { AgentRunStep } from "./AgentRunStep";
8
+ import { AgentSession } from "./AgentSession";
9
+ export type { AgentRun, AgentSession, AgentRunNode, AgentRunEdge, AgentRunEdgeDetails, AgentRunEdgeStamp, AgentRunStamp, AgentRunStep };
@@ -1,3 +1,4 @@
1
+ import { AgentSession } from "../dto/AgentSession";
1
2
  export interface JsonFile {
2
3
  name: string;
3
4
  size?: number;
@@ -11,6 +12,6 @@ export declare const useApi: () => {
11
12
  loading: boolean;
12
13
  error: ApiError | null;
13
14
  listJsonFiles: () => Promise<JsonFile[]>;
14
- loadJsonFile: (filename: string) => Promise<any>;
15
- triggerRefresh: () => Promise<any>;
15
+ loadJsonFile: (filename: string) => Promise<AgentSession | null>;
16
+ triggerRefresh: () => Promise<JsonFile[] | null>;
16
17
  };
@@ -1,9 +1,9 @@
1
1
  import { JsonFile } from "./useApi";
2
- import { AgentRun } from "../dto/AgentRun";
2
+ import type { AgentSession } from "../dto";
3
3
  export interface FlowDataState {
4
4
  availableFiles: JsonFile[];
5
5
  currentFile: string | null;
6
- flowData: AgentRun | null;
6
+ flowData: AgentSession | null;
7
7
  loading: boolean;
8
8
  error: string | null;
9
9
  }
@@ -14,5 +14,5 @@ export declare const useFlowData: () => {
14
14
  refreshFiles: () => Promise<void>;
15
15
  availableFiles: JsonFile[];
16
16
  currentFile: string | null;
17
- flowData: AgentRun | null;
17
+ flowData: AgentSession | null;
18
18
  };
@@ -4,6 +4,10 @@ interface StreamMessage {
4
4
  timestamp?: number;
5
5
  [key: string]: any;
6
6
  }
7
+ export interface RealTimeLastUpdate {
8
+ filename: string;
9
+ timestamp: Date;
10
+ }
7
11
  declare const useRailtracksStream: (onMessage?: (data: StreamMessage) => void) => {
8
12
  isConnected: boolean;
9
13
  isConnecting: boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@railtownai/railtracks-visualizer",
3
- "version": "0.0.25",
3
+ "version": "0.0.26",
4
4
  "license": "Apache-2.0",
5
5
  "author": "Railtown AI",
6
6
  "description": "A visualizer for RailTracks agentic flows",