feat(ext): enhance error handling and improve UI structure

This commit is contained in:
Simon
2026-01-21 16:50:55 +08:00
parent 52454305fb
commit 9531fcff5a
5 changed files with 79 additions and 21 deletions

View File

@@ -145,6 +145,10 @@ function registerCommandHandlers(): void {
// Execute task (don't await - runs in background)
agent.execute(task).catch((error) => {
console.error('[PageAgentExt] Task execution error:', error)
const message = error instanceof Error ? error.message : String(error)
// Broadcast error as a history event so it persists in UI
const errorEvent: HistoricalEvent = { type: 'error', message }
eventBroadcaster.history([errorEvent])
eventBroadcaster.status('error')
})
})