import { a as BrowserState, W as WorkflowStepData, b as WorkflowResult, A as AgentHistory } from './beam-D2GMLSrC.js'; export { B as Beam, n as BeamConfig, p as BeamEvents, o as BeamStepData, d as Browser, f as BrowserClass, g as BrowserConfig, e as BrowserContext, h as BrowserContextConfig, i as DOMBaseNode, j as DOMElementNode, m as DOMHistoryElement, l as DOMState, k as DOMTextNode, t as DefaultToolKeys, D as DomService, P as ProxySettings, R as RunOptions, S as SelectorMap, T as TabInfo, s as TokenUsage, c as WorkflowEvents, q as WorkflowManager, r as WorkflowManagerConfig } from './beam-D2GMLSrC.js'; import * as ai from 'ai'; import { TextPart, ImagePart } from 'ai'; export { ToolCall, ToolResult } from 'ai'; import '@mastra/memory'; import 'events'; import 'playwright'; import 'zod'; import 'pino'; import '@mastra/core/workflows'; import '@mastra/core/agent'; import '@mastra/core/tools'; import 'steel-sdk'; interface SystemMessage { role: "system"; content: string; } interface UserMessage { role: "user"; content: string | Array; } type Message = SystemMessage | UserMessage; interface TabInfo { id: string; title: string; url: string; active: boolean; } interface ExtendedBrowserState extends BrowserState { elementTree: { clickableElementsToString?: (includeAttributes?: string[]) => string; }; interactiveElements?: unknown[]; pixelsAbove?: number; pixelsBelow?: number; screenshot?: string; url: string; tabs: TabInfo[]; } /** * Information about the current agent step */ interface AgentStepInfo { /** Current step number (0-based) */ stepNumber: number; /** Maximum number of steps allowed */ maxSteps: number; } /** * Result of an action execution */ interface ActionResult { /** Whether the action succeeded */ success?: boolean; /** Name of the action executed */ action?: string; /** Error message if the action failed */ error?: string; /** Extracted content from the action */ extractedContent?: string; /** Whether this action completes the task */ isDone?: boolean; /** Additional data extracted from the action */ data?: Record; } /** * Class for generating system prompts with proper formatting */ declare class SystemPrompt { private promptTemplate; private systemMessage; private defaultActionDescription; private maxActionsPerStep; constructor(actionDescription: string, maxActionsPerStep?: number, overrideSystemMessage?: string, extendSystemMessage?: string, systemPromptPath?: string); /** * Load the prompt template from a markdown file * @param customPath Optional path to the system prompt template */ private loadPromptTemplate; /** * Get the system message for the agent * @returns Formatted system message */ getSystemMessage(): SystemMessage; } /** * Class for generating formatted user messages based on browser state */ declare class AgentMessagePrompt { private state; private result?; private includeAttributes; private stepInfo?; constructor(state: ExtendedBrowserState, result?: ActionResult[], includeAttributes?: string[], stepInfo?: AgentStepInfo); /** * Get the formatted user message for the agent * @param useVision Whether to include image data * @returns Formatted user message */ getUserMessage(useVision?: boolean): UserMessage; } /** * Helper class for generating planner prompts */ declare class PlannerPrompt extends SystemPrompt { /** * Get the system message for the planner * @param isPlannerReasoning Whether to include reasoning instructions * @returns Formatted system or human message */ getPlannerMessage(): Message; } /** * Decorator for measuring the execution time of an async function * * @param label - Label to use in the timing log * @returns A function decorator */ declare function timeExecutionAsync(label: string): (target: (this: unknown, ...args: A) => Promise, context: ClassMethodDecoratorContext) => (this: unknown, ...args: A) => Promise; /** * Decorator for measuring the execution time of a sync function * * @param label - Label to use in the timing log * @returns A function decorator */ declare function timeExecutionSync(label: string): (target: (this: unknown, ...args: A) => T, context: ClassMethodDecoratorContext) => (this: unknown, ...args: A) => T; /** * Checks if the required environment variables are present * * @param requiredVars - List of required environment variable names * @returns true if all variables are present, false otherwise */ declare function checkEnvVariables(requiredVars: string[]): boolean; /** * Trims long strings for display purposes * * @param str - String to trim * @param maxLength - Maximum length of the resulting string * @returns Trimmed string with ellipsis if needed */ declare function trimString(str: string, maxLength?: number): string; /** * Sleeps for the specified milliseconds * * @param ms - Milliseconds to sleep * @returns Promise that resolves after the specified time */ declare function sleep(ms: number): Promise; /** * Gets the current screen resolution * * @returns An object with width and height properties */ declare function getScreenResolution(): { width: number; height: number; }; /** * Calculates window size adjustments based on the environment * * @returns An object with the window size adjustments */ declare function getWindowAdjustments(): { width: number; height: number; }; /** * Shallow object comparison * * @param obj1 - First object * @param obj2 - Second object * @returns true if objects have the same properties with the same values */ declare function shallowEqual(obj1: Record, obj2: Record): boolean; /** * Extracts a JSON object from a string * * @param text - Text that contains a JSON object * @returns Parsed JSON object or null if parsing fails */ declare function extractJsonFromString(text: string): Record | null; /** * Custom exception classes for Browser Use */ /** * Exception raised when there's an issue with the Language Model */ declare class LLMException extends Error { status_code: number; message: string; constructor(status_code: number, message: string); } /** * Base class for all browser errors */ declare class BrowserError extends Error { constructor(message: string); } type ToolCallEvent = ai.ToolCall>; type ToolResultEvent = ai.ToolResult, unknown>; type TextEvent = string; type StepEvent = WorkflowStepData; type ErrorEvent = Error; type DoneEvent = WorkflowResult; type PlanEvent = string; type HistoryUpdateEvent = AgentHistory; interface BeamEventTypes { "tool-call": ToolCallEvent; "tool-result": ToolResultEvent; text: TextEvent; step: StepEvent; error: ErrorEvent; done: DoneEvent; plan: PlanEvent; "history-update": HistoryUpdateEvent; } type BeamEventName = keyof BeamEventTypes; export { type ActionResult, AgentHistory, AgentMessagePrompt, type AgentStepInfo, type BeamEventName, type BeamEventTypes, BrowserError, BrowserState, type DoneEvent, type ErrorEvent, type ExtendedBrowserState, type HistoryUpdateEvent, LLMException, type PlanEvent, PlannerPrompt, type StepEvent, SystemPrompt, type TextEvent, type ToolCallEvent, type ToolResultEvent, WorkflowResult, WorkflowStepData, checkEnvVariables, extractJsonFromString, getScreenResolution, getWindowAdjustments, shallowEqual, sleep, timeExecutionAsync, timeExecutionSync, trimString };