()
| 41 | } |
| 42 | |
| 43 | public async init(): Promise<void> { |
| 44 | if (this.isInitialized) { |
| 45 | return; |
| 46 | } |
| 47 | |
| 48 | try { |
| 49 | this.log('初始化工具组件...'); |
| 50 | |
| 51 | // 创建工具管理器 |
| 52 | this.toolManager = await createToolManager(this.config, this.config.includeBuiltinTools); |
| 53 | |
| 54 | // 应用过滤器 |
| 55 | this.applyFilters(); |
| 56 | |
| 57 | // 设置事件监听 |
| 58 | this.setupEventListeners(); |
| 59 | |
| 60 | this.isInitialized = true; |
| 61 | this.log('工具组件初始化完成', { |
| 62 | totalTools: this.toolManager.getTools().length, |
| 63 | stats: this.toolManager.getStats(), |
| 64 | }); |
| 65 | } catch (error) { |
| 66 | this.error('工具组件初始化失败', error); |
| 67 | throw error; |
| 68 | } |
| 69 | } |
| 70 | |
| 71 | public async destroy(): Promise<void> { |
| 72 | if (!this.isInitialized) { |
nothing calls this directly
no test coverage detected