@railtownai/railtracks-visualizer 0.0.58 → 0.0.60

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.
@@ -13,11 +13,16 @@ export interface AggregateResultsTableProps {
13
13
  /** Agents (with agent_node_ids) for LLM inference tree Agent (root) labels. */
14
14
  agents?: {
15
15
  agent_name: string;
16
- agent_node_ids?: string[];
16
+ agent_node_ids?: string[] | {
17
+ session_id: string;
18
+ agent_node_id: string;
19
+ }[];
17
20
  }[];
18
21
  /** Title shown above the table. */
19
22
  title?: string;
20
23
  /** Optional evaluator name hint (e.g. "ToolUseEvaluator") for default title. */
21
24
  evaluatorName?: string;
25
+ /** Called when an Agent/Tool Node row is clicked. sessionId may be undefined when evaluation uses legacy agent_node_ids format. */
26
+ onAgentNodeClick?: (sessionId: string | undefined, nodeId: string) => void;
22
27
  }
23
28
  export declare const AggregateResultsTable: React.FC<AggregateResultsTableProps>;
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Renders a Tool Output in a Tree component
3
+ *
4
+ */
5
+ import React from "react";
6
+ export interface JsonValueTreeProps {
7
+ data: unknown;
8
+ className?: string;
9
+ maxHeight?: number | string;
10
+ }
11
+ export declare const JsonValueTree: React.FC<JsonValueTreeProps>;
@@ -2,6 +2,8 @@ import React from "react";
2
2
  import type { AgentRun } from "../../dto/AgentRun";
3
3
  import type { AgentRunNode } from "../../dto/AgentRunNode";
4
4
  import type { SessionListItem } from "../hooks/useSessions";
5
+ /** Tool/agent failure is carried on the incoming edge's details.status (e.g. Failed), same as flow edges and session I/O. */
6
+ export declare function isNodeFailureFromIncomingEdge(run: AgentRun, nodeId: string): boolean;
5
7
  export interface SelectedNodeInfo {
6
8
  nodeId: string;
7
9
  runId: string;
@@ -56,7 +56,10 @@ export interface Evaluation {
56
56
  /** Agents in the evaluation (name and node IDs for LLM inference tree) */
57
57
  agents: {
58
58
  agent_name: string;
59
- agent_node_ids?: string[];
59
+ agent_node_ids?: string[] | {
60
+ session_id: string;
61
+ agent_node_id: string;
62
+ }[];
60
63
  }[];
61
64
  /** Number of agents in the evaluation */
62
65
  agents_count: number;
@@ -2,10 +2,15 @@ import React from "react";
2
2
  export interface EvaluatorResultPageProps {
3
3
  /** Optional href for back link. Pass from the host app (e.g. "#/evaluations" for HashRouter). */
4
4
  backHref?: string;
5
+ /**
6
+ * Optional handler for Agent/Tool node clicks. sessionId may be undefined when evaluation uses
7
+ * legacy agent_node_ids format. Default opens a SessionDetails drawer on this page.
8
+ */
9
+ onAgentNodeClick?: (sessionId: string | undefined, nodeId: string) => void;
5
10
  }
6
11
  /**
7
12
  * Page that resolves evaluationId and evaluatorId from the route,
8
13
  * fetches evaluation data, and renders EvaluatorResult.
9
- * backHref should be passed from the outer/host app for portability.
14
+ * backHref and onAgentNodeClick should be passed from the outer/host app for portability.
10
15
  */
11
16
  export declare const EvaluatorResultPage: React.FC<EvaluatorResultPageProps>;
@@ -11,5 +11,10 @@ export interface EvaluatorResultProps {
11
11
  evaluatorId: string;
12
12
  /** Optional href for back link. When provided, a "Back to Evaluations" control is shown. */
13
13
  backHref?: string;
14
+ /**
15
+ * Optional handler for Agent/Tool node clicks. sessionId may be undefined when evaluation
16
+ * uses legacy agent_node_ids format. When not provided, nodes use default (drawer).
17
+ */
18
+ onAgentNodeClick?: (sessionId: string | undefined, nodeId: string) => void;
14
19
  }
15
20
  export declare const EvaluatorResult: React.FC<EvaluatorResultProps>;
@@ -5,6 +5,12 @@ interface SessionDetailsProps {
5
5
  session: SessionListItem | null;
6
6
  open: boolean;
7
7
  onClose: () => void;
8
+ /** Optional initial node to select when opening (e.g. from evaluation link). */
9
+ initialNodeId?: string;
10
+ /** Optional run containing the node. When omitted, the run is found by searching session.runs. */
11
+ initialRunId?: string;
12
+ /** When true, show loading state instead of "No session data available". */
13
+ loading?: boolean;
8
14
  }
9
15
  export declare const InputsOutputsComponent: React.FC<{
10
16
  run: AgentRun;
@@ -33,5 +33,5 @@ export interface EvaluatorResultDerived {
33
33
  export declare function deriveEvaluatorResultData(evaluation: Evaluation, evaluatorId: string): EvaluatorResultDerived | null;
34
34
  /** Derive agent display name from DTO. */
35
35
  export declare function deriveAgentName(evaluation: Evaluation): string;
36
- /** Derive runs count from DTO (agent_node_ids). */
36
+ /** Derive runs count from DTO (agent_node_ids). Supports both string[] and { session_id, agent_node_id }[]. */
37
37
  export declare function deriveRunsCount(evaluation: Evaluation): number;
@@ -2,13 +2,17 @@
2
2
  * Transforms LLMInferenceEvaluator aggregate_results (roots + nodes) into a tree
3
3
  * structure for table rendering. Builds hierarchy: Agent (root) -> llm call -> agent node id.
4
4
  */
5
+ type AgentNodeIdEntry = string | {
6
+ session_id: string;
7
+ agent_node_id: string;
8
+ };
5
9
  export type LLMAggregateResultsInput = {
6
10
  roots: string[];
7
11
  nodes: Record<string, unknown>;
8
- /** Optional agents for Agent (root) labels; agent_node_ids map agent_data_id to agent */
12
+ /** Optional agents for Agent (root) labels; agent_node_ids can be string[] or { session_id, agent_node_id }[] */
9
13
  agents?: {
10
14
  agent_name: string;
11
- agent_node_ids?: string[];
15
+ agent_node_ids?: AgentNodeIdEntry[];
12
16
  }[];
13
17
  };
14
18
  export interface LLMInferenceTreeRow {
@@ -26,6 +30,8 @@ export interface LLMInferenceTreeRow {
26
30
  value?: number;
27
31
  /** Leaf agent node id */
28
32
  agentNodeId?: string;
33
+ /** Session id for linking to session-details (when agent_node_ids use new format) */
34
+ sessionId?: string;
29
35
  children?: LLMInferenceTreeRow[];
30
36
  }
31
37
  /**
@@ -34,3 +40,4 @@ export interface LLMInferenceTreeRow {
34
40
  * Each row has metric values (InputTokens, OutputTokens, TotalCost, Latency) as columns.
35
41
  */
36
42
  export declare function buildLLMInferenceTreeFromAggregateResults(agg: LLMAggregateResultsInput): LLMInferenceTreeRow[];
43
+ export {};
@@ -3,9 +3,18 @@
3
3
  * into a tree structure for table rendering. Builds hierarchy: tool → agent → invocation.
4
4
  */
5
5
  import type { EvaluationResultItem } from "../../dto/Evaluation";
6
+ type AgentNodeIdEntry = string | {
7
+ session_id: string;
8
+ agent_node_id: string;
9
+ };
6
10
  export type ToolUseAggregateResultsInput = {
7
11
  roots: string[];
8
12
  nodes: Record<string, unknown>;
13
+ /** Optional agents for session deep-linking; agent_node_ids can be string[] or { session_id, agent_node_id }[] */
14
+ agents?: {
15
+ agent_name: string;
16
+ agent_node_ids?: AgentNodeIdEntry[];
17
+ }[];
9
18
  };
10
19
  export interface ToolUseTreeRow {
11
20
  key: string;
@@ -14,6 +23,10 @@ export interface ToolUseTreeRow {
14
23
  runtimeMs?: number;
15
24
  failureRate?: string | "Success" | "Failed";
16
25
  level: 1 | 2 | 3;
26
+ /** Session id for deep-linking to session drawer (level 2–3) */
27
+ sessionId?: string;
28
+ /** Node id to select in SessionTree (agent_node_id for level 2, tool_node_id for level 3) */
29
+ nodeId?: string;
17
30
  children?: ToolUseTreeRow[];
18
31
  }
19
32
  /**
@@ -25,4 +38,8 @@ export declare function buildToolUseTreeFromAggregate(agg: ToolUseAggregateResul
25
38
  * Builds a tree from raw ToolUseEvaluator results (legacy flat format).
26
39
  * Structure: tool (level 1) → agent (level 2) → invocation (level 3).
27
40
  */
28
- export declare function buildToolUseTreeFromRawResults(rawResults: EvaluationResultItem[]): ToolUseTreeRow[];
41
+ export declare function buildToolUseTreeFromRawResults(rawResults: EvaluationResultItem[], agents?: {
42
+ agent_name: string;
43
+ agent_node_ids?: AgentNodeIdEntry[];
44
+ }[]): ToolUseTreeRow[];
45
+ export {};
@@ -8,6 +8,8 @@ interface EdgeProps {
8
8
  targetY: number;
9
9
  sourcePosition: any;
10
10
  targetPosition: any;
11
+ /** React Flow sets this for animated edges; used for active-step stroke color without rebuilding edge data on theme change */
12
+ animated?: boolean;
11
13
  style?: React.CSSProperties;
12
14
  markerEnd?: string;
13
15
  bidirectional?: boolean;
@@ -1,5 +1,5 @@
1
1
  import React from "react";
2
- type NodeType = "Tool" | "Agent" | "Coordinator";
2
+ type NodeType = "Tool" | "Agent";
3
3
  interface NodeData {
4
4
  label: string;
5
5
  nodeType?: NodeType;
@@ -2,7 +2,7 @@ import React from "react";
2
2
  import { LLMDetails, NodeDetails } from "../../dto/AgentRunNode";
3
3
  interface NodeData {
4
4
  label: string;
5
- nodeType?: "Tool" | "Agent" | "Coordinator";
5
+ nodeType?: "Tool" | "Agent";
6
6
  details?: NodeDetails;
7
7
  id?: string;
8
8
  edges?: any[];
@@ -21,7 +21,7 @@ interface AgentNodeProps {
21
21
  defaultDrawerOpen?: boolean;
22
22
  }
23
23
  export interface GetNodeIconOptions {
24
- nodeType?: "tool" | "coordinator" | "agent";
24
+ nodeType?: "tool" | "agent";
25
25
  modelProvider?: string;
26
26
  modelName?: string;
27
27
  size?: number;
@@ -1,7 +1,7 @@
1
1
  import React from "react";
2
2
  interface NodeData {
3
3
  label: string;
4
- nodeType?: "Tool" | "Agent" | "Coordinator";
4
+ nodeType?: "Tool" | "Agent";
5
5
  details?: any;
6
6
  id?: string;
7
7
  edges?: any[];
@@ -18,5 +18,7 @@ interface NodeDetailsDrawerProps {
18
18
  onClose: () => void;
19
19
  nodeData: NodeData;
20
20
  }
21
+ /** Merged tool internals + first edge detail (same shape ToolNode used on-canvas). */
22
+ export declare function buildToolDrawerPayload(nodeData: NodeData): Record<string, unknown> | null;
21
23
  export declare const NodeDetailsDrawer: React.FC<NodeDetailsDrawerProps>;
22
24
  export {};
@@ -5,7 +5,7 @@ interface Edge {
5
5
  }
6
6
  interface NodeData {
7
7
  label: string;
8
- nodeType?: "Tool" | "Agent" | "Coordinator";
8
+ nodeType?: "Tool" | "Agent";
9
9
  details?: any;
10
10
  id?: string;
11
11
  edges?: Edge[];
@@ -1 +1,7 @@
1
+ /** Max width for rich content (drawer output blocks, etc.) */
1
2
  export declare const NODE_MAX_WIDTH = 500;
3
+ /** Compact xyflow node card width range */
4
+ export declare const FLOW_NODE_MIN_WIDTH = 176;
5
+ export declare const FLOW_NODE_MAX_WIDTH = 250;
6
+ /** Used by auto-layout horizontal spacing (~typical card width between min and max) */
7
+ export declare const LAYOUT_NODE_WIDTH: number;
@@ -1,5 +1,4 @@
1
1
  export { AgentNode } from "./AgentNode";
2
- export { CoordinatorNode } from "./CoordinatorNode";
3
2
  export { ToolNode } from "./ToolNode";
4
3
  export { NodeDetailsDrawer } from "./NodeDetailsDrawer";
5
4
  export { ExpandableTextarea } from "./ExpandableTextarea";
@@ -80,7 +80,7 @@ export interface NodeDetails {
80
80
  export interface AgentRunNode {
81
81
  /** Unique identifier for this node */
82
82
  identifier: string;
83
- /** Type of node (e.g., "Tool", "Agent", "Coordinator") */
83
+ /** Type of node (e.g., "Tool", "Agent") */
84
84
  node_type: string;
85
85
  /** Optional human-readable name for this node */
86
86
  name?: string;
@@ -141,10 +141,16 @@ export type EvaluationEvaluatorResult = {
141
141
  /** Aggregate tree (roots + nodes with ToolAggregate, LLMInferenceAggregate, CategoricalAggregate) */
142
142
  aggregate_results?: EvaluationAggregateResults;
143
143
  };
144
+ /** New format: agent node with session context */
145
+ export type EvaluationAgentNodeEntry = {
146
+ session_id: string;
147
+ agent_node_id: string;
148
+ };
144
149
  /** Agent entry in the evaluation (each has name and associated node IDs) */
145
150
  export type EvaluationAgent = {
146
151
  agent_name: string;
147
- agent_node_ids: string[];
152
+ /** Legacy: flat list of node IDs. New: list of { session_id, agent_node_id } */
153
+ agent_node_ids: string[] | EvaluationAgentNodeEntry[];
148
154
  };
149
155
  /** Root evaluation document */
150
156
  export type Evaluation = {
@@ -51,6 +51,18 @@ export declare function formatDateFriendly(iso: string): string;
51
51
  * @returns The truncated text
52
52
  */
53
53
  export declare function truncateText(text: string, maxLength: number): string;
54
+ /**
55
+ * True for plain object literals (own enumerable keys, not arrays, Date, etc.).
56
+ */
57
+ export declare function isPlainObject(value: unknown): value is Record<string, unknown>;
58
+ /**
59
+ * Escapes `\` and `.` in a segment so dot-delimited path keys stay unambiguous (e.g. JSON tree UIs).
60
+ */
61
+ export declare function escapeDotPathSegment(segment: string): string;
62
+ /**
63
+ * Compact JSON-like string for tree / debug views: strings use JSON quoting; null and undefined as words.
64
+ */
65
+ export declare function formatJsonTreePrimitive(value: unknown): string;
54
66
  /**
55
67
  * Styled-components utility for conditional styling
56
68
  * @param condition - The condition to check
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@railtownai/railtracks-visualizer",
3
- "version": "0.0.58",
3
+ "version": "0.0.60",
4
4
  "license": "MIT",
5
5
  "author": "Railtown AI",
6
6
  "description": "A visualizer for Railtracks agentic flows",
@@ -1,22 +0,0 @@
1
- import React from "react";
2
- interface NodeData {
3
- label: string;
4
- nodeType?: "Tool" | "Agent" | "Coordinator";
5
- details?: any;
6
- id?: string;
7
- edges?: any[];
8
- edgeDetails?: {
9
- input_args?: any[];
10
- input_kwargs?: any;
11
- output?: any;
12
- state?: string;
13
- status?: string;
14
- }[];
15
- }
16
- interface CoordinatorNodeProps {
17
- data: NodeData;
18
- id: string;
19
- onInspect?: (nodeData: NodeData) => void;
20
- }
21
- export declare const CoordinatorNode: React.FC<CoordinatorNodeProps>;
22
- export {};