fix(hooks): add lowercase tool names to truncator hooks

Tool names in builtinTools are lowercase ('grep', 'glob') but truncator
hooks were checking for capitalized names ('Grep', 'Glob'), causing
truncation to never trigger and resulting in context window overflow.

🤖 GENERATED WITH ASSISTANCE OF [OhMyOpenCode](https://github.com/code-yeongyu/oh-my-opencode)
This commit is contained in:
YeonGyu-Kim
2025-12-15 19:02:31 +09:00
parent 50112b97ea
commit 2524c90850
2 changed files with 3 additions and 1 deletions

View File

@@ -75,7 +75,7 @@ function truncateToTokenLimit(output: string, maxTokens: number): { result: stri
}
export function createGrepOutputTruncatorHook(ctx: PluginInput) {
const GREP_TOOLS = ["safe_grep", "Grep"]
const GREP_TOOLS = ["grep", "Grep", "safe_grep"]
const toolExecuteAfter = async (
input: { tool: string; sessionID: string; callID: string },

View File

@@ -2,8 +2,10 @@ import type { PluginInput } from "@opencode-ai/plugin"
import { createDynamicTruncator } from "../shared/dynamic-truncator"
const TRUNCATABLE_TOOLS = [
"grep",
"Grep",
"safe_grep",
"glob",
"Glob",
"safe_glob",
"lsp_find_references",