@@ -18,10 +18,7 @@ import { renderSystemPrompt, type PromptStore } from "./prompts"
1818import { buildProtectedToolsExtension } from "./prompts/extensions/system"
1919import {
2020 applyPendingCompressionDurations ,
21- clearCompressionStart ,
2221 consumeCompressionStart ,
23- queueCompressionDuration ,
24- recordCompressionStart ,
2522 resolveCompressionDuration ,
2623} from "./compress/timing"
2724import {
@@ -299,9 +296,10 @@ export function createEventHandler(state: SessionState, logger: Logger) {
299296 }
300297
301298 const startedAt = eventTime ?? Date . now ( )
302- if ( ! recordCompressionStart ( state , part . callID , startedAt ) ) {
299+ if ( state . compressionTiming . startsByCallId . has ( part . callID ) ) {
303300 return
304301 }
302+ state . compressionTiming . startsByCallId . set ( part . callID , startedAt )
305303 logger . debug ( "Recorded compression start" , {
306304 callID : part . callID ,
307305 startedAt,
@@ -320,7 +318,10 @@ export function createEventHandler(state: SessionState, logger: Logger) {
320318 return
321319 }
322320
323- queueCompressionDuration ( state , part . callID , durationMs )
321+ state . compressionTiming . pendingByCallId . set ( part . callID , {
322+ callId : part . callID ,
323+ durationMs,
324+ } )
324325
325326 const updates = applyPendingCompressionDurations ( state )
326327 if ( updates === 0 ) {
@@ -342,7 +343,7 @@ export function createEventHandler(state: SessionState, logger: Logger) {
342343 }
343344
344345 if ( typeof part . callID === "string" ) {
345- clearCompressionStart ( state , part . callID )
346+ state . compressionTiming . startsByCallId . delete ( part . callID )
346347 }
347348 }
348349}
0 commit comments