fix: don't retry or show AbortError; remove reason from dispose; don't clean history in dispose

This commit is contained in:
Simon
2026-01-22 20:19:51 +08:00
parent 299a5b2075
commit dad837e173
2 changed files with 8 additions and 7 deletions

View File

@@ -108,6 +108,7 @@ export class PageAgentCore extends EventTarget {
})
this.#llm.addEventListener('error', (e) => {
const error = (e as CustomEvent).detail.error as Error | InvokeError
if ((error as any)?.rawError?.name === 'AbortError') return
const message = String(error)
this.emitActivity({ type: 'error', message })
// Also push to history for panel rendering
@@ -577,16 +578,16 @@ export class PageAgentCore extends EventTarget {
`)
}
dispose(reason?: string) {
dispose() {
console.log('Disposing PageAgent...')
this.disposed = true
this.pageController.dispose()
this.history = []
this.#abortController.abort(reason ?? 'PageAgent disposed')
// this.history = []
this.#abortController.abort()
// Emit dispose event for UI cleanup
this.dispatchEvent(new Event('dispose'))
this.config.onDispose?.(this, reason)
this.config.onDispose?.(this)
}
}