1- import type { FormatDescriptor , ToolOutput , ToolTracker } from "../types"
1+ import type { FormatDescriptor , ToolOutput } from "../types"
22import type { PluginState } from "../../state"
33
44function isNudgeMessage ( msg : any , nudgeText : string ) : boolean {
@@ -30,36 +30,6 @@ function injectSynth(messages: any[], instruction: string, nudgeText: string): b
3030 return false
3131}
3232
33- function trackNewToolResults ( messages : any [ ] , tracker : ToolTracker , protectedTools : Set < string > ) : number {
34- let newCount = 0
35- for ( const m of messages ) {
36- if ( m . role === 'tool' && m . tool_call_id ) {
37- if ( ! tracker . seenToolResultIds . has ( m . tool_call_id ) ) {
38- tracker . seenToolResultIds . add ( m . tool_call_id )
39- const toolName = tracker . getToolName ?.( m . tool_call_id )
40- if ( ! toolName || ! protectedTools . has ( toolName ) ) {
41- tracker . toolResultCount ++
42- newCount ++
43- }
44- }
45- } else if ( m . role === 'user' && Array . isArray ( m . content ) ) {
46- for ( const part of m . content ) {
47- if ( part . type === 'tool_result' && part . tool_use_id ) {
48- if ( ! tracker . seenToolResultIds . has ( part . tool_use_id ) ) {
49- tracker . seenToolResultIds . add ( part . tool_use_id )
50- const toolName = tracker . getToolName ?.( part . tool_use_id )
51- if ( ! toolName || ! protectedTools . has ( toolName ) ) {
52- tracker . toolResultCount ++
53- newCount ++
54- }
55- }
56- }
57- }
58- }
59- }
60- return newCount
61- }
62-
6333function injectPrunableList ( messages : any [ ] , injection : string ) : boolean {
6434 if ( ! injection ) return false
6535 messages . push ( { role : 'user' , content : injection } )
@@ -81,10 +51,6 @@ export const openaiChatFormat: FormatDescriptor = {
8151 return injectSynth ( data , instruction , nudgeText )
8252 } ,
8353
84- trackNewToolResults ( data : any [ ] , tracker : ToolTracker , protectedTools : Set < string > ) : number {
85- return trackNewToolResults ( data , tracker , protectedTools )
86- } ,
87-
8854 injectPrunableList ( data : any [ ] , injection : string ) : boolean {
8955 return injectPrunableList ( data , injection )
9056 } ,
0 commit comments