(agentId: string, config: Partial<AgentConfig>)
| 94 | } |
| 95 | |
| 96 | async updateAgentConfig(agentId: string, config: Partial<AgentConfig>): Promise<void> { |
| 97 | const agentIndex = this.state.availableAgents.findIndex(a => a.id === agentId); |
| 98 | if (agentIndex === -1) { |
| 99 | throw new Error(`Agent not found: ${agentId}`); |
| 100 | } |
| 101 | |
| 102 | const updatedAgents = [...this.state.availableAgents]; |
| 103 | const currentAgent = updatedAgents[agentIndex]; |
| 104 | updatedAgents[agentIndex] = { |
| 105 | ...currentAgent, |
| 106 | config: { |
| 107 | ...currentAgent.config, |
| 108 | ...config |
| 109 | } as AgentConfig |
| 110 | }; |
| 111 | |
| 112 | this.updateState({ availableAgents: updatedAgents }); |
| 113 | |
| 114 | // Also update currentAgent when it matches |
| 115 | if (this.state.currentAgent?.id === agentId) { |
| 116 | this.updateState({ currentAgent: updatedAgents[agentIndex] }); |
| 117 | } |
| 118 | |
| 119 | this.emitEvent({ |
| 120 | type: 'agent:changed', |
| 121 | payload: updatedAgents[agentIndex] |
| 122 | }); |
| 123 | } |
| 124 | |
| 125 | // Chat management |
| 126 | async createChatSession(agentId: string): Promise<ChatSession> { |
nothing calls this directly
no test coverage detected