@@ -9,7 +9,6 @@ export function createToolTracker(): ToolTracker {
99 return { seenToolResultIds : new Set ( ) , toolResultCount : 0 , skipNextIdle : false }
1010}
1111
12- /** Reset tool count to 0 (called after a prune event) */
1312export function resetToolTrackerCount ( tracker : ToolTracker ) : void {
1413 tracker . toolResultCount = 0
1514}
@@ -25,7 +24,6 @@ export function trackNewToolResults(messages: any[], tracker: ToolTracker, prote
2524 if ( m . role === 'tool' && m . tool_call_id ) {
2625 if ( ! tracker . seenToolResultIds . has ( m . tool_call_id ) ) {
2726 tracker . seenToolResultIds . add ( m . tool_call_id )
28- // Skip protected tools for nudge frequency counting
2927 const toolName = tracker . getToolName ?.( m . tool_call_id )
3028 if ( ! toolName || ! protectedTools . has ( toolName ) ) {
3129 tracker . toolResultCount ++
@@ -37,7 +35,6 @@ export function trackNewToolResults(messages: any[], tracker: ToolTracker, prote
3735 if ( part . type === 'tool_result' && part . tool_use_id ) {
3836 if ( ! tracker . seenToolResultIds . has ( part . tool_use_id ) ) {
3937 tracker . seenToolResultIds . add ( part . tool_use_id )
40- // Skip protected tools for nudge frequency counting
4138 const toolName = tracker . getToolName ?.( part . tool_use_id )
4239 if ( ! toolName || ! protectedTools . has ( toolName ) ) {
4340 tracker . toolResultCount ++
@@ -63,12 +60,10 @@ export function trackNewToolResultsGemini(contents: any[], tracker: ToolTracker,
6360 if ( ! Array . isArray ( content . parts ) ) continue
6461 for ( const part of content . parts ) {
6562 if ( part . functionResponse ) {
66- // Use position-based ID since Gemini doesn't have tool_call_id
6763 const positionId = `gemini_pos_${ positionCounter } `
6864 positionCounter ++
6965 if ( ! tracker . seenToolResultIds . has ( positionId ) ) {
7066 tracker . seenToolResultIds . add ( positionId )
71- // Skip protected tools for nudge frequency counting
7267 const toolName = part . functionResponse . name
7368 if ( ! toolName || ! protectedTools . has ( toolName ) ) {
7469 tracker . toolResultCount ++
@@ -91,7 +86,6 @@ export function trackNewToolResultsResponses(input: any[], tracker: ToolTracker,
9186 if ( item . type === 'function_call_output' && item . call_id ) {
9287 if ( ! tracker . seenToolResultIds . has ( item . call_id ) ) {
9388 tracker . seenToolResultIds . add ( item . call_id )
94- // Skip protected tools for nudge frequency counting
9589 const toolName = tracker . getToolName ?.( item . call_id )
9690 if ( ! toolName || ! protectedTools . has ( toolName ) ) {
9791 tracker . toolResultCount ++
@@ -103,11 +97,6 @@ export function trackNewToolResultsResponses(input: any[], tracker: ToolTracker,
10397 return newCount
10498}
10599
106- // ============================================================================
107- // OpenAI Chat / Anthropic Format
108- // ============================================================================
109-
110- /** Check if a message content matches nudge text (OpenAI/Anthropic format) */
111100function isNudgeMessage ( msg : any , nudgeText : string ) : boolean {
112101 if ( typeof msg . content === 'string' ) {
113102 return msg . content === nudgeText
@@ -138,11 +127,6 @@ export function injectSynth(messages: any[], instruction: string, nudgeText: str
138127 return false
139128}
140129
141- // ============================================================================
142- // Google/Gemini Format (body.contents with parts)
143- // ============================================================================
144-
145- /** Check if a Gemini content matches nudge text */
146130function isNudgeContentGemini ( content : any , nudgeText : string ) : boolean {
147131 if ( Array . isArray ( content . parts ) && content . parts . length === 1 ) {
148132 const part = content . parts [ 0 ]
@@ -169,11 +153,6 @@ export function injectSynthGemini(contents: any[], instruction: string, nudgeTex
169153 return false
170154}
171155
172- // ============================================================================
173- // OpenAI Responses API Format (body.input with type-based items)
174- // ============================================================================
175-
176- /** Check if a Responses API item matches nudge text */
177156function isNudgeItemResponses ( item : any , nudgeText : string ) : boolean {
178157 if ( typeof item . content === 'string' ) {
179158 return item . content === nudgeText
0 commit comments