mirror of
https://github.com/getcompanion-ai/co-mono.git
synced 2026-04-16 02:01:29 +00:00
Replace custom tool dispose() with shutdown session event
Breaking change: CustomAgentTool.dispose() removed. Use onSession with reason 'shutdown' instead for cleanup. - Add 'shutdown' to SessionEvent.reason for custom tools - Remove dispose() method from CustomAgentTool interface - Make emitToolSessionEvent() public on AgentSession - Emit shutdown event to tools in InteractiveMode.shutdown() - Update custom-tools.md with new API and examples
This commit is contained in:
parent
450d77fb79
commit
ff78ac2f84
4 changed files with 46 additions and 34 deletions
|
|
@ -1239,7 +1239,7 @@ export class InteractiveMode {
|
|||
|
||||
/**
|
||||
* Gracefully shutdown the agent.
|
||||
* Emits shutdown event to hooks, then exits.
|
||||
* Emits shutdown event to hooks and tools, then exits.
|
||||
*/
|
||||
private async shutdown(): Promise<void> {
|
||||
// Emit shutdown event to hooks
|
||||
|
|
@ -1250,6 +1250,9 @@ export class InteractiveMode {
|
|||
});
|
||||
}
|
||||
|
||||
// Emit shutdown event to custom tools
|
||||
await this.session.emitToolSessionEvent("shutdown");
|
||||
|
||||
this.stop();
|
||||
process.exit(0);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue