MCPcopy Create free account
hub / github.com/Noumena-Network/code / updateAgentFile

Function updateAgentFile

src/components/agents/agentFileUtils.ts:273–301  ·  view source on GitHub ↗
(
  agent: AgentDefinition,
  newWhenToUse: string,
  newTools: string[] | undefined,
  newSystemPrompt: string,
  newColor?: string,
  newModel?: string,
  newMemory?: AgentMemoryScope,
  newEffort?: EffortValue,
)

Source from the content-addressed store, hash-verified

271 * Updates an existing agent file
272 */
273export 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

Callers 1

AgentEditorFunction · 0.85

Calls 3

getActualAgentFilePathFunction · 0.85
formatAgentAsMarkdownFunction · 0.85
writeFileAndFlushFunction · 0.85

Tested by

no test coverage detected