@railtownai/railtracks-visualizer 0.0.54 → 0.0.56

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.
@@ -0,0 +1,33 @@
1
+ /**
2
+ * Reusable comparison UI for two evaluations. Accepts Evaluation DTOs;
3
+ * DTO is auto-detected and transformed internally.
4
+ * Use in page view or drawer.
5
+ *
6
+ * @example
7
+ * ```tsx
8
+ * <EvaluationsCompareView
9
+ * evaluations={evaluations}
10
+ * evaluationId1={id1}
11
+ * evaluationId2={id2}
12
+ * onEvaluationId1Change={setId1}
13
+ * onEvaluationId2Change={setId2}
14
+ * />
15
+ * ```
16
+ */
17
+ import React from "react";
18
+ import type { Evaluation } from "../pages/evaluations.types";
19
+ import type { Evaluation as EvaluationDto } from "../../dto/Evaluation";
20
+ export interface EvaluationsCompareViewProps {
21
+ /** Evaluation DTOs from your API. Pre-transformed data is also accepted. */
22
+ evaluations: (Evaluation | EvaluationDto)[];
23
+ evaluationId1: string | null;
24
+ evaluationId2: string | null;
25
+ onEvaluationId1Change: (id: string | null) => void;
26
+ onEvaluationId2Change: (id: string | null) => void;
27
+ loading?: boolean;
28
+ /** When true, evaluation dropdowns are visible. When false (default), read-only view with no dropdowns or change button. */
29
+ showEvaluationComparisonDropdowns?: boolean;
30
+ /** Optional href for back link. When provided, a "Back to Evaluations" link is shown. */
31
+ backHref?: string;
32
+ }
33
+ export declare const EvaluationsCompareView: React.FC<EvaluationsCompareViewProps>;
@@ -14,6 +14,13 @@
14
14
  import React from "react";
15
15
  import type { Evaluation } from "../pages/evaluations.types";
16
16
  import type { Evaluation as EvaluationDto } from "../../dto/Evaluation";
17
+ /** Server-side pagination config. When provided, table uses server pagination instead of client. */
18
+ export interface EvaluationsTablePagination {
19
+ total: number;
20
+ current: number;
21
+ pageSize: number;
22
+ onPageChange: (page: number, pageSize: number) => void;
23
+ }
17
24
  export interface EvaluationsTableProps {
18
25
  /** Evaluation DTOs from your API. Pre-transformed data is also accepted. */
19
26
  evaluations: (Evaluation | EvaluationDto)[];
@@ -21,11 +28,21 @@ export interface EvaluationsTableProps {
21
28
  error?: string | null;
22
29
  onRefresh?: () => void;
23
30
  onRowClick?: (evaluation: Evaluation) => void;
24
- onCompare?: (sourceId: string, targetId: string) => void;
31
+ onCompare?: (evaluationId1: string, evaluationId2: string) => void;
32
+ /** When provided, opens the compare drawer with these IDs (e.g. from URL compare param). */
33
+ compareIdsFromUrl?: [string, string] | null;
34
+ /** Called when compare selections change (e.g. to update URL). */
35
+ onCompareUrlChange?: (id1: string | null, id2: string | null) => void;
25
36
  showFilters?: boolean;
26
37
  showCompare?: boolean;
27
38
  emptyMessage?: React.ReactNode;
28
39
  /** Optional title rendered to the left of the toolbar (e.g. "Evaluations") */
29
40
  title?: React.ReactNode;
41
+ /** Server-side pagination. When provided, table uses server pagination instead of client. */
42
+ pagination?: EvaluationsTablePagination;
43
+ /** When server pagination, filter changes are passed up for platform to refetch. */
44
+ onFiltersChange?: (agents: string[], metricFilter: string | null) => void;
45
+ /** When server pagination, fetch evaluations by ID for compare drawer (e.g. from URL). */
46
+ onFetchEvaluationsByIds?: (ids: string[]) => Promise<(Evaluation | EvaluationDto)[]>;
30
47
  }
31
48
  export declare const EvaluationsTable: React.FC<EvaluationsTableProps>;
@@ -5,14 +5,14 @@
5
5
  import React from "react";
6
6
  import type { Evaluation } from "./evaluations.types";
7
7
  import type { Evaluation as EvaluationDto } from "../../dto/Evaluation";
8
- export interface EvaluationsCompareProps {
8
+ export interface EvaluationsCompareDrawerProps {
9
9
  open: boolean;
10
10
  onClose: () => void;
11
- sourceEvaluationId: string | null;
12
- targetEvaluationId: string | null;
11
+ evaluationId1: string | null;
12
+ evaluationId2: string | null;
13
13
  /** Evaluation DTOs from your API. Pre-transformed data is also accepted. */
14
14
  evaluations: (Evaluation | EvaluationDto)[];
15
- onSourceChange: (id: string | null) => void;
16
- onTargetChange: (id: string | null) => void;
15
+ onEvaluationId1Change: (id: string | null) => void;
16
+ onEvaluationId2Change: (id: string | null) => void;
17
17
  }
18
- export declare const EvaluationsCompare: React.FC<EvaluationsCompareProps>;
18
+ export declare const EvaluationsCompareDrawer: React.FC<EvaluationsCompareDrawerProps>;
@@ -1,2 +1,6 @@
1
1
  import React from "react";
2
- export declare const EvaluationsComparePage: React.FC;
2
+ export interface EvaluationsComparePageProps {
3
+ /** Optional href for back link (e.g. "#/evaluations" for HashRouter). */
4
+ backHref?: string;
5
+ }
6
+ export declare const EvaluationsComparePage: React.FC<EvaluationsComparePageProps>;
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Helper to determine if two evaluations have the same metrics for comparison.
3
+ * Use before rendering EvaluationsCompareView so the Container app can decide
4
+ * whether to show the compare UI or display an error.
5
+ *
6
+ * Compares metric names across ALL evaluators (LLM, Tool, Judge, etc.).
7
+ * Supports both Evaluation (page format) and Evaluation DTO (API format).
8
+ */
9
+ import type { Evaluation } from "../pages/evaluations.types";
10
+ import type { Evaluation as EvaluationDto } from "../../dto/Evaluation";
11
+ /**
12
+ * Returns true if both evaluations have the same set of metrics
13
+ * (evaluator_id + metric name) across all evaluators.
14
+ */
15
+ export declare function evaluationsHaveSameMetrics(a: Evaluation | EvaluationDto | null | undefined, b: Evaluation | EvaluationDto | null | undefined): boolean;
@@ -2,13 +2,18 @@ export { default as AgenticFlowVisualizer } from "./components/AgenticFlowVisual
2
2
  export { default as Visualizer } from "./components/Visualizer";
3
3
  export { SessionDetails } from "./agenthub/pages/session-details";
4
4
  export { EvaluationsTable } from "./agenthub/components/EvaluationsTable";
5
- export { EvaluationsCompare } from "./agenthub/pages/evaluations-compare-drawer";
6
- export type { EvaluationsCompareProps } from "./agenthub/pages/evaluations-compare-drawer";
5
+ export type { EvaluationsTableProps, EvaluationsTablePagination } from "./agenthub/components/EvaluationsTable";
6
+ export { EvaluationsCompareView } from "./agenthub/components/EvaluationsCompareView";
7
+ export type { EvaluationsCompareViewProps } from "./agenthub/components/EvaluationsCompareView";
8
+ export { EvaluationsCompareDrawer } from "./agenthub/pages/evaluations-compare-drawer";
9
+ export type { EvaluationsCompareDrawerProps } from "./agenthub/pages/evaluations-compare-drawer";
10
+ export { EvaluationsComparePage } from "./agenthub/pages/evaluations-compare";
7
11
  export { EvaluationDetailsDrawer } from "./agenthub/pages/evaluation-details-drawer";
8
12
  export type { EvaluationDetailsDrawerProps } from "./agenthub/pages/evaluation-details-drawer";
9
13
  export { EvaluatorResult } from "./agenthub/pages/evaluator-result";
10
14
  export type { EvaluatorResultProps } from "./agenthub/pages/evaluator-result";
11
15
  export { transformEvaluation, isEvaluationDto } from "./agenthub/utils/transformEvaluation";
16
+ export { evaluationsHaveSameMetrics } from "./agenthub/utils/evaluationsHaveSameMetrics";
12
17
  export type { Evaluation } from "./dto/Evaluation";
13
18
  export { Node } from "./components/Node";
14
19
  export { Edge } from "./components/Edge";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@railtownai/railtracks-visualizer",
3
- "version": "0.0.54",
3
+ "version": "0.0.56",
4
4
  "license": "MIT",
5
5
  "author": "Railtown AI",
6
6
  "description": "A visualizer for Railtracks agentic flows",