@railtownai/railtracks-visualizer 0.0.42 → 0.0.44

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 CHANGED
@@ -15383,6 +15383,10 @@ function cn(...inputs) {
15383
15383
  if (absValue >= 1) {
15384
15384
  precision = Math.max(precision, 3);
15385
15385
  }
15386
+ // For values < 1, ensure we show at least 2 decimal places
15387
+ if (absValue < 1) {
15388
+ precision = Math.max(precision, 2);
15389
+ }
15386
15390
  // Cap precision at 8 decimal places
15387
15391
  precision = Math.min(precision, 8);
15388
15392
  // Check if the value rounds to a whole number when rounded to the nearest integer
@@ -15406,6 +15410,16 @@ function cn(...inputs) {
15406
15410
  }
15407
15411
  return `${sign}$${rounded}`;
15408
15412
  }
15413
+ /**
15414
+ * Formats a number with comma separators for thousands
15415
+ * @param value - The number to format
15416
+ * @returns The formatted string with comma separators (e.g., 4420399 -> "4,420,399")
15417
+ */ function formatNumberWithCommas(value) {
15418
+ if (value === null || value === undefined) {
15419
+ return "0";
15420
+ }
15421
+ return value.toLocaleString("en-US");
15422
+ }
15409
15423
  /**
15410
15424
  * Formats latency in a human-readable format
15411
15425
  * @param latency - Latency in seconds
@@ -16135,6 +16149,20 @@ const AnthropicIcon = ({ width = "1.5rem", height = "1.5rem" })=>/*#__PURE__*/ R
16135
16149
  strokeWidth: "0.25"
16136
16150
  }));
16137
16151
 
16152
+ const OllamaIcon = ({ width = "1.5rem", height = "1.5rem" })=>/*#__PURE__*/ React.createElement("svg", {
16153
+ style: {
16154
+ width: typeof width === "number" ? `${width}px` : width,
16155
+ height: typeof height === "number" ? `${height}px` : height,
16156
+ display: "block"
16157
+ },
16158
+ fill: "currentColor",
16159
+ fillRule: "evenodd",
16160
+ viewBox: "0 0 24 24",
16161
+ xmlns: "http://www.w3.org/2000/svg"
16162
+ }, /*#__PURE__*/ React.createElement("title", null, "Ollama"), /*#__PURE__*/ React.createElement("path", {
16163
+ d: "M7.905 1.09c.216.085.411.225.588.41.295.306.544.744.734 1.263.191.522.315 1.1.362 1.68a5.054 5.054 0 012.049-.636l.051-.004c.87-.07 1.73.087 2.48.474.101.053.2.11.297.17.05-.569.172-1.134.36-1.644.19-.52.439-.957.733-1.264a1.67 1.67 0 01.589-.41c.257-.1.53-.118.796-.042.401.114.745.368 1.016.737.248.337.434.769.561 1.287.23.934.27 2.163.115 3.645l.053.04.026.019c.757.576 1.284 1.397 1.563 2.35.435 1.487.216 3.155-.534 4.088l-.018.021.002.003c.417.762.67 1.567.724 2.4l.002.03c.064 1.065-.2 2.137-.814 3.19l-.007.01.01.024c.472 1.157.62 2.322.438 3.486l-.006.039a.651.651 0 01-.747.536.648.648 0 01-.54-.742c.167-1.033.01-2.069-.48-3.123a.643.643 0 01.04-.617l.004-.006c.604-.924.854-1.83.8-2.72-.046-.779-.325-1.544-.8-2.273a.644.644 0 01.18-.886l.009-.006c.243-.159.467-.565.58-1.12a4.229 4.229 0 00-.095-1.974c-.205-.7-.58-1.284-1.105-1.683-.595-.454-1.383-.673-2.38-.61a.653.653 0 01-.632-.371c-.314-.665-.772-1.141-1.343-1.436a3.288 3.288 0 00-1.772-.332c-1.245.099-2.343.801-2.67 1.686a.652.652 0 01-.61.425c-1.067.002-1.893.252-2.497.703-.522.39-.878.935-1.066 1.588a4.07 4.07 0 00-.068 1.886c.112.558.331 1.02.582 1.269l.008.007c.212.207.257.53.109.785-.36.622-.629 1.549-.673 2.44-.05 1.018.186 1.902.719 2.536l.016.019a.643.643 0 01.095.69c-.576 1.236-.753 2.252-.562 3.052a.652.652 0 01-1.269.298c-.243-1.018-.078-2.184.473-3.498l.014-.035-.008-.012a4.339 4.339 0 01-.598-1.309l-.005-.019a5.764 5.764 0 01-.177-1.785c.044-.91.278-1.842.622-2.59l.012-.026-.002-.002c-.293-.418-.51-.953-.63-1.545l-.005-.024a5.352 5.352 0 01.093-2.49c.262-.915.777-1.701 1.536-2.269.06-.045.123-.09.186-.132-.159-1.493-.119-2.73.112-3.67.127-.518.314-.95.562-1.287.27-.368.614-.622 1.015-.737.266-.076.54-.059.797.042zm4.116 9.09c.936 0 1.8.313 2.446.855.63.527 1.005 1.235 1.005 1.94 0 .888-.406 1.58-1.133 2.022-.62.375-1.451.557-2.403.557-1.009 0-1.871-.259-2.493-.734-.617-.47-.963-1.13-.963-1.845 0-.707.398-1.417 1.056-1.946.668-.537 1.55-.849 2.485-.849zm0 .896a3.07 3.07 0 00-1.916.65c-.461.37-.722.835-.722 1.25 0 .428.21.829.61 1.134.455.347 1.124.548 1.943.548.799 0 1.473-.147 1.932-.426.463-.28.7-.686.7-1.257 0-.423-.246-.89-.683-1.256-.484-.405-1.14-.643-1.864-.643zm.662 1.21l.004.004c.12.151.095.37-.056.49l-.292.23v.446a.375.375 0 01-.376.373.375.375 0 01-.376-.373v-.46l-.271-.218a.347.347 0 01-.052-.49.353.353 0 01.494-.051l.215.172.22-.174a.353.353 0 01.49.051zm-5.04-1.919c.478 0 .867.39.867.871a.87.87 0 01-.868.871.87.87 0 01-.867-.87.87.87 0 01.867-.872zm8.706 0c.48 0 .868.39.868.871a.87.87 0 01-.868.871.87.87 0 01-.867-.87.87.87 0 01.867-.872zM7.44 2.3l-.003.002a.659.659 0 00-.285.238l-.005.006c-.138.189-.258.467-.348.832-.17.692-.216 1.631-.124 2.782.43-.128.899-.208 1.404-.237l.01-.001.019-.034c.046-.082.095-.161.148-.239.123-.771.022-1.692-.253-2.444-.134-.364-.297-.65-.453-.813a.628.628 0 00-.107-.09L7.44 2.3zm9.174.04l-.002.001a.628.628 0 00-.107.09c-.156.163-.32.45-.453.814-.29.794-.387 1.776-.23 2.572l.058.097.008.014h.03a5.184 5.184 0 011.466.212c.086-1.124.038-2.043-.128-2.722-.09-.365-.21-.643-.349-.832l-.004-.006a.659.659 0 00-.285-.239h-.004z"
16164
+ }));
16165
+
16138
16166
  const ExpandableTextarea = ({ label, content, isExpanded, onToggle })=>{
16139
16167
  const { theme } = useTheme();
16140
16168
  const themeColors = theme?.colors || {
@@ -17095,6 +17123,9 @@ const getNodeIcon$1 = (nodeType, modelProvider)=>{
17095
17123
  if (modelProvider === "Google" || modelProvider === "Vertex_AI") {
17096
17124
  return /*#__PURE__*/ React.createElement(GoogleIcon, null);
17097
17125
  }
17126
+ if (modelProvider === "ollama") {
17127
+ return /*#__PURE__*/ React.createElement(OllamaIcon, null);
17128
+ }
17098
17129
  }
17099
17130
  return "🤖";
17100
17131
  };
@@ -17582,6 +17613,12 @@ const getNodeIcon = (modelProvider, size = 16)=>{
17582
17613
  height: size
17583
17614
  });
17584
17615
  }
17616
+ if (modelProvider === "ollama") {
17617
+ return /*#__PURE__*/ React.createElement(OllamaIcon, {
17618
+ width: size,
17619
+ height: size
17620
+ });
17621
+ }
17585
17622
  return "🤖";
17586
17623
  };
17587
17624
  const getOverviewLlmDetails = (llmDetails)=>{
@@ -27508,6 +27545,7 @@ exports.defaultTheme = defaultTheme;
27508
27545
  exports.detectContentType = detectContentType;
27509
27546
  exports.formatCurrency = formatCurrency;
27510
27547
  exports.formatLatency = formatLatency;
27548
+ exports.formatNumberWithCommas = formatNumberWithCommas;
27511
27549
  exports.formatToolCalls = formatToolCalls;
27512
27550
  exports.getColor = getColor;
27513
27551
  exports.getSafeColor = getSafeColor;
package/dist/esm/index.js CHANGED
@@ -15363,6 +15363,10 @@ function cn(...inputs) {
15363
15363
  if (absValue >= 1) {
15364
15364
  precision = Math.max(precision, 3);
15365
15365
  }
15366
+ // For values < 1, ensure we show at least 2 decimal places
15367
+ if (absValue < 1) {
15368
+ precision = Math.max(precision, 2);
15369
+ }
15366
15370
  // Cap precision at 8 decimal places
15367
15371
  precision = Math.min(precision, 8);
15368
15372
  // Check if the value rounds to a whole number when rounded to the nearest integer
@@ -15386,6 +15390,16 @@ function cn(...inputs) {
15386
15390
  }
15387
15391
  return `${sign}$${rounded}`;
15388
15392
  }
15393
+ /**
15394
+ * Formats a number with comma separators for thousands
15395
+ * @param value - The number to format
15396
+ * @returns The formatted string with comma separators (e.g., 4420399 -> "4,420,399")
15397
+ */ function formatNumberWithCommas(value) {
15398
+ if (value === null || value === undefined) {
15399
+ return "0";
15400
+ }
15401
+ return value.toLocaleString("en-US");
15402
+ }
15389
15403
  /**
15390
15404
  * Formats latency in a human-readable format
15391
15405
  * @param latency - Latency in seconds
@@ -16115,6 +16129,20 @@ const AnthropicIcon = ({ width = "1.5rem", height = "1.5rem" })=>/*#__PURE__*/ R
16115
16129
  strokeWidth: "0.25"
16116
16130
  }));
16117
16131
 
16132
+ const OllamaIcon = ({ width = "1.5rem", height = "1.5rem" })=>/*#__PURE__*/ React__default.createElement("svg", {
16133
+ style: {
16134
+ width: typeof width === "number" ? `${width}px` : width,
16135
+ height: typeof height === "number" ? `${height}px` : height,
16136
+ display: "block"
16137
+ },
16138
+ fill: "currentColor",
16139
+ fillRule: "evenodd",
16140
+ viewBox: "0 0 24 24",
16141
+ xmlns: "http://www.w3.org/2000/svg"
16142
+ }, /*#__PURE__*/ React__default.createElement("title", null, "Ollama"), /*#__PURE__*/ React__default.createElement("path", {
16143
+ d: "M7.905 1.09c.216.085.411.225.588.41.295.306.544.744.734 1.263.191.522.315 1.1.362 1.68a5.054 5.054 0 012.049-.636l.051-.004c.87-.07 1.73.087 2.48.474.101.053.2.11.297.17.05-.569.172-1.134.36-1.644.19-.52.439-.957.733-1.264a1.67 1.67 0 01.589-.41c.257-.1.53-.118.796-.042.401.114.745.368 1.016.737.248.337.434.769.561 1.287.23.934.27 2.163.115 3.645l.053.04.026.019c.757.576 1.284 1.397 1.563 2.35.435 1.487.216 3.155-.534 4.088l-.018.021.002.003c.417.762.67 1.567.724 2.4l.002.03c.064 1.065-.2 2.137-.814 3.19l-.007.01.01.024c.472 1.157.62 2.322.438 3.486l-.006.039a.651.651 0 01-.747.536.648.648 0 01-.54-.742c.167-1.033.01-2.069-.48-3.123a.643.643 0 01.04-.617l.004-.006c.604-.924.854-1.83.8-2.72-.046-.779-.325-1.544-.8-2.273a.644.644 0 01.18-.886l.009-.006c.243-.159.467-.565.58-1.12a4.229 4.229 0 00-.095-1.974c-.205-.7-.58-1.284-1.105-1.683-.595-.454-1.383-.673-2.38-.61a.653.653 0 01-.632-.371c-.314-.665-.772-1.141-1.343-1.436a3.288 3.288 0 00-1.772-.332c-1.245.099-2.343.801-2.67 1.686a.652.652 0 01-.61.425c-1.067.002-1.893.252-2.497.703-.522.39-.878.935-1.066 1.588a4.07 4.07 0 00-.068 1.886c.112.558.331 1.02.582 1.269l.008.007c.212.207.257.53.109.785-.36.622-.629 1.549-.673 2.44-.05 1.018.186 1.902.719 2.536l.016.019a.643.643 0 01.095.69c-.576 1.236-.753 2.252-.562 3.052a.652.652 0 01-1.269.298c-.243-1.018-.078-2.184.473-3.498l.014-.035-.008-.012a4.339 4.339 0 01-.598-1.309l-.005-.019a5.764 5.764 0 01-.177-1.785c.044-.91.278-1.842.622-2.59l.012-.026-.002-.002c-.293-.418-.51-.953-.63-1.545l-.005-.024a5.352 5.352 0 01.093-2.49c.262-.915.777-1.701 1.536-2.269.06-.045.123-.09.186-.132-.159-1.493-.119-2.73.112-3.67.127-.518.314-.95.562-1.287.27-.368.614-.622 1.015-.737.266-.076.54-.059.797.042zm4.116 9.09c.936 0 1.8.313 2.446.855.63.527 1.005 1.235 1.005 1.94 0 .888-.406 1.58-1.133 2.022-.62.375-1.451.557-2.403.557-1.009 0-1.871-.259-2.493-.734-.617-.47-.963-1.13-.963-1.845 0-.707.398-1.417 1.056-1.946.668-.537 1.55-.849 2.485-.849zm0 .896a3.07 3.07 0 00-1.916.65c-.461.37-.722.835-.722 1.25 0 .428.21.829.61 1.134.455.347 1.124.548 1.943.548.799 0 1.473-.147 1.932-.426.463-.28.7-.686.7-1.257 0-.423-.246-.89-.683-1.256-.484-.405-1.14-.643-1.864-.643zm.662 1.21l.004.004c.12.151.095.37-.056.49l-.292.23v.446a.375.375 0 01-.376.373.375.375 0 01-.376-.373v-.46l-.271-.218a.347.347 0 01-.052-.49.353.353 0 01.494-.051l.215.172.22-.174a.353.353 0 01.49.051zm-5.04-1.919c.478 0 .867.39.867.871a.87.87 0 01-.868.871.87.87 0 01-.867-.87.87.87 0 01.867-.872zm8.706 0c.48 0 .868.39.868.871a.87.87 0 01-.868.871.87.87 0 01-.867-.87.87.87 0 01.867-.872zM7.44 2.3l-.003.002a.659.659 0 00-.285.238l-.005.006c-.138.189-.258.467-.348.832-.17.692-.216 1.631-.124 2.782.43-.128.899-.208 1.404-.237l.01-.001.019-.034c.046-.082.095-.161.148-.239.123-.771.022-1.692-.253-2.444-.134-.364-.297-.65-.453-.813a.628.628 0 00-.107-.09L7.44 2.3zm9.174.04l-.002.001a.628.628 0 00-.107.09c-.156.163-.32.45-.453.814-.29.794-.387 1.776-.23 2.572l.058.097.008.014h.03a5.184 5.184 0 011.466.212c.086-1.124.038-2.043-.128-2.722-.09-.365-.21-.643-.349-.832l-.004-.006a.659.659 0 00-.285-.239h-.004z"
16144
+ }));
16145
+
16118
16146
  const ExpandableTextarea = ({ label, content, isExpanded, onToggle })=>{
16119
16147
  const { theme } = useTheme();
16120
16148
  const themeColors = theme?.colors || {
@@ -17075,6 +17103,9 @@ const getNodeIcon$1 = (nodeType, modelProvider)=>{
17075
17103
  if (modelProvider === "Google" || modelProvider === "Vertex_AI") {
17076
17104
  return /*#__PURE__*/ React__default.createElement(GoogleIcon, null);
17077
17105
  }
17106
+ if (modelProvider === "ollama") {
17107
+ return /*#__PURE__*/ React__default.createElement(OllamaIcon, null);
17108
+ }
17078
17109
  }
17079
17110
  return "🤖";
17080
17111
  };
@@ -17562,6 +17593,12 @@ const getNodeIcon = (modelProvider, size = 16)=>{
17562
17593
  height: size
17563
17594
  });
17564
17595
  }
17596
+ if (modelProvider === "ollama") {
17597
+ return /*#__PURE__*/ React__default.createElement(OllamaIcon, {
17598
+ width: size,
17599
+ height: size
17600
+ });
17601
+ }
17565
17602
  return "🤖";
17566
17603
  };
17567
17604
  const getOverviewLlmDetails = (llmDetails)=>{
@@ -27462,4 +27499,4 @@ const GlobalStyles = ()=>{
27462
27499
  return getSafeColor(props.theme, path, fallback);
27463
27500
  };
27464
27501
 
27465
- export { AgenticFlowVisualizer, AnthropicIcon, Badge, Drawer, Edge, FileSelector, GlobalStyles, GoogleIcon, JsonTreeViewer, Node$1 as Node, OpenAIIcon, SafeThemeProvider, Select, Sheet, ThemeProvider, Timeline, Visualizer, calculateAutoLayout, cn, conditionalStyle, createSafeTheme, darkTheme, defaultTheme, detectContentType, formatCurrency, formatLatency, formatToolCalls, getColor, getSafeColor, getSafeSpacing, getSafeThemeValue, getSpacing, lightTheme, safeStyled, safeThemeColor, safeThemeSpacing, safeThemeValue, toTitleCase, truncateText, useComponentTheme, useSafeTheme, useTheme, useThemeValue };
27502
+ export { AgenticFlowVisualizer, AnthropicIcon, Badge, Drawer, Edge, FileSelector, GlobalStyles, GoogleIcon, JsonTreeViewer, Node$1 as Node, OpenAIIcon, SafeThemeProvider, Select, Sheet, ThemeProvider, Timeline, Visualizer, calculateAutoLayout, cn, conditionalStyle, createSafeTheme, darkTheme, defaultTheme, detectContentType, formatCurrency, formatLatency, formatNumberWithCommas, formatToolCalls, getColor, getSafeColor, getSafeSpacing, getSafeThemeValue, getSpacing, lightTheme, safeStyled, safeThemeColor, safeThemeSpacing, safeThemeValue, toTitleCase, truncateText, useComponentTheme, useSafeTheme, useTheme, useThemeValue };
@@ -0,0 +1,10 @@
1
+ import type { SessionListItem } from "../hooks/useSessions";
2
+ /**
3
+ * Calculate total input and output tokens for a session across all runs
4
+ * @param session - The session to calculate tokens for
5
+ * @returns An object containing inputTokens and outputTokens totals
6
+ */
7
+ export declare function calculateSessionTokens(session: SessionListItem): {
8
+ inputTokens: number;
9
+ outputTokens: number;
10
+ };
@@ -0,0 +1,7 @@
1
+ import React from "react";
2
+ interface OllamaIconProps {
3
+ width?: string | number;
4
+ height?: string | number;
5
+ }
6
+ export declare const OllamaIcon: React.FC<OllamaIconProps>;
7
+ export {};
@@ -1,3 +1,4 @@
1
1
  export { OpenAIIcon } from "./OpenAIIcon";
2
2
  export { GoogleIcon } from "./GoogleIcon";
3
3
  export { AnthropicIcon } from "./AnthropicIcon";
4
+ export { OllamaIcon } from "./OllamaIcon";
@@ -13,6 +13,12 @@ export declare function toTitleCase(str: string): string;
13
13
  * @returns The formatted dollar string with appropriate precision
14
14
  */
15
15
  export declare function formatCurrency(value: number | null | undefined): string;
16
+ /**
17
+ * Formats a number with comma separators for thousands
18
+ * @param value - The number to format
19
+ * @returns The formatted string with comma separators (e.g., 4420399 -> "4,420,399")
20
+ */
21
+ export declare function formatNumberWithCommas(value: number | null | undefined): string;
16
22
  /**
17
23
  * Formats latency in a human-readable format
18
24
  * @param latency - Latency in seconds
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@railtownai/railtracks-visualizer",
3
- "version": "0.0.42",
3
+ "version": "0.0.44",
4
4
  "license": "MIT",
5
5
  "author": "Railtown AI",
6
6
  "description": "A visualizer for Railtracks agentic flows",
@@ -106,8 +106,8 @@
106
106
  "storybook": "10.2.0",
107
107
  "typescript": "5.9.3",
108
108
  "uuid": "13.0.0",
109
- "vite": "7.2.4",
110
- "vitest": "4.0.12"
109
+ "vite": "7.3.1",
110
+ "vitest": "4.0.18"
111
111
  },
112
112
  "prettier": {
113
113
  "singleQuote": false,