feat(hooks): add tool-output-truncator for dynamic context-aware truncation

Refactor grep-output-truncator into a general-purpose tool-output-truncator
that applies dynamic truncation to multiple tools based on context window usage.

Truncated tools:
- Grep, safe_grep (existing)
- Glob, safe_glob (new)
- lsp_find_references (new)
- lsp_document_symbols (new)
- lsp_workspace_symbols (new)
- lsp_diagnostics (new)
- ast_grep_search (new)

Uses the new dynamic-truncator utility from shared/ for context-aware
output size limits based on remaining context window tokens.

🤖 GENERATED WITH ASSISTANCE OF [OhMyOpenCode](https://github.com/code-yeongyu/oh-my-opencode)
This commit is contained in:
YeonGyu-Kim
2025-12-14 10:56:50 +09:00
parent 521bcd5667
commit 25a5c2eeb4
4 changed files with 52 additions and 11 deletions

View File

@@ -44,6 +44,7 @@ export const HookNameSchema = z.enum([
"session-notification",
"comment-checker",
"grep-output-truncator",
"tool-output-truncator",
"directory-agents-injector",
"directory-readme-injector",
"empty-task-response-detector",
@@ -52,7 +53,7 @@ export const HookNameSchema = z.enum([
"rules-injector",
"background-notification",
"auto-update-checker",
"ultrawork-mode",
"keyword-detector",
"agent-usage-reminder",
])