@@ -42,7 +42,6 @@ export function installFetchWrapper(
4242 }
4343
4444 globalThis . fetch = async ( input : any , init ?: any ) => {
45- // Skip all DCP processing for subagent sessions
4645 if ( state . lastSeenSessionId && state . subagentSessions . has ( state . lastSeenSessionId ) ) {
4746 logger . debug ( "fetch-wrapper" , "Skipping DCP processing for subagent session" , {
4847 sessionId : state . lastSeenSessionId . substring ( 0 , 8 )
@@ -84,13 +83,10 @@ export function installFetchWrapper(
8483 }
8584 }
8685
87- // Run strategies when new tools are cached
88- // We use all tool IDs for deduplication detection (to find duplicates across requests)
89- // but pruning is session-scoped via state.prunedIds
9086 const sessionId = state . lastSeenSessionId
9187 const toolIdsAfter = Array . from ( state . toolParameters . keys ( ) )
9288 const newToolsCached = toolIdsAfter . filter ( id => ! toolIdsBefore . has ( id ) ) . length > 0
93-
89+
9490 if ( sessionId && newToolsCached && state . toolParameters . size > 0 ) {
9591 const toolIds = Array . from ( state . toolParameters . keys ( ) )
9692 const alreadyPruned = state . prunedIds . get ( sessionId ) ?? [ ]
@@ -103,16 +99,12 @@ export function installFetchWrapper(
10399 config . protectedTools
104100 )
105101 if ( result . prunedIds . length > 0 ) {
106- // Normalize to lowercase to match janitor's ID normalization
107102 const normalizedIds = result . prunedIds . map ( id => id . toLowerCase ( ) )
108103 state . prunedIds . set ( sessionId , [ ...new Set ( [ ...alreadyPruned , ...normalizedIds ] ) ] )
109-
110- // Track GC activity for the next notification
111104 accumulateGCStats ( state , sessionId , result . prunedIds , body , logger )
112105 }
113106 }
114107
115- // Trim cache to prevent unbounded memory growth
116108 trimToolParametersCache ( state )
117109 }
118110
0 commit comments