chore(core): tidy up PageAgentCore members
This commit is contained in:
@@ -49,14 +49,16 @@ export type * from './types'
|
|||||||
* - Types: thinking, executing, executed, retrying, error
|
* - Types: thinking, executing, executed, retrying, error
|
||||||
*/
|
*/
|
||||||
export class PageAgentCore extends EventTarget {
|
export class PageAgentCore extends EventTarget {
|
||||||
config: PageAgentConfig & { maxSteps: number }
|
readonly id = uid()
|
||||||
id = uid()
|
readonly config: PageAgentConfig & { maxSteps: number }
|
||||||
tools: typeof tools
|
readonly tools: typeof tools
|
||||||
|
/** PageController for DOM operations */
|
||||||
|
readonly pageController: PageController
|
||||||
|
|
||||||
task = ''
|
task = ''
|
||||||
taskId = ''
|
taskId = ''
|
||||||
|
/** History events */
|
||||||
/** Agent execution status */
|
history: HistoricalEvent[] = []
|
||||||
#status: AgentStatus = 'idle'
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Callback for when agent needs user input (ask_user tool)
|
* Callback for when agent needs user input (ask_user tool)
|
||||||
@@ -65,24 +67,19 @@ export class PageAgentCore extends EventTarget {
|
|||||||
*/
|
*/
|
||||||
onAskUser?: (question: string) => Promise<string>
|
onAskUser?: (question: string) => Promise<string>
|
||||||
|
|
||||||
|
#status: AgentStatus = 'idle'
|
||||||
#llm: LLM
|
#llm: LLM
|
||||||
#abortController = new AbortController()
|
#abortController = new AbortController()
|
||||||
#observations: string[] = []
|
#observations: string[] = []
|
||||||
|
|
||||||
/** PageController for DOM operations */
|
/** internal states of a single task execution */
|
||||||
pageController: PageController
|
|
||||||
|
|
||||||
/** Runtime states for tracking across steps */
|
|
||||||
states = {
|
states = {
|
||||||
/** Accumulated wait time in seconds, used by wait tool */
|
/** Accumulated wait time in seconds */
|
||||||
totalWaitTime: 0,
|
totalWaitTime: 0,
|
||||||
/** Last known URL for detecting navigation */
|
/** Last known URL for detecting navigation */
|
||||||
lastURL: '',
|
lastURL: '',
|
||||||
}
|
}
|
||||||
|
|
||||||
/** History events */
|
|
||||||
history: HistoricalEvent[] = []
|
|
||||||
|
|
||||||
constructor(config: PageAgentConfig & { pageController: PageController }) {
|
constructor(config: PageAgentConfig & { pageController: PageController }) {
|
||||||
super()
|
super()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user