mirror of
https://github.com/getcompanion-ai/co-mono.git
synced 2026-04-17 07:03:25 +00:00
fix(coding-agent): make ctx.shutdown() work from extension tools
The tool execution context was created with a no-op shutdown handler. Now it delegates to ExtensionRunner.shutdown() which uses the handler set by the mode via initialize().
This commit is contained in:
parent
baf6fe4b39
commit
cf0466d96c
2 changed files with 11 additions and 1 deletions
|
|
@ -288,6 +288,14 @@ export class ExtensionRunner {
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Request a graceful shutdown. Called by extension tools and event handlers.
|
||||||
|
* The actual shutdown behavior is provided by the mode via initialize().
|
||||||
|
*/
|
||||||
|
shutdown(): void {
|
||||||
|
this.shutdownHandler();
|
||||||
|
}
|
||||||
|
|
||||||
private createContext(): ExtensionContext {
|
private createContext(): ExtensionContext {
|
||||||
return {
|
return {
|
||||||
ui: this.uiContext,
|
ui: this.uiContext,
|
||||||
|
|
|
||||||
|
|
@ -527,7 +527,9 @@ export async function createAgentSession(options: CreateAgentSessionOptions = {}
|
||||||
abort: () => {
|
abort: () => {
|
||||||
session.abort();
|
session.abort();
|
||||||
},
|
},
|
||||||
shutdown: () => {},
|
shutdown: () => {
|
||||||
|
extensionRunner?.shutdown();
|
||||||
|
},
|
||||||
}));
|
}));
|
||||||
|
|
||||||
// Create tool registry mapping name -> tool (for extension getTools/setTools)
|
// Create tool registry mapping name -> tool (for extension getTools/setTools)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue