Migrate beforeTool and afterTool hooks to hookSystem (#17204)

Co-authored-by: Ishaan Gupta <ishaankone@gmail.com>
Co-authored-by: Tommaso Sciortino <sciortino@gmail.com>
This commit is contained in:
Vedant Mahajan
2026-01-21 22:43:03 +05:30
committed by GitHub
parent 4d77934a83
commit 6b14dc8240
6 changed files with 149 additions and 225 deletions
@@ -253,17 +253,7 @@ describe('ToolExecutor', () => {
// 2. Mock executeToolWithHooks to trigger the PID callback
const testPid = 12345;
vi.mocked(coreToolHookTriggers.executeToolWithHooks).mockImplementation(
async (
_inv,
_name,
_sig,
_bus,
_hooks,
_tool,
_liveCb,
_shellCfg,
setPidCallback,
) => {
async (_inv, _name, _sig, _tool, _liveCb, _shellCfg, setPidCallback) => {
// Simulate the shell tool reporting a PID
if (setPidCallback) {
setPidCallback(testPid);
@@ -66,8 +66,6 @@ export class ToolExecutor {
: undefined;
const shellExecutionConfig = this.config.getShellExecutionConfig();
const hooksEnabled = this.config.getEnableHooks();
const messageBus = this.config.getMessageBus();
return runInDevTraceSpan(
{
@@ -95,8 +93,6 @@ export class ToolExecutor {
invocation,
toolName,
signal,
messageBus,
hooksEnabled,
tool,
liveOutputCallback,
shellExecutionConfig,
@@ -108,8 +104,6 @@ export class ToolExecutor {
invocation,
toolName,
signal,
messageBus,
hooksEnabled,
tool,
liveOutputCallback,
shellExecutionConfig,