import type { FpfFunctionBase } from "./function"; import { type IFpfClient } from "./interface/FpfClient"; /** * Configuration interface for creating an FpfWorker */ interface IFpfWorker { /** Unique identifier for the worker */ id: string; /** Display name for the worker */ name: string; /** Description of the worker's capabilities and purpose */ description: string; /** Array of functions this worker can execute */ functions: FpfFunctionBase[]; /** Optional function to provide worker-specific environment state */ getEnvironment?: () => Promise>; } /** * FpfWorker represents a specialized executor that performs tasks for an agent * Workers encapsulate specific capabilities through their functions * * @example * ```typescript * const tradingWorker = new FpfWorker({ * id: "trading_worker", * name: "Trading Worker", * description: "Executes token swaps and manages positions", * functions: [swapFunction, checkBalanceFunction], * getEnvironment: async () => ({ balance: await getBalance() }) * }); * ``` */ declare class FpfWorker implements IFpfWorker { id: string; name: string; description: string; functions: FpfFunctionBase[]; getEnvironment?: () => Promise>; private agentId; private logger; private fpfClient; private fpfActionResult; /** * Create a new FpfWorker * @param options - Worker configuration options * @throws {Error} If functions array is empty */ constructor(options: IFpfWorker); /** * Set the agent ID this worker belongs to * @param agentId - The agent's ID * @internal */ setAgentId(agentId: string): void; /** * Set the logger function for this worker * @param logger - Logging function * @internal */ setLogger(logger: (msg: string) => void): void; /** * Set the FPF client for API communication * @param fpfClient - The FPF client instance * @internal */ setFpfClient(fpfClient: IFpfClient): void; /** * Execute one step of a task * @param submissionId - The task submission ID * @param options - Step execution options * @param options.verbose - Enable detailed logging * @returns True if a function was executed, false if task is complete * @throws {Error} If agent or client is not initialized * @throws {Error} If function is not found */ step(submissionId: string, options?: { verbose: boolean; }): Promise; /** * Run a complete task until completion * @param task - Task description to execute * @param options - Task execution options * @param options.verbose - Enable detailed logging * @throws {Error} If agent or client is not initialized */ runTask(task: string, options?: { verbose: boolean; }): Promise; } export default FpfWorker; //# sourceMappingURL=worker.d.ts.map