@@ -4,7 +4,7 @@ import { homedir } from 'node:os';
44import path , { join } from 'node:path' ;
55import process from 'node:process' ;
66import { unreachable } from '@core/errorutil' ;
7- import { groupBy } from 'es-toolkit' ; // TODO: after node20 is deprecated, switch to native Object.groupBy
7+ import { groupBy , uniq } from 'es-toolkit' ; // TODO: after node20 is deprecated, switch to native Object.groupBy
88import { sort } from 'fast-sort' ;
99import { createFixture } from 'fs-fixture' ;
1010import { isDirectorySync } from 'path-type' ;
@@ -349,7 +349,7 @@ function extractUniqueModels<T>(
349349 entries : T [ ] ,
350350 getModel : ( entry : T ) => string | undefined ,
351351) : string [ ] {
352- return [ ... new Set ( entries . map ( getModel ) . filter ( ( m ) : m is string => m != null && m !== '<synthetic>' ) ) ] ;
352+ return uniq ( entries . map ( getModel ) . filter ( ( m ) : m is string => m != null && m !== '<synthetic>' ) ) ;
353353}
354354
355355/**
@@ -790,10 +790,10 @@ export async function loadSessionData(
790790 ) ;
791791
792792 // Collect all unique versions
793- const versionSet = new Set < string > ( ) ;
793+ const versions : string [ ] = [ ] ;
794794 for ( const entry of entries ) {
795795 if ( entry . data . version != null ) {
796- versionSet . add ( entry . data . version ) ;
796+ versions . push ( entry . data . version ) ;
797797 }
798798 }
799799
@@ -822,7 +822,7 @@ export async function loadSessionData(
822822 projectPath : latestEntry . projectPath ,
823823 ...totals ,
824824 lastActivity : formatDate ( latestEntry . timestamp ) ,
825- versions : Array . from ( versionSet ) . sort ( ) ,
825+ versions : uniq ( versions ) . sort ( ) ,
826826 modelsUsed,
827827 modelBreakdowns,
828828 } ;
@@ -865,12 +865,12 @@ export async function loadMonthlyUsageData(
865865 const modelBreakdowns = createModelBreakdowns ( modelAggregates ) ;
866866
867867 // Collect unique models
868- const modelsSet = new Set < string > ( ) ;
868+ const models : string [ ] = [ ] ;
869869 for ( const data of dailyEntries ) {
870870 for ( const model of data . modelsUsed ) {
871871 // Skip synthetic model
872872 if ( model !== '<synthetic>' ) {
873- modelsSet . add ( model ) ;
873+ models . push ( model ) ;
874874 }
875875 }
876876 }
@@ -896,7 +896,7 @@ export async function loadMonthlyUsageData(
896896 cacheCreationTokens : totalCacheCreationTokens ,
897897 cacheReadTokens : totalCacheReadTokens ,
898898 totalCost,
899- modelsUsed : Array . from ( modelsSet ) ,
899+ modelsUsed : uniq ( models ) ,
900900 modelBreakdowns,
901901 } ;
902902
0 commit comments