@railtownai/railtracks-visualizer 0.0.43 → 0.0.45
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
|
|
@@ -17100,16 +17114,17 @@ const getNodeIcon$1 = (nodeType, modelProvider)=>{
|
|
|
17100
17114
|
return "🎯";
|
|
17101
17115
|
}
|
|
17102
17116
|
if (nodeType === "agent") {
|
|
17103
|
-
|
|
17117
|
+
const normalizedProvider = modelProvider?.toLowerCase();
|
|
17118
|
+
if (normalizedProvider === "openai") {
|
|
17104
17119
|
return /*#__PURE__*/ React.createElement(OpenAIIcon, null);
|
|
17105
17120
|
}
|
|
17106
|
-
if (
|
|
17121
|
+
if (normalizedProvider === "anthropic") {
|
|
17107
17122
|
return /*#__PURE__*/ React.createElement(AnthropicIcon, null);
|
|
17108
17123
|
}
|
|
17109
|
-
if (
|
|
17124
|
+
if (normalizedProvider === "google" || normalizedProvider === "vertex_ai") {
|
|
17110
17125
|
return /*#__PURE__*/ React.createElement(GoogleIcon, null);
|
|
17111
17126
|
}
|
|
17112
|
-
if (
|
|
17127
|
+
if (normalizedProvider === "ollama") {
|
|
17113
17128
|
return /*#__PURE__*/ React.createElement(OllamaIcon, null);
|
|
17114
17129
|
}
|
|
17115
17130
|
}
|
|
@@ -17581,25 +17596,26 @@ const NodeIcon$3 = styled.div`
|
|
|
17581
17596
|
|
|
17582
17597
|
// Helper function to get node icon
|
|
17583
17598
|
const getNodeIcon = (modelProvider, size = 16)=>{
|
|
17584
|
-
|
|
17599
|
+
const normalizedProvider = modelProvider?.toLowerCase();
|
|
17600
|
+
if (normalizedProvider === "openai") {
|
|
17585
17601
|
return /*#__PURE__*/ React.createElement(OpenAIIcon, {
|
|
17586
17602
|
width: size,
|
|
17587
17603
|
height: size
|
|
17588
17604
|
});
|
|
17589
17605
|
}
|
|
17590
|
-
if (
|
|
17606
|
+
if (normalizedProvider === "anthropic") {
|
|
17591
17607
|
return /*#__PURE__*/ React.createElement(AnthropicIcon, {
|
|
17592
17608
|
width: size,
|
|
17593
17609
|
height: size
|
|
17594
17610
|
});
|
|
17595
17611
|
}
|
|
17596
|
-
if (
|
|
17612
|
+
if (normalizedProvider === "google" || normalizedProvider === "vertex_ai") {
|
|
17597
17613
|
return /*#__PURE__*/ React.createElement(GoogleIcon, {
|
|
17598
17614
|
width: size,
|
|
17599
17615
|
height: size
|
|
17600
17616
|
});
|
|
17601
17617
|
}
|
|
17602
|
-
if (
|
|
17618
|
+
if (normalizedProvider === "ollama") {
|
|
17603
17619
|
return /*#__PURE__*/ React.createElement(OllamaIcon, {
|
|
17604
17620
|
width: size,
|
|
17605
17621
|
height: size
|
|
@@ -27531,6 +27547,7 @@ exports.defaultTheme = defaultTheme;
|
|
|
27531
27547
|
exports.detectContentType = detectContentType;
|
|
27532
27548
|
exports.formatCurrency = formatCurrency;
|
|
27533
27549
|
exports.formatLatency = formatLatency;
|
|
27550
|
+
exports.formatNumberWithCommas = formatNumberWithCommas;
|
|
27534
27551
|
exports.formatToolCalls = formatToolCalls;
|
|
27535
27552
|
exports.getColor = getColor;
|
|
27536
27553
|
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
|
|
@@ -17080,16 +17094,17 @@ const getNodeIcon$1 = (nodeType, modelProvider)=>{
|
|
|
17080
17094
|
return "🎯";
|
|
17081
17095
|
}
|
|
17082
17096
|
if (nodeType === "agent") {
|
|
17083
|
-
|
|
17097
|
+
const normalizedProvider = modelProvider?.toLowerCase();
|
|
17098
|
+
if (normalizedProvider === "openai") {
|
|
17084
17099
|
return /*#__PURE__*/ React__default.createElement(OpenAIIcon, null);
|
|
17085
17100
|
}
|
|
17086
|
-
if (
|
|
17101
|
+
if (normalizedProvider === "anthropic") {
|
|
17087
17102
|
return /*#__PURE__*/ React__default.createElement(AnthropicIcon, null);
|
|
17088
17103
|
}
|
|
17089
|
-
if (
|
|
17104
|
+
if (normalizedProvider === "google" || normalizedProvider === "vertex_ai") {
|
|
17090
17105
|
return /*#__PURE__*/ React__default.createElement(GoogleIcon, null);
|
|
17091
17106
|
}
|
|
17092
|
-
if (
|
|
17107
|
+
if (normalizedProvider === "ollama") {
|
|
17093
17108
|
return /*#__PURE__*/ React__default.createElement(OllamaIcon, null);
|
|
17094
17109
|
}
|
|
17095
17110
|
}
|
|
@@ -17561,25 +17576,26 @@ const NodeIcon$3 = styled.div`
|
|
|
17561
17576
|
|
|
17562
17577
|
// Helper function to get node icon
|
|
17563
17578
|
const getNodeIcon = (modelProvider, size = 16)=>{
|
|
17564
|
-
|
|
17579
|
+
const normalizedProvider = modelProvider?.toLowerCase();
|
|
17580
|
+
if (normalizedProvider === "openai") {
|
|
17565
17581
|
return /*#__PURE__*/ React__default.createElement(OpenAIIcon, {
|
|
17566
17582
|
width: size,
|
|
17567
17583
|
height: size
|
|
17568
17584
|
});
|
|
17569
17585
|
}
|
|
17570
|
-
if (
|
|
17586
|
+
if (normalizedProvider === "anthropic") {
|
|
17571
17587
|
return /*#__PURE__*/ React__default.createElement(AnthropicIcon, {
|
|
17572
17588
|
width: size,
|
|
17573
17589
|
height: size
|
|
17574
17590
|
});
|
|
17575
17591
|
}
|
|
17576
|
-
if (
|
|
17592
|
+
if (normalizedProvider === "google" || normalizedProvider === "vertex_ai") {
|
|
17577
17593
|
return /*#__PURE__*/ React__default.createElement(GoogleIcon, {
|
|
17578
17594
|
width: size,
|
|
17579
17595
|
height: size
|
|
17580
17596
|
});
|
|
17581
17597
|
}
|
|
17582
|
-
if (
|
|
17598
|
+
if (normalizedProvider === "ollama") {
|
|
17583
17599
|
return /*#__PURE__*/ React__default.createElement(OllamaIcon, {
|
|
17584
17600
|
width: size,
|
|
17585
17601
|
height: size
|
|
@@ -27485,4 +27501,4 @@ const GlobalStyles = ()=>{
|
|
|
27485
27501
|
return getSafeColor(props.theme, path, fallback);
|
|
27486
27502
|
};
|
|
27487
27503
|
|
|
27488
|
-
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 };
|
|
27504
|
+
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
|
+
};
|
|
@@ -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.
|
|
3
|
+
"version": "0.0.45",
|
|
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.
|
|
110
|
-
"vitest": "4.0.
|
|
109
|
+
"vite": "7.3.1",
|
|
110
|
+
"vitest": "4.0.18"
|
|
111
111
|
},
|
|
112
112
|
"prettier": {
|
|
113
113
|
"singleQuote": false,
|