MCPcopy Create free account
hub / github.com/echoVic/blade-code / destroy

Method destroy

src/agent/ComponentManager.ts:85–112  ·  view source on GitHub ↗

* 销毁所有组件

()

Source from the content-addressed store, hash-verified

83 * 销毁所有组件
84 */
85 public async destroy(): Promise<void> {
86 if (this.isDestroyed) {
87 return;
88 }
89
90 this.log('销毁组件管理器...');
91
92 try {
93 // 销毁所有组件
94 for (const [name, component] of this.components) {
95 this.log(`销毁组件: ${name}`);
96 try {
97 await component.destroy();
98 this.emit('componentDestroyed', { id: name, component });
99 } catch (error) {
100 this.log(`组件 ${name} 销毁失败: ${error}`);
101 this.emit('componentDestructionFailed', { id: name, component, error: error as Error });
102 }
103 }
104
105 this.isDestroyed = true;
106 this.log('组件管理器已销毁');
107 this.emit('destroyed');
108 } catch (error) {
109 this.log(`组件管理器销毁失败: ${error}`);
110 throw error;
111 }
112 }
113
114 /**
115 * 注册组件

Callers 3

removeComponentMethod · 0.45
restartComponentMethod · 0.45

Calls 2

logMethod · 0.95
emitMethod · 0.45

Tested by

no test coverage detected