Skip to content

Commit 986a6d8

Browse files
authored
Merge pull request #47 from Tarquinen/feat/rename-pruning-tool
feat: rename pruning tool to 'prune (DCP)' and make protectedTools additive
2 parents 065b51a + 081c536 commit 986a6d8

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ const plugin: Plugin = (async (ctx) => {
8888
event: createEventHandler(ctx.client, janitor, logger, config, toolTracker),
8989
"chat.params": createChatParamsHandler(ctx.client, state, logger),
9090
tool: config.strategies.onTool.length > 0 ? {
91-
context_pruning: createPruningTool(janitor, config, toolTracker),
91+
"prune (DCP)": createPruningTool(janitor, config, toolTracker),
9292
} : undefined,
9393
}
9494
}) satisfies Plugin

lib/config.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ export interface ConfigResult {
3030
const defaultConfig: PluginConfig = {
3131
enabled: true,
3232
debug: false,
33-
protectedTools: ['task', 'todowrite', 'todoread', 'context_pruning'],
33+
protectedTools: ['task', 'todowrite', 'todoread', 'prune (DCP)'],
3434
showModelErrorToasts: true,
3535
strictModelSelection: false,
3636
pruning_summary: 'detailed',
@@ -122,9 +122,9 @@ function createDefaultConfig(): void {
122122
// Summary display: "off", "minimal", or "detailed"
123123
"pruning_summary": "detailed",
124124
// How often to nudge the AI to prune (every N tool results, 0 = disabled)
125-
"nudge_freq": 10,
126-
// Tools that should never be pruned
127-
"protectedTools": ["task", "todowrite", "todoread", "context_pruning"]
125+
"nudge_freq": 10
126+
// Additional tools to protect from pruning (merged with built-in: task, todowrite, todoread, prune (DCP))
127+
// "protectedTools": ["bash"]
128128
}
129129
`
130130

@@ -196,7 +196,7 @@ export function getConfig(ctx?: PluginInput): ConfigResult {
196196
config = {
197197
enabled: globalConfig.enabled ?? config.enabled,
198198
debug: globalConfig.debug ?? config.debug,
199-
protectedTools: globalConfig.protectedTools ?? config.protectedTools,
199+
protectedTools: [...new Set([...config.protectedTools, ...(globalConfig.protectedTools ?? [])])],
200200
model: globalConfig.model ?? config.model,
201201
showModelErrorToasts: globalConfig.showModelErrorToasts ?? config.showModelErrorToasts,
202202
strictModelSelection: globalConfig.strictModelSelection ?? config.strictModelSelection,
@@ -227,7 +227,7 @@ export function getConfig(ctx?: PluginInput): ConfigResult {
227227
config = {
228228
enabled: projectConfig.enabled ?? config.enabled,
229229
debug: projectConfig.debug ?? config.debug,
230-
protectedTools: projectConfig.protectedTools ?? config.protectedTools,
230+
protectedTools: [...new Set([...config.protectedTools, ...(projectConfig.protectedTools ?? [])])],
231231
model: projectConfig.model ?? config.model,
232232
showModelErrorToasts: projectConfig.showModelErrorToasts ?? config.showModelErrorToasts,
233233
strictModelSelection: projectConfig.strictModelSelection ?? config.strictModelSelection,

0 commit comments

Comments
 (0)