From 3cd78aeacaa1cb99320218261fcf50ccfc9f98b5 Mon Sep 17 00:00:00 2001 From: ponderingdemocritus Date: Sun, 17 Nov 2024 13:31:42 +1100 Subject: [PATCH] instal clients from plugin --- packages/agent/src/index.ts | 13 ++++++++++++- packages/core/src/types.ts | 1 + 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/packages/agent/src/index.ts b/packages/agent/src/index.ts index 75baaa63c2..32a999f4f7 100644 --- a/packages/agent/src/index.ts +++ b/packages/agent/src/index.ts @@ -215,6 +215,14 @@ export async function initializeClients( clients.push(twitterClients); } + if (character.plugins.length > 0) { + character.plugins.forEach(async (plugin) => { + plugin.clients.forEach(async (client) => { + clients.push(await client.start(runtime)); + }); + }); + } + return clients; } @@ -224,7 +232,10 @@ export async function createAgent( token: string ) { console.log("Creating runtime for character", character.name); - console.log("character.settings.secrets?.WALLET_PUBLIC_KEY", character.settings.secrets?.WALLET_PUBLIC_KEY) + console.log( + "character.settings.secrets?.WALLET_PUBLIC_KEY", + character.settings.secrets?.WALLET_PUBLIC_KEY + ); return new AgentRuntime({ databaseAdapter: db, token, diff --git a/packages/core/src/types.ts b/packages/core/src/types.ts index 962fe0e4f2..c68f614b00 100644 --- a/packages/core/src/types.ts +++ b/packages/core/src/types.ts @@ -317,6 +317,7 @@ export type Plugin = { providers?: Provider[]; evaluators?: Evaluator[]; services?: Service[]; + clients?: Client[]; }; export enum Clients {