(agentId: string)
| 541 | * @returns A promise that resolves to a Blob containing the agent data |
| 542 | */ |
| 543 | export async function exportAgentToFile(agentId: string): Promise<Blob> { |
| 544 | const agent = await getAgent(agentId); |
| 545 | if (!agent) throw new Error(`Agent ${agentId} not found`); |
| 546 | |
| 547 | const code = await getAgentCode(agentId); |
| 548 | if (code === null) throw new Error(`Code for agent ${agentId} not found`); |
| 549 | |
| 550 | const memory = await getAgentMemory(agentId); |
| 551 | |
| 552 | const exportData: AgentExport = { |
| 553 | id: agent.id, |
| 554 | name: agent.name, |
| 555 | description: agent.description, |
| 556 | model_name: agent.model_name, |
| 557 | system_prompt: agent.system_prompt, |
| 558 | loop_interval_seconds: agent.loop_interval_seconds, |
| 559 | only_on_significant_change: agent.only_on_significant_change, |
| 560 | code, |
| 561 | memory |
| 562 | }; |
| 563 | |
| 564 | const yamlStr = yaml.dump(exportData); |
| 565 | return new Blob([yamlStr], { type: 'application/x-yaml' }); |
| 566 | } |
| 567 | |
| 568 | export async function downloadAgent(agentId: string): Promise<void> { |
| 569 | try { |
nothing calls this directly
no test coverage detected