refactor(coding-agent): unify tool and event handler context creation
Tools now use ExtensionRunner.createContext() instead of a separate inline context factory. This ensures tools and event handlers share the same context, fixing ctx.shutdown() and other context methods. - Made ExtensionRunner.createContext() public - Changed wrapRegisteredTools to accept ExtensionRunner instead of getContext callback - Create ExtensionRunner when SDK custom tools are present (not just extensions) - Removed redundant inline context factory from sdk.ts
This commit is contained in:
@@ -296,7 +296,11 @@ export class ExtensionRunner {
|
||||
this.shutdownHandler();
|
||||
}
|
||||
|
||||
private createContext(): ExtensionContext {
|
||||
/**
|
||||
* Create an ExtensionContext for use in event handlers and tool execution.
|
||||
* Context values are resolved at call time, so changes via initialize() are reflected.
|
||||
*/
|
||||
createContext(): ExtensionContext {
|
||||
return {
|
||||
ui: this.uiContext,
|
||||
hasUI: this.hasUI(),
|
||||
|
||||
Reference in New Issue
Block a user