Implement SubagentStart and SubagentStop hook and add test

This commit is contained in:
DennisYu07 2026-03-05 02:47:14 -08:00
parent 8945044913
commit 018f00adad
12 changed files with 1758 additions and 31 deletions

View file

@ -236,6 +236,48 @@ export class HookSystem {
: undefined;
}
/**
* Fire a SubagentStart event - called when a subagent is spawned
*/
async fireSubagentStartEvent(
agentId: string,
agentType: AgentType | string,
permissionMode: PermissionMode,
): Promise<DefaultHookOutput | undefined> {
const result = await this.hookEventHandler.fireSubagentStartEvent(
agentId,
agentType,
permissionMode,
);
return result.finalOutput
? createHookOutput('SubagentStart', result.finalOutput)
: undefined;
}
/**
* Fire a SubagentStop event - called when a subagent finishes
*/
async fireSubagentStopEvent(
agentId: string,
agentType: AgentType | string,
agentTranscriptPath: string,
lastAssistantMessage: string,
stopHookActive: boolean,
permissionMode: PermissionMode,
): Promise<DefaultHookOutput | undefined> {
const result = await this.hookEventHandler.fireSubagentStopEvent(
agentId,
agentType,
agentTranscriptPath,
lastAssistantMessage,
stopHookActive,
permissionMode,
);
return result.finalOutput
? createHookOutput('SubagentStop', result.finalOutput)
: undefined;
}
/**
* Fire a PermissionRequest event
*/