diff --git a/package.json b/package.json index e3751b1..b3dd852 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "bgent", - "version": "0.0.40", + "version": "0.0.41", "private": false, "description": "bgent. because agent was taken.", "type": "module", diff --git a/src/lib/providers.ts b/src/lib/providers.ts index 5f4fd9f..e86a41e 100644 --- a/src/lib/providers.ts +++ b/src/lib/providers.ts @@ -1,6 +1,6 @@ import time from "./providers/time"; import { BgentRuntime } from "./runtime"; -import { type Message, type Provider } from "./types"; +import { State, type Message, type Provider } from "./types"; export const defaultProviders: Provider[] = [time]; @@ -8,12 +8,17 @@ export const defaultProviders: Provider[] = [time]; * Formats provider outputs into a string which can be injected into the context. * @param runtime The Bgent runtime object. * @param message The incoming message object. + * @param state The current state object. * @returns A string that concatenates the outputs of each provider. */ -export async function getProviders(runtime: BgentRuntime, message: Message) { +export async function getProviders( + runtime: BgentRuntime, + message: Message, + state?: State, +) { const providerResults = await Promise.all( runtime.providers.map(async (provider) => { - return await provider.get(runtime, message); + return await provider.get(runtime, message, state); }), ); diff --git a/src/lib/runtime.ts b/src/lib/runtime.ts index 5d28b22..f938e33 100644 --- a/src/lib/runtime.ts +++ b/src/lib/runtime.ts @@ -357,7 +357,7 @@ export class BgentRuntime { * @param state The state of the agent. * @returns The results of the evaluation. */ - async evaluate(message: Message, state: State) { + async evaluate(message: Message, state?: State) { const evaluatorPromises = this.evaluators.map( async (evaluator: Evaluator) => { if (!evaluator.handler) {