diff --git a/mcp/src/benchmark/sessions.ts b/mcp/src/benchmark/sessions.ts index 34dea680c..9289c5a09 100644 --- a/mcp/src/benchmark/sessions.ts +++ b/mcp/src/benchmark/sessions.ts @@ -2,6 +2,7 @@ import { Request, Response } from "express"; import { existsSync, readdirSync, readFileSync, statSync } from "fs"; import path from "path"; import { db } from "../graph/neo4j.js"; +import { toNum } from "../graph/types.js"; import { loadStepMeta, loadSearchProvenance, @@ -140,13 +141,6 @@ function parseSessionMessages(filePath: string): { }; } -function toNum(v: any): number { - if (v == null) return 0; - if (typeof v === "object" && typeof v.toNumber === "function") - return v.toNumber(); - return Number(v) || 0; -} - function calcCost( model: string, providerHint: string, diff --git a/mcp/src/graph/types.ts b/mcp/src/graph/types.ts index 5318b68fb..a027451b5 100644 --- a/mcp/src/graph/types.ts +++ b/mcp/src/graph/types.ts @@ -3,7 +3,7 @@ export interface Node { node_data: NodeData; } -export type BoltInt = number | { low: number; hight: number }; +export type BoltInt = number | { low: number; high: number }; export interface Neo4jNode { identity?: BoltInt; // built-in on some queries @@ -330,12 +330,9 @@ export function normalizeNodeType(label: string): NodeType | undefined { } export function toNum(bi: BoltInt): number { - if (typeof bi === "object") { - if (bi.low) { - return bi.low; - } - } else { - return bi; + if (typeof bi === "number") return bi; + if (bi && typeof bi.low === "number") { + return (bi.high ?? 0) * 2 ** 32 + (bi.low >>> 0); } return 0; }