import { BrowserStateHistory } from '../browser/views'; import { ActionModel } from '../controller/registry/views'; import z from 'zod'; export declare class AgentStepInfo { stepNumber: number; maxSteps: number; constructor(stepNumber: number, maxSteps: number); } /** * 动作结果 * 描述一个动作的执行结果 */ export declare class ActionResult { /** * 提取的内容 */ extractedContent?: string; /** * 错误信息 */ error?: string; /** * 是否任务完成 */ isDone?: boolean; /** * 是否将结果包含在记忆中 */ includeInMemory: boolean; /** * 创建ActionResult实例 */ constructor(init?: Partial); } /** * 代理大脑 */ export interface AgentBrain { /** * 页面摘要 */ page_summary: string; /** * 上一个目标的评估 */ evaluation_previous_goal: string; /** * 记忆 */ memory: string; /** * 下一个目标 */ next_goal: string; } /** * 代理输出 */ export interface AgentOutput { /** * 当前状态 */ current_state: AgentBrain; /** * 动作列表 */ action: ActionModel[]; } /** * 代理输出静态方法 */ export declare namespace AgentOutput { function typeWithCustomActions(customActions: any): any; function getSchema(actionModel: any): z.ZodObject<{ current_state: z.ZodObject<{ page_summary: z.ZodString; evaluation_previous_goal: z.ZodString; memory: z.ZodString; next_goal: z.ZodString; }, "strip", z.ZodTypeAny, { page_summary: string; evaluation_previous_goal: string; memory: string; next_goal: string; }, { page_summary: string; evaluation_previous_goal: string; memory: string; next_goal: string; }>; action: z.ZodArray, "many">; }, "strip", z.ZodTypeAny, { current_state: { page_summary: string; evaluation_previous_goal: string; memory: string; next_goal: string; }; action: { [x: string]: any; }[]; }, { current_state: { page_summary: string; evaluation_previous_goal: string; memory: string; next_goal: string; }; action: { [x: string]: any; }[]; }>; } /** * 代理历史记录 */ export interface AgentHistory { /** * 模型输出 */ modelOutput?: AgentOutput; /** * 结果列表 */ result: ActionResult[]; /** * 浏览器状态历史 */ state: BrowserStateHistory; } /** * 代理历史静态方法 */ export declare namespace AgentHistory { /** * 获取交互的元素 * @param modelOutput 模型输出 * @param selectorMap 选择器映射 */ function getInteractedElement(modelOutput: AgentOutput, selectorMap: any): any[]; /** * 导出模型数据 */ function modelDump(history: AgentHistory): Record; } /** * 代理历史记录列表 */ export declare class AgentHistoryList { /** * 历史记录 */ history: AgentHistory[]; /** * 创建AgentHistoryList实例 * @param init 初始值 */ constructor(init?: Partial); /** * 字符串表示 */ toString(): string; /** * 保存到文件 * @param filepath 文件路径 */ saveToFile(filepath: string): void; /** * 导出模型数据 */ modelDump(): any; /** * 从文件加载 * @param filepath 文件路径 * @param outputModel 输出模型类型 */ static loadFromFile(filepath: string, outputModel: any): AgentHistoryList; /** * 获取最后一个动作 */ lastAction(): any | undefined; /** * 获取所有错误 */ errors(): string[]; /** * 获取最终结果 */ finalResult(): string | undefined; /** * 是否完成 */ isDone(): boolean; /** * 是否有错误 */ hasErrors(): boolean; /** * 获取所有URL */ urls(): string[]; /** * 获取所有截图 */ screenshots(): string[]; /** * 获取所有动作名称 */ actionNames(): string[]; /** * 获取所有模型思考 */ modelThoughts(): AgentBrain[]; /** * 获取所有模型输出 */ modelOutputs(): AgentOutput[]; /** * 获取所有模型动作 */ modelActions(): any[]; /** * 获取所有动作结果 */ actionResults(): ActionResult[]; /** * 获取所有提取的内容 */ extractedContent(): string[]; /** * 获取过滤后的模型动作 * @param include 包含的动作类型 */ modelActionsFiltered(include?: string[]): any[]; } /** * 代理错误 */ export declare class AgentError extends Error { /** * 验证错误信息 */ static VALIDATION_ERROR: string; /** * 速率限制错误信息 */ static RATE_LIMIT_ERROR: string; /** * 无有效动作错误信息 */ static NO_VALID_ACTION: string; /** * 创建AgentError实例 * @param message 错误信息 */ constructor(message: string); /** * 格式化错误信息 * @param error 错误对象 * @param includeTrace 是否包含堆栈跟踪 */ static formatError(error: Error, includeTrace?: boolean): string; }