diff --git a/bun.lockb b/bun.lockb index 8b3ceb7127f..e577e7ff2b4 100755 Binary files a/bun.lockb and b/bun.lockb differ diff --git a/package.json b/package.json index a30dbbe88eb..1f733a9b518 100644 --- a/package.json +++ b/package.json @@ -11,7 +11,7 @@ "build:cli": "turbo run build --filter=./packages/cli && cd packages/cli && bun link", "start": "turbo run start --filter=!./packages/docs", "agent": "turbo run start --filter=@elizaos/agent", - "dev": "turbo run build --filter=./packages/core && turbo run dev --filter=!./packages/core --concurrency=20", + "dev": "turbo run build --filter=./packages/core && turbo run dev --filter=!./packages/core --filter=!./packages/docs --concurrency=20", "release": "bun run build && bun format && npx lerna publish --no-private --force-publish", "docker:build": "bash ./scripts/docker.sh build", "docker:run": "bash ./scripts/docker.sh run", diff --git a/packages/agent/src/api.ts b/packages/agent/src/api.ts index bfee1123210..f5ec4cc0ca9 100644 --- a/packages/agent/src/api.ts +++ b/packages/agent/src/api.ts @@ -307,8 +307,6 @@ export function createApiRouter( router.post("/agent/start", async (req, res) => { const { characterPath, characterJson } = req.body; - console.log("characterPath:", characterPath); - console.log("characterJson:", characterJson); try { let character: Character; if (characterJson) { @@ -340,7 +338,6 @@ export function createApiRouter( router.post("/agents/:agentId/stop", async (req, res) => { const agentId = req.params.agentId; - console.log("agentId", agentId); const agent: IAgentRuntime = agents.get(agentId); // update character diff --git a/packages/agent/src/defaultCharacter.ts b/packages/agent/src/defaultCharacter.ts index 0e568e252f2..3a1d351ec2d 100644 --- a/packages/agent/src/defaultCharacter.ts +++ b/packages/agent/src/defaultCharacter.ts @@ -4,14 +4,15 @@ export const defaultCharacter: Character = { name: "Eliza", username: "eliza", plugins: [ - "@elizaos/plugin-anthropic", + // "@elizaos/plugin-anthropic", "@elizaos/plugin-openai", "@elizaos/plugin-elevenlabs", - "@elizaos/plugin-local-ai", - "@elizaos/plugin-discord", + // "@elizaos/plugin-local-ai", + // "@elizaos/plugin-discord", "@elizaos/plugin-node", - "@elizaos/plugin-telegram", - "@elizaos/plugin-twitter", + // "@elizaos/plugin-telegram", + // "@elizaos/plugin-twitter", + "@elizaos-plugins/evm" ], settings: { secrets: {}, diff --git a/packages/agent/src/server.ts b/packages/agent/src/server.ts index 827b9b56f8f..7507c13189f 100644 --- a/packages/agent/src/server.ts +++ b/packages/agent/src/server.ts @@ -1,16 +1,15 @@ import { composeContext, - logger, generateMessageResponse, generateObject, - messageCompletionFooter, + logger, ModelClass, stringToUuid, + type Character, type Content, - type Media, - type Memory, type IAgentRuntime, - type Character + type Media, + type Memory } from "@elizaos/core"; import bodyParser from "body-parser"; import cors from "cors"; @@ -20,9 +19,8 @@ import * as fs from "node:fs"; import * as path from "node:path"; import { z } from "zod"; import { createApiRouter } from "./api.ts"; +import { hyperfiHandlerTemplate, messageHandlerTemplate, upload } from "./helper.ts"; import replyAction from "./reply.ts"; -import { messageHandlerTemplate } from "./helper.ts"; -import { upload } from "./helper.ts"; @@ -31,7 +29,7 @@ export class CharacterServer { public app: express.Application; private agents: Map; // container management private server: any; // Store server instance - public startAgent: () => Promise; // Store startAgent function + public startAgent: (character: Character) => Promise; // Store startAgent function public loadCharacterTryPath: (characterPath: string) => Promise; // Store loadCharacterTryPath function public jsonToCharacter: (filePath: string, character: string | never) => Promise; // Store jsonToCharacter function diff --git a/packages/cli/src/commands/init.ts b/packages/cli/src/commands/init.ts index e92476094ca..d677cccc612 100644 --- a/packages/cli/src/commands/init.ts +++ b/packages/cli/src/commands/init.ts @@ -85,7 +85,6 @@ async function installDependencies(targetDir: string, database: string, selected }) if (selectedPlugins.length > 0) { - console.log(selectedPlugins) await execa("bun", ["add", ...selectedPlugins, "--workspace-root"], { cwd: targetDir, stdio: "inherit" diff --git a/packages/cli/src/utils/registry/index.ts b/packages/cli/src/utils/registry/index.ts index 96e43429a69..5764dcd4861 100644 --- a/packages/cli/src/utils/registry/index.ts +++ b/packages/cli/src/utils/registry/index.ts @@ -9,7 +9,6 @@ const agent = process.env.https_proxy export async function getRegistryIndex(): Promise { try { - console.log("REGISTRY_URL", REGISTRY_URL) const response = await fetch(REGISTRY_URL, { agent }) // Get the response body as text first const text = await response.text() diff --git a/packages/core/src/generation.ts b/packages/core/src/generation.ts index fb43f779ae7..dd8656b6791 100644 --- a/packages/core/src/generation.ts +++ b/packages/core/src/generation.ts @@ -131,12 +131,19 @@ export async function generateText({ stopSequences?: string[]; customSystemPrompt?: string; }): Promise { + + logger.debug("Generating text") + logger.debug(context) + const text = await runtime.useModel(modelClass, { runtime, context, stopSequences, }); + logger.debug("Generated text") + logger.debug(text) + return text; } diff --git a/packages/core/src/knowledge.ts b/packages/core/src/knowledge.ts index 8b157646fa8..9a149d7455d 100644 --- a/packages/core/src/knowledge.ts +++ b/packages/core/src/knowledge.ts @@ -8,7 +8,6 @@ async function get( runtime: AgentRuntime, message: Memory ): Promise { - console.log("get", message); // Add validation for message if (!message?.content?.text) { logger.warn("Invalid message for knowledge query:", { @@ -70,7 +69,6 @@ async function set( chunkSize = 512, bleed = 20 ) { - console.log("set", item); const embedding = await runtime.useModel(ModelClass.TEXT_EMBEDDING, null); await runtime.documentsManager.createMemory({ id: item.id, diff --git a/packages/core/src/logger.ts b/packages/core/src/logger.ts index 76c4b0a5547..21b2b6ddf49 100644 --- a/packages/core/src/logger.ts +++ b/packages/core/src/logger.ts @@ -29,7 +29,7 @@ const createStream = () => { }); }; -const defaultLevel = process?.env?.DEFAULT_LOG_LEVEL || "info"; +const defaultLevel = process?.env?.DEFAULT_LOG_LEVEL || process?.env?.LOG_LEVEL || "info"; const options = { level: defaultLevel, diff --git a/packages/core/src/memory.ts b/packages/core/src/memory.ts index bda44b96f7b..08ea3e13e6e 100644 --- a/packages/core/src/memory.ts +++ b/packages/core/src/memory.ts @@ -50,7 +50,6 @@ export class MemoryManager implements IMemoryManager { * @throws Error if the memory content is empty */ async addEmbeddingToMemory(memory: Memory): Promise { - console.log("addEmbeddingToMemory", memory); // Return early if embedding already exists if (memory.embedding) { return memory; @@ -174,7 +173,6 @@ export class MemoryManager implements IMemoryManager { */ async createMemory(memory: Memory, unique = false): Promise { // TODO: check memory.agentId == this.runtime.agentId - console.log("createMemory", memory); const existingMessage = await this.runtime.databaseAdapter.getMemoryById(memory.id); diff --git a/packages/core/src/runtime.ts b/packages/core/src/runtime.ts index 0ce9fb06259..d67adb17836 100644 --- a/packages/core/src/runtime.ts +++ b/packages/core/src/runtime.ts @@ -327,6 +327,15 @@ export class AgentRuntime implements IAgentRuntime { for(const route of plugin.routes){ this.routes.push(route); } + + for(const client of plugin.clients){ + client.start(this).then((startedClient) => { + logger.debug( + `Initializing client: ${client.name}` + ); + this.clients.push(startedClient); + }); + } } this.plugins = plugins; @@ -353,6 +362,25 @@ export class AgentRuntime implements IAgentRuntime { this.clients.push(startedClient); } } + + if (plugin.actions) { + for (const action of plugin.actions) { + this.registerAction(action); + } + } + + if (plugin.evaluators) { + for (const evaluator of plugin.evaluators) { + this.registerEvaluator(evaluator); + } + } + + if (plugin.providers) { + for (const provider of plugin.providers) { + this.registerContextProvider(provider); + } + } + if (plugin.models) { for (const [modelClass, handler] of Object.entries(plugin.models)) { this.registerModel(modelClass as ModelClass, handler as (params: any) => Promise); @@ -602,8 +630,6 @@ export class AgentRuntime implements IAgentRuntime { modelClass: ModelClass.TEXT_SMALL, }); - console.log("***** result", result); - const evaluators = parseJsonArrayFromText( result, ) as unknown as string[]; diff --git a/packages/core/src/types.ts b/packages/core/src/types.ts index b9cd5c6f0f2..e417795c36e 100644 --- a/packages/core/src/types.ts +++ b/packages/core/src/types.ts @@ -527,7 +527,7 @@ export type Media = { */ export type ClientInstance = { /** Client name */ - // name: string; + name?: string; /** Stop client connection */ stop: (runtime: IAgentRuntime) => Promise; diff --git a/packages/plugin-openai/src/index.ts b/packages/plugin-openai/src/index.ts index f14041f87dd..f3897d2eeae 100644 --- a/packages/plugin-openai/src/index.ts +++ b/packages/plugin-openai/src/index.ts @@ -146,6 +146,9 @@ export const openaiPlugin: Plugin = { runtime.getSetting("SMALL_MODEL") ?? "gpt-4o-mini"; + console.log("generating text") + console.log(context) + const { text: openaiResponse } = await aiGenerateText({ model: openai.languageModel(model), prompt: context, @@ -178,10 +181,6 @@ export const openaiPlugin: Plugin = { baseURL, }); - const smallModel = - runtime.getSetting("OPENAI_SMALL_MODEL") ?? - runtime.getSetting("SMALL_MODEL") ?? - "gpt-4o-mini"; const model = runtime.getSetting("OPENAI_LARGE_MODEL") ?? runtime.getSetting("LARGE_MODEL") ?? "gpt-4o";