refactor(hooks): drop no-op directory injector callbacks
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
@@ -16,8 +16,10 @@ interface ToolExecuteOutput {
|
|||||||
metadata: unknown;
|
metadata: unknown;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface ToolExecuteBeforeOutput {
|
interface DirectoryAgentsInjectorHook {
|
||||||
args: unknown;
|
"tool.execute.before"?: (input: ToolExecuteInput, output: { args: unknown }) => Promise<void>;
|
||||||
|
"tool.execute.after": (input: ToolExecuteInput, output: ToolExecuteOutput) => Promise<void>;
|
||||||
|
event: (input: EventInput) => Promise<void>;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface EventInput {
|
interface EventInput {
|
||||||
@@ -30,7 +32,7 @@ interface EventInput {
|
|||||||
export function createDirectoryAgentsInjectorHook(
|
export function createDirectoryAgentsInjectorHook(
|
||||||
ctx: PluginInput,
|
ctx: PluginInput,
|
||||||
modelCacheState?: { anthropicContext1MEnabled: boolean },
|
modelCacheState?: { anthropicContext1MEnabled: boolean },
|
||||||
) {
|
): DirectoryAgentsInjectorHook {
|
||||||
const sessionCaches = new Map<string, Set<string>>();
|
const sessionCaches = new Map<string, Set<string>>();
|
||||||
const truncator = createDynamicTruncator(ctx, modelCacheState);
|
const truncator = createDynamicTruncator(ctx, modelCacheState);
|
||||||
|
|
||||||
@@ -50,14 +52,6 @@ export function createDirectoryAgentsInjectorHook(
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const toolExecuteBefore = async (
|
|
||||||
input: ToolExecuteInput,
|
|
||||||
output: ToolExecuteBeforeOutput,
|
|
||||||
): Promise<void> => {
|
|
||||||
void input;
|
|
||||||
void output;
|
|
||||||
};
|
|
||||||
|
|
||||||
const eventHandler = async ({ event }: EventInput) => {
|
const eventHandler = async ({ event }: EventInput) => {
|
||||||
const props = event.properties as Record<string, unknown> | undefined;
|
const props = event.properties as Record<string, unknown> | undefined;
|
||||||
|
|
||||||
@@ -80,7 +74,6 @@ export function createDirectoryAgentsInjectorHook(
|
|||||||
};
|
};
|
||||||
|
|
||||||
return {
|
return {
|
||||||
"tool.execute.before": toolExecuteBefore,
|
|
||||||
"tool.execute.after": toolExecuteAfter,
|
"tool.execute.after": toolExecuteAfter,
|
||||||
event: eventHandler,
|
event: eventHandler,
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -16,8 +16,10 @@ interface ToolExecuteOutput {
|
|||||||
metadata: unknown;
|
metadata: unknown;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface ToolExecuteBeforeOutput {
|
interface DirectoryReadmeInjectorHook {
|
||||||
args: unknown;
|
"tool.execute.before"?: (input: ToolExecuteInput, output: { args: unknown }) => Promise<void>;
|
||||||
|
"tool.execute.after": (input: ToolExecuteInput, output: ToolExecuteOutput) => Promise<void>;
|
||||||
|
event: (input: EventInput) => Promise<void>;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface EventInput {
|
interface EventInput {
|
||||||
@@ -30,7 +32,7 @@ interface EventInput {
|
|||||||
export function createDirectoryReadmeInjectorHook(
|
export function createDirectoryReadmeInjectorHook(
|
||||||
ctx: PluginInput,
|
ctx: PluginInput,
|
||||||
modelCacheState?: { anthropicContext1MEnabled: boolean },
|
modelCacheState?: { anthropicContext1MEnabled: boolean },
|
||||||
) {
|
): DirectoryReadmeInjectorHook {
|
||||||
const sessionCaches = new Map<string, Set<string>>();
|
const sessionCaches = new Map<string, Set<string>>();
|
||||||
const truncator = createDynamicTruncator(ctx, modelCacheState);
|
const truncator = createDynamicTruncator(ctx, modelCacheState);
|
||||||
|
|
||||||
@@ -50,14 +52,6 @@ export function createDirectoryReadmeInjectorHook(
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const toolExecuteBefore = async (
|
|
||||||
input: ToolExecuteInput,
|
|
||||||
output: ToolExecuteBeforeOutput,
|
|
||||||
): Promise<void> => {
|
|
||||||
void input;
|
|
||||||
void output;
|
|
||||||
};
|
|
||||||
|
|
||||||
const eventHandler = async ({ event }: EventInput) => {
|
const eventHandler = async ({ event }: EventInput) => {
|
||||||
const props = event.properties as Record<string, unknown> | undefined;
|
const props = event.properties as Record<string, unknown> | undefined;
|
||||||
|
|
||||||
@@ -80,7 +74,6 @@ export function createDirectoryReadmeInjectorHook(
|
|||||||
};
|
};
|
||||||
|
|
||||||
return {
|
return {
|
||||||
"tool.execute.before": toolExecuteBefore,
|
|
||||||
"tool.execute.after": toolExecuteAfter,
|
"tool.execute.after": toolExecuteAfter,
|
||||||
event: eventHandler,
|
event: eventHandler,
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user