import { PageController } from '@page-agent/page-controller'; import { PageStateCache } from './page-state-cache'; import { RefMap } from './a11y-tree'; export type PageAgentToolContentResult = { content: Array<{ type: 'text'; text: string; }>; }; export type PageAgentToolErrorResult = PageAgentToolContentResult & { isError: true; error: string; }; /** 将额外字段合并进 browserState JSON,保持整段可反序列化 */ export declare function withStateFields(stateText: string, extra: Record): string; export declare function createActionErrorResult(message: string, buildBrowserStateResponse: ActionContext['buildBrowserStateResponse']): Promise; export interface ActionContext { pageController: PageController; stateCache: PageStateCache; getRefMap: () => RefMap; setRefMap: (map: RefMap) => void; buildBrowserStateResponse: (mode?: 'full' | 'diff' | 'both') => Promise<{ content: Array<{ type: 'text'; text: string; }>; }>; refreshOnStaleRef: (action: string, index: number) => Promise<{ content: Array<{ type: 'text'; text: string; }>; }>; errContent: (msg: string) => Promise<{ content: Array<{ type: 'text'; text: string; }>; }>; actionError: (msg: string) => Promise; }