MCPcopy Create free account
hub / github.com/Roy3838/Observer / exportAgentToFile

Function exportAgentToFile

app/src/utils/agent_database.ts:550–574  ·  view source on GitHub ↗
(agentId: string)

Source from the content-addressed store, hash-verified

548 * @returns A promise that resolves to a Blob containing the agent data
549 */
550export async function exportAgentToFile(agentId: string): Promise<Blob> {
551 const agent = await getAgent(agentId);
552 if (!agent) throw new Error(`Agent ${agentId} not found`);
553
554 const code = await getAgentCode(agentId);
555 if (code === null) throw new Error(`Code for agent ${agentId} not found`);
556
557 const memory = await getAgentMemory(agentId);
558
559 const exportData: AgentExport = {
560 id: agent.id,
561 name: agent.name,
562 description: agent.description,
563 model_name: agent.model_name,
564 system_prompt: agent.system_prompt,
565 loop_interval_seconds: agent.loop_interval_seconds,
566 only_on_significant_change: agent.only_on_significant_change,
567 ...(agent.classification ? { classification: agent.classification } : {}), // js-yaml can't dump undefined
568 code,
569 memory
570 };
571
572 const yamlStr = yaml.dump(exportData);
573 return new Blob([yamlStr], { type: 'application/x-yaml' });
574}
575
576export async function downloadAgent(agentId: string): Promise<void> {
577 try {

Callers

nothing calls this directly

Calls 3

getAgentFunction · 0.85
getAgentCodeFunction · 0.85
getAgentMemoryFunction · 0.85

Tested by

no test coverage detected