UNPKG

create-eliza

Version:

Initialize an Eliza project

62 lines (58 loc) 1.43 kB
import { createRequire } from 'module'; const require = createRequire(import.meta.url); import { AgentRuntime, logger, v4_default } from "./chunk-MIDXMARR.js"; import { __require } from "./chunk-WCMDOJQK.js"; // src/project.ts import { resolve } from "node:path"; async function loadProject(path) { try { const projectPath = resolve(path); let projectConfig; try { const configPath = resolve(projectPath, "eliza.config.js"); projectConfig = __require(configPath); } catch (error) { logger.warn("No eliza.config.js found, using default configuration"); projectConfig = { agents: [{ character: { name: "Test Agent", bio: ["A test agent for running automated tests"], templates: {}, settings: {} } }] }; } const agent = projectConfig.agents[0]; if (!agent) { throw new Error("No agents defined in project configuration"); } const runtime = new AgentRuntime({ agentId: v4_default(), character: agent.character, plugins: agent.plugins || [] }); if (agent.init) { await agent.init(runtime); } return { runtime, path: projectPath, agent }; } catch (error) { logger.error("Failed to load project:", error); throw error; } } export { loadProject }; //# sourceMappingURL=chunk-GZ3FDKC6.js.map