Skip to content

Commit 47017dc

Browse files
committed
refactor: remove tools.settings.protectedTools
1 parent 298d3eb commit 47017dc

File tree

4 files changed

+2
-35
lines changed

4 files changed

+2
-35
lines changed

README.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -122,8 +122,6 @@ DCP uses its own config file:
122122
> // },
123123
> // How often the context-limit nudge fires (1 = every fetch, 5 = every 5th)
124124
> "nudgeFrequency": 5,
125-
> // Additional tools to protect from pruning
126-
> "protectedTools": [],
127125
> },
128126
> // Unified context compression tool
129127
> "compress": {
@@ -176,7 +174,7 @@ DCP provides a `/dcp` slash command:
176174
By default, these tools are always protected from pruning:
177175
`task`, `todowrite`, `todoread`, `compress`, `batch`, `plan_enter`, `plan_exit`
178176
179-
The `protectedTools` arrays in each section add to this default list.
177+
The `protectedTools` arrays in `commands` and `strategies` add to this default list.
180178
181179
### Config Precedence
182180

dcp.schema.json

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -118,14 +118,6 @@
118118
"minimum": 1,
119119
"description": "How often the context-limit nudge fires when above contextLimit (1 = every fetch, 5 = every 5th fetch)"
120120
},
121-
"protectedTools": {
122-
"type": "array",
123-
"items": {
124-
"type": "string"
125-
},
126-
"default": [],
127-
"description": "Tool names that should be protected from automatic pruning"
128-
},
129121
"contextLimit": {
130122
"description": "When session tokens exceed this limit, a compress nudge is injected (\"X%\" uses percentage of the model's context window)",
131123
"default": 100000,

lib/config.ts

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ export interface CompressTool {
1818

1919
export interface ToolSettings {
2020
nudgeFrequency: number
21-
protectedTools: string[]
2221
contextLimit: number | `${number}%`
2322
modelLimits?: Record<string, number | `${number}%`>
2423
}
@@ -102,7 +101,6 @@ export const VALID_CONFIG_KEYS = new Set([
102101
"tools",
103102
"tools.settings",
104103
"tools.settings.nudgeFrequency",
105-
"tools.settings.protectedTools",
106104
"tools.settings.contextLimit",
107105
"tools.settings.modelLimits",
108106
"tools.compress",
@@ -309,17 +307,6 @@ export function validateConfigTypes(config: Record<string, any>): ValidationErro
309307
actual: `${tools.settings.nudgeFrequency} (will be clamped to 1)`,
310308
})
311309
}
312-
if (
313-
tools.settings.protectedTools !== undefined &&
314-
!Array.isArray(tools.settings.protectedTools)
315-
) {
316-
errors.push({
317-
key: "tools.settings.protectedTools",
318-
expected: "string[]",
319-
actual: typeof tools.settings.protectedTools,
320-
})
321-
}
322-
323310
if (tools.settings.contextLimit !== undefined) {
324311
const isValidNumber = typeof tools.settings.contextLimit === "number"
325312
const isPercentString =
@@ -543,7 +530,6 @@ const defaultConfig: PluginConfig = {
543530
tools: {
544531
settings: {
545532
nudgeFrequency: 5,
546-
protectedTools: [...DEFAULT_PROTECTED_TOOLS],
547533
contextLimit: 100000,
548534
},
549535
compress: {
@@ -707,12 +693,6 @@ function mergeTools(base: PluginConfig["tools"], override?: ToolOverride): Plugi
707693
return {
708694
settings: {
709695
nudgeFrequency: override.settings?.nudgeFrequency ?? base.settings.nudgeFrequency,
710-
protectedTools: [
711-
...new Set([
712-
...base.settings.protectedTools,
713-
...(override.settings?.protectedTools ?? []),
714-
]),
715-
],
716696
contextLimit: override.settings?.contextLimit ?? base.settings.contextLimit,
717697
modelLimits: override.settings?.modelLimits ?? base.settings.modelLimits,
718698
},
@@ -765,7 +745,6 @@ function deepCloneConfig(config: PluginConfig): PluginConfig {
765745
tools: {
766746
settings: {
767747
...config.tools.settings,
768-
protectedTools: [...config.tools.settings.protectedTools],
769748
modelLimits: { ...config.tools.settings.modelLimits },
770749
},
771750
compress: { ...config.tools.compress },

lib/state/tool-cache.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,7 @@ export function syncToolCache(
5151
continue
5252
}
5353

54-
const allProtectedTools = config.tools.settings.protectedTools
55-
const isProtectedTool = allProtectedTools.includes(part.tool)
56-
const tokenCount = isProtectedTool ? undefined : countToolTokens(part)
54+
const tokenCount = countToolTokens(part)
5755

5856
state.toolParameters.set(part.callID, {
5957
tool: part.tool,

0 commit comments

Comments
 (0)