@@ -22,10 +22,15 @@ export interface PruneToolNudge {
2222 frequency : number
2323}
2424
25+ export interface PruneToolTurnProtection {
26+ enabled : boolean
27+ turns : number
28+ }
29+
2530export interface PruneTool {
2631 enabled : boolean
2732 protectedTools : string [ ]
28- protectedTurns : number
33+ turnProtection : PruneToolTurnProtection
2934 nudge : PruneToolNudge
3035}
3136
@@ -73,7 +78,9 @@ export const VALID_CONFIG_KEYS = new Set([
7378 'strategies.pruneTool' ,
7479 'strategies.pruneTool.enabled' ,
7580 'strategies.pruneTool.protectedTools' ,
76- 'strategies.pruneTool.protectedTurns' ,
81+ 'strategies.pruneTool.turnProtection' ,
82+ 'strategies.pruneTool.turnProtection.enabled' ,
83+ 'strategies.pruneTool.turnProtection.turns' ,
7784 'strategies.pruneTool.nudge' ,
7885 'strategies.pruneTool.nudge.enabled' ,
7986 'strategies.pruneTool.nudge.frequency'
@@ -160,8 +167,13 @@ function validateConfigTypes(config: Record<string, any>): ValidationError[] {
160167 if ( strategies . pruneTool . protectedTools !== undefined && ! Array . isArray ( strategies . pruneTool . protectedTools ) ) {
161168 errors . push ( { key : 'strategies.pruneTool.protectedTools' , expected : 'string[]' , actual : typeof strategies . pruneTool . protectedTools } )
162169 }
163- if ( strategies . pruneTool . protectedTurns !== undefined && typeof strategies . pruneTool . protectedTurns !== 'number' ) {
164- errors . push ( { key : 'strategies.pruneTool.protectedTurns' , expected : 'number' , actual : typeof strategies . pruneTool . protectedTurns } )
170+ if ( strategies . pruneTool . turnProtection ) {
171+ if ( strategies . pruneTool . turnProtection . enabled !== undefined && typeof strategies . pruneTool . turnProtection . enabled !== 'boolean' ) {
172+ errors . push ( { key : 'strategies.pruneTool.turnProtection.enabled' , expected : 'boolean' , actual : typeof strategies . pruneTool . turnProtection . enabled } )
173+ }
174+ if ( strategies . pruneTool . turnProtection . turns !== undefined && typeof strategies . pruneTool . turnProtection . turns !== 'number' ) {
175+ errors . push ( { key : 'strategies.pruneTool.turnProtection.turns' , expected : 'number' , actual : typeof strategies . pruneTool . turnProtection . turns } )
176+ }
165177 }
166178 if ( strategies . pruneTool . nudge ) {
167179 if ( strategies . pruneTool . nudge . enabled !== undefined && typeof strategies . pruneTool . nudge . enabled !== 'boolean' ) {
@@ -245,7 +257,10 @@ const defaultConfig: PluginConfig = {
245257 pruneTool : {
246258 enabled : true ,
247259 protectedTools : [ ...DEFAULT_PROTECTED_TOOLS ] ,
248- protectedTurns : 4 ,
260+ turnProtection : {
261+ enabled : false ,
262+ turns : 4
263+ } ,
249264 nudge : {
250265 enabled : true ,
251266 frequency : 10
@@ -343,14 +358,17 @@ function createDefaultConfig(): void {
343358 "enabled": true
344359 },
345360 // Exposes a prune tool to your LLM to call when it determines pruning is necessary
346- "pruneTool": {
347- "enabled": true,
361+ \ "pruneTool\ ": {
362+ \ "enabled\ ": true,
348363 // Additional tools to protect from pruning
349- "protectedTools": [],
350- // Protect tools from pruning for N turns after they are called (0 = disabled)
351- "protectedTurns": 4,
364+ \"protectedTools\": [],
365+ // Protect tools from pruning for N turns after they are called
366+ \"turnProtection\": {
367+ \"enabled\": false,
368+ \"turns\": 4
369+ },
352370 // Nudge the LLM to use the prune tool (every <frequency> tool results)
353- "nudge": {
371+ \ "nudge\ ": {
354372 "enabled": true,
355373 "frequency": 10
356374 }
@@ -434,7 +452,10 @@ function mergeStrategies(
434452 ...( override . pruneTool ?. protectedTools ?? [ ] )
435453 ] )
436454 ] ,
437- protectedTurns : override . pruneTool ?. protectedTurns ?? base . pruneTool . protectedTurns ,
455+ turnProtection : {
456+ enabled : override . pruneTool ?. turnProtection ?. enabled ?? base . pruneTool . turnProtection . enabled ,
457+ turns : override . pruneTool ?. turnProtection ?. turns ?? base . pruneTool . turnProtection . turns
458+ } ,
438459 nudge : {
439460 enabled : override . pruneTool ?. nudge ?. enabled ?? base . pruneTool . nudge . enabled ,
440461 frequency : override . pruneTool ?. nudge ?. frequency ?? base . pruneTool . nudge . frequency
@@ -461,7 +482,7 @@ function deepCloneConfig(config: PluginConfig): PluginConfig {
461482 pruneTool : {
462483 ...config . strategies . pruneTool ,
463484 protectedTools : [ ...config . strategies . pruneTool . protectedTools ] ,
464- protectedTurns : config . strategies . pruneTool . protectedTurns ,
485+ turnProtection : { ... config . strategies . pruneTool . turnProtection } ,
465486 nudge : { ...config . strategies . pruneTool . nudge }
466487 } ,
467488 supersedeWrites : {
0 commit comments