@@ -84,11 +84,8 @@ function calculateStats(data: NotificationData): {
8484 justNowTokens : number
8585 totalTokens : number
8686} {
87- // "Just now" = AI pruning + pending GC from this notification cycle
8887 const justNowTokens = data . aiTokensSaved + ( data . gcPending ?. tokensCollected ?? 0 )
8988
90- // Session stats are updated BEFORE notification is sent, so they already include
91- // the current cycle's values (totalTokensSaved includes current cycle, totalGCTokens includes current cycle)
9289 const totalTokens = data . sessionStats
9390 ? data . sessionStats . totalTokensSaved + data . sessionStats . totalGCTokens
9491 : justNowTokens
@@ -100,11 +97,9 @@ function formatStatsHeader(
10097 totalTokens : number ,
10198 justNowTokens : number
10299) : string {
103- // Format token counts (formatTokenCount already includes "tokens" suffix)
104100 const totalTokensStr = `~${ formatTokenCount ( totalTokens ) } `
105101 const justNowTokensStr = `~${ formatTokenCount ( justNowTokens ) } `
106102
107- // Pad token strings to align columns
108103 const maxTokenLen = Math . max ( totalTokensStr . length , justNowTokensStr . length )
109104 const totalTokensPadded = totalTokensStr . padStart ( maxTokenLen )
110105 const justNowTokensPadded = justNowTokensStr . padStart ( maxTokenLen )
@@ -121,14 +116,13 @@ function buildDetailedMessage(data: NotificationData, workingDirectory?: string)
121116
122117 let message = formatStatsHeader ( totalTokens , justNowTokens )
123118
124- // Add tool breakdown if there was AI pruning
125119 if ( data . aiPrunedCount > 0 ) {
126120 message += '\n\n▣ Pruned tools:'
127-
121+
128122 for ( const prunedId of data . aiPrunedIds ) {
129123 const normalizedId = prunedId . toLowerCase ( )
130124 const metadata = data . toolMetadata . get ( normalizedId )
131-
125+
132126 if ( metadata ) {
133127 const paramKey = extractParameterKey ( metadata )
134128 if ( paramKey ) {
@@ -140,7 +134,7 @@ function buildDetailedMessage(data: NotificationData, workingDirectory?: string)
140134 }
141135 }
142136
143- const knownCount = data . aiPrunedIds . filter ( id =>
137+ const knownCount = data . aiPrunedIds . filter ( id =>
144138 data . toolMetadata . has ( id . toLowerCase ( ) )
145139 ) . length
146140 const unknownCount = data . aiPrunedIds . length - knownCount
0 commit comments