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

Method init

src/agent/Agent.ts:107–134  ·  view source on GitHub ↗

* 初始化 Agent 和所有管理器

()

Source from the content-addressed store, hash-verified

105 * 初始化 Agent 和所有管理器
106 */
107 public async init(): Promise<void> {
108 if (this.isInitialized) {
109 throw new Error('Agent 已经初始化');
110 }
111
112 if (this.isDestroyed) {
113 throw new Error('Agent 已被销毁,无法重新初始化');
114 }
115
116 this.log('初始化 Agent...');
117
118 try {
119 // 初始化 LLM 管理器
120 if (this.config.llm) {
121 await this.llmManager.init();
122 }
123
124 // 初始化组件管理器
125 await this.componentManager.init();
126
127 this.isInitialized = true;
128 this.log('Agent 初始化完成');
129 this.emit('initialized');
130 } catch (error) {
131 this.log(`初始化失败: ${error}`);
132 throw error;
133 }
134 }
135
136 /**
137 * 销毁 Agent 和所有管理器

Callers 8

agentLlmCommandFunction · 0.95
startCustomerServiceFunction · 0.95
startCodeAssistantFunction · 0.95
startBasicAssistantFunction · 0.95
agentWithContextExampleFunction · 0.95
demonstrateFullAgentFunction · 0.95
demonstrateAdvancedUsageFunction · 0.95
llmCommandFunction · 0.45

Calls 2

logMethod · 0.95
emitMethod · 0.45

Tested by

no test coverage detected