import CodeEditor from '@/components/CodeEditor' export default function Configuration() { return (

配置选项

// lifecycle hooks // @todo: use event instead of hooks onBeforeStep?: (this: PageAgent, stepCnt: number) => Promise | void onAfterStep?: (this: PageAgent, stepCnt: number, history: AgentHistory[]) => Promise | void onBeforeTask?: (this: PageAgent) => Promise | void onAfterTask?: (this: PageAgent, result: ExecutionResult) => Promise | void /** * @note this hook can block the disposal process * @note when dispose caused by page unload, "reason" will be 'PAGE_UNLOADING'. this method CANNOT block unloading. async operations may be cut. */ onDispose?: (this: PageAgent, reason?: string) => void // page behavior hooks /** * @experimental * Enable the experimental script execution tool that allows executing generated JavaScript code on the page. * @note Can cause unpredictable side effects. * @note May bypass some safe guards and data-masking mechanisms. */ experimentalScriptExecutionTool?: boolean /** * TODO: @unimplemented * hook when action causes a new page to be opened * @note PageAgent will try to detect new pages and decide if it's caused by an action. But not very reliable. */ onNewPageOpen?: (this: PageAgent, url: string) => Promise | void /** * TODO: @unimplemented * try to navigate to a new page instead of opening a new tab/window. * @note will unload the current page when a action tries to open a new page. so that things keep in the same tab/window. */ experimentalPreventNewPage?: boolean } interface PageControllerConfig { interactiveBlacklist?: (Element | (() => Element))[] interactiveWhitelist?: (Element | (() => Element))[] include_attributes?: string[] highlightOpacity?: number highlightLabelOpacity?: number viewportExpansion?: number } `} />
) }