feat(ext): handcraft the whole ext from scratch

AI coding doesn't work for MV3 extensions.
Threading was an unfixable mess.
Removed everything and rebuilt by hand.
This commit is contained in:
Simon
2026-01-27 17:21:32 +08:00
parent 8efa8e18c1
commit fdc3cf4e6d
18 changed files with 797 additions and 1749 deletions

View File

@@ -0,0 +1,40 @@
import { PageAgentConfig, PageAgentCore } from '@page-agent/core'
import { RemotePageController } from './RemotePageController'
import { TabsController } from './TabsController'
import { createTabTools } from './tabTools'
export class MultiPageAgent extends PageAgentCore {
constructor(config: Omit<PageAgentConfig, 'pageController'>) {
const tabsController = new TabsController()
const pageController = new RemotePageController()
pageController.tabsController = tabsController
const customTools = createTabTools(tabsController)
super({
...config,
pageController: pageController as any,
customTools: customTools,
onBeforeTask: async (agent) => {
await tabsController.init(agent.taskId)
await chrome.storage.local.set({
isAgentRunning: true,
})
},
onAfterTask: async () => {
await chrome.storage.local.set({
isAgentRunning: false,
})
},
onDispose: () => {
chrome.storage.local.set({
isAgentRunning: false,
})
},
})
}
}