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

Function deleteAgentFromFile

src/components/agents/agentFileUtils.ts:306–323  ·  view source on GitHub ↗
(
  agent: AgentDefinition,
)

Source from the content-addressed store, hash-verified

304 * Deletes an agent file
305 */
306export async function deleteAgentFromFile(
307 agent: AgentDefinition,
308): Promise<void> {
309 if (agent.source === 'built-in') {
310 throw new Error('Cannot delete built-in agents')
311 }
312
313 const filePath = getActualAgentFilePath(agent)
314
315 try {
316 await unlink(filePath)
317 } catch (e: unknown) {
318 const code = getErrnoCode(e)
319 if (code !== 'ENOENT') {
320 throw e
321 }
322 }
323}
324
325async function writeFileAndFlush(
326 filePath: string,

Callers 1

AgentsMenuFunction · 0.85

Calls 3

getActualAgentFilePathFunction · 0.85
unlinkFunction · 0.85
getErrnoCodeFunction · 0.85

Tested by

no test coverage detected