Wrap custom tools with hooks (#248)
This commit is contained in:
@@ -315,9 +315,6 @@ export async function main(args: string[]) {
|
||||
if (hooks.length > 0) {
|
||||
const timeout = settingsManager.getHookTimeout();
|
||||
hookRunner = new HookRunner(hooks, cwd, timeout);
|
||||
|
||||
// Wrap tools with hook callbacks
|
||||
selectedTools = wrapToolsWithHooks(selectedTools, hookRunner);
|
||||
}
|
||||
|
||||
// Discover and load custom tools from:
|
||||
@@ -344,6 +341,11 @@ export async function main(args: string[]) {
|
||||
selectedTools = [...selectedTools, ...customToolInstances] as typeof selectedTools;
|
||||
}
|
||||
|
||||
// Wrap tools with hook callbacks (built-in and custom)
|
||||
if (hookRunner) {
|
||||
selectedTools = wrapToolsWithHooks(selectedTools, hookRunner);
|
||||
}
|
||||
|
||||
// Create agent
|
||||
const agent = new Agent({
|
||||
initialState: {
|
||||
|
||||
Reference in New Issue
Block a user