From 6713b30cc1973c190444084b31a5187e1f7f2371 Mon Sep 17 00:00:00 2001 From: YeonGyu-Kim Date: Sat, 11 Apr 2026 23:37:05 +0900 Subject: [PATCH] refactor(hooks): drop no-op directory injector callbacks Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus --- src/hooks/directory-agents-injector/hook.ts | 17 +++++------------ src/hooks/directory-readme-injector/hook.ts | 17 +++++------------ 2 files changed, 10 insertions(+), 24 deletions(-) diff --git a/src/hooks/directory-agents-injector/hook.ts b/src/hooks/directory-agents-injector/hook.ts index fba64cc7b..c1f62208f 100644 --- a/src/hooks/directory-agents-injector/hook.ts +++ b/src/hooks/directory-agents-injector/hook.ts @@ -16,8 +16,10 @@ interface ToolExecuteOutput { metadata: unknown; } -interface ToolExecuteBeforeOutput { - args: unknown; +interface DirectoryAgentsInjectorHook { + "tool.execute.before"?: (input: ToolExecuteInput, output: { args: unknown }) => Promise; + "tool.execute.after": (input: ToolExecuteInput, output: ToolExecuteOutput) => Promise; + event: (input: EventInput) => Promise; } interface EventInput { @@ -30,7 +32,7 @@ interface EventInput { export function createDirectoryAgentsInjectorHook( ctx: PluginInput, modelCacheState?: { anthropicContext1MEnabled: boolean }, -) { +): DirectoryAgentsInjectorHook { const sessionCaches = new Map>(); const truncator = createDynamicTruncator(ctx, modelCacheState); @@ -50,14 +52,6 @@ export function createDirectoryAgentsInjectorHook( } }; - const toolExecuteBefore = async ( - input: ToolExecuteInput, - output: ToolExecuteBeforeOutput, - ): Promise => { - void input; - void output; - }; - const eventHandler = async ({ event }: EventInput) => { const props = event.properties as Record | undefined; @@ -80,7 +74,6 @@ export function createDirectoryAgentsInjectorHook( }; return { - "tool.execute.before": toolExecuteBefore, "tool.execute.after": toolExecuteAfter, event: eventHandler, }; diff --git a/src/hooks/directory-readme-injector/hook.ts b/src/hooks/directory-readme-injector/hook.ts index d621c7f27..0fdab1858 100644 --- a/src/hooks/directory-readme-injector/hook.ts +++ b/src/hooks/directory-readme-injector/hook.ts @@ -16,8 +16,10 @@ interface ToolExecuteOutput { metadata: unknown; } -interface ToolExecuteBeforeOutput { - args: unknown; +interface DirectoryReadmeInjectorHook { + "tool.execute.before"?: (input: ToolExecuteInput, output: { args: unknown }) => Promise; + "tool.execute.after": (input: ToolExecuteInput, output: ToolExecuteOutput) => Promise; + event: (input: EventInput) => Promise; } interface EventInput { @@ -30,7 +32,7 @@ interface EventInput { export function createDirectoryReadmeInjectorHook( ctx: PluginInput, modelCacheState?: { anthropicContext1MEnabled: boolean }, -) { +): DirectoryReadmeInjectorHook { const sessionCaches = new Map>(); const truncator = createDynamicTruncator(ctx, modelCacheState); @@ -50,14 +52,6 @@ export function createDirectoryReadmeInjectorHook( } }; - const toolExecuteBefore = async ( - input: ToolExecuteInput, - output: ToolExecuteBeforeOutput, - ): Promise => { - void input; - void output; - }; - const eventHandler = async ({ event }: EventInput) => { const props = event.properties as Record | undefined; @@ -80,7 +74,6 @@ export function createDirectoryReadmeInjectorHook( }; return { - "tool.execute.before": toolExecuteBefore, "tool.execute.after": toolExecuteAfter, event: eventHandler, };