mirror of
https://github.com/QwenLM/qwen-code.git
synced 2026-04-30 12:40:44 +00:00
Implement SubagentStart and SubagentStop hook and add test
This commit is contained in:
parent
8945044913
commit
018f00adad
12 changed files with 1758 additions and 31 deletions
|
|
@ -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
|
||||
*/
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue