( agent: AgentDefinition, newWhenToUse: string, newTools: string[] | undefined, newSystemPrompt: string, newColor?: string, newModel?: string, newMemory?: AgentMemoryScope, newEffort?: EffortValue, )
| 271 | * Updates an existing agent file |
| 272 | */ |
| 273 | export async function updateAgentFile( |
| 274 | agent: AgentDefinition, |
| 275 | newWhenToUse: string, |
| 276 | newTools: string[] | undefined, |
| 277 | newSystemPrompt: string, |
| 278 | newColor?: string, |
| 279 | newModel?: string, |
| 280 | newMemory?: AgentMemoryScope, |
| 281 | newEffort?: EffortValue, |
| 282 | ): Promise<void> { |
| 283 | if (agent.source === 'built-in') { |
| 284 | throw new Error('Cannot update built-in agents') |
| 285 | } |
| 286 | |
| 287 | const filePath = getActualAgentFilePath(agent) |
| 288 | |
| 289 | const content = formatAgentAsMarkdown( |
| 290 | agent.agentType, |
| 291 | newWhenToUse, |
| 292 | newTools, |
| 293 | newSystemPrompt, |
| 294 | newColor, |
| 295 | newModel, |
| 296 | newMemory, |
| 297 | newEffort, |
| 298 | ) |
| 299 | |
| 300 | await writeFileAndFlush(filePath, content) |
| 301 | } |
| 302 | |
| 303 | /** |
| 304 | * Deletes an agent file |
no test coverage detected