/** * Agent Export/Import Service * * Provides encrypted, portable agent archives for migrating agents between * machines. Captures all database state (character, memories, entities, * relationships, rooms, participants, worlds, tasks, and optionally logs) * into a single password-encrypted binary file (.eliza-agent). * * Encryption: PBKDF2-SHA256 key derivation + AES-256-GCM * Compression: gzip * * File format (binary): * ELIZA_AGENT_V1\n (15 bytes magic header) * iterations (4 bytes uint32 BE — PBKDF2 iteration count) * salt (32 bytes — PBKDF2 salt) * iv (12 bytes — AES-256-GCM nonce) * tag (16 bytes — AES-GCM authentication tag) * ciphertext (variable — gzip-compressed JSON, encrypted) */ import type { Agent, AgentRuntime, Component, Entity, Log, Memory, Relationship, Room, Task, World } from "@elizaos/core"; export interface AgentExportOptions { /** Include execution logs in the export. Can be large. Defaults to false. */ includeLogs?: boolean; } export interface AgentExportPayload { version: number; exportedAt: string; sourceAgentId: string; agent: Partial; /** Runtime character config (from buildCharacterFromConfig) — may contain * fields not persisted to the DB agent record (style, topics, adjectives, * messageExamples, postExamples, knowledge sources, etc.). On import, this * is merged with the agent record to reconstruct the full character. */ characterConfig?: Record; entities: Entity[]; memories: Memory[]; components: Component[]; rooms: Room[]; participants: Array<{ entityId: string; roomId: string; userState: string | null; }>; relationships: Relationship[]; worlds: World[]; tasks: Task[]; logs: Log[]; } export interface ImportResult { success: boolean; agentId: string; agentName: string; counts: { memories: number; entities: number; components: number; rooms: number; participants: number; relationships: number; worlds: number; tasks: number; logs: number; }; } export interface ExportSizeEstimate { estimatedBytes: number; memoriesCount: number; entitiesCount: number; roomsCount: number; worldsCount: number; tasksCount: number; } export declare class AgentExportError extends Error { constructor(message: string); } /** * Export the current agent's full state as a password-encrypted binary file. * * @param runtime - The running AgentRuntime with an active database adapter * @param password - User-provided password for encryption * @param options - Export options (e.g., whether to include logs) * @returns A Buffer containing the encrypted .eliza-agent file */ export declare function exportAgent(runtime: AgentRuntime, password: string, options?: AgentExportOptions): Promise; /** * Import an agent from a password-encrypted .eliza-agent file. * * @param runtime - An AgentRuntime with an active database adapter (the agent * will be created in this database, not overwriting the current agent) * @param fileBuffer - The raw bytes of the .eliza-agent file * @param password - The password used when the file was exported * @returns An ImportResult describing what was imported */ export declare function importAgent(runtime: AgentRuntime, fileBuffer: Buffer, password: string): Promise; /** * Estimate the size of an agent export without actually creating it. * Useful for showing the user how large the export will be. */ export declare function estimateExportSize(runtime: AgentRuntime): Promise; //# sourceMappingURL=agent-export.d.ts.map