Skip to content

A team of long-lived bots for DeepSeek Harness, with main bots, bot-to-bot messages and group chats.

Merge remote-tracking branch 'origin/cursor/bot-browser-plugins-c44c' into feat/bot-browser-takeover

Fei2411dbe55897a213
diff --cc ds-bot/src/host/browser-plugins.js
index 0beeeebb,66b1026e..2f6abd4c
--- a/ds-bot/src/host/browser-plugins.js
+++ b/ds-bot/src/host/browser-plugins.js
@@@ -116,14 -94,9 +116,16 @@@ export function install(rt)
? rt.config.browserHeadless
: defaultBrowserHeadless(process.platform)
const downloadRoot = join(rt.home, 'browser-downloads')
+ async function downloadRoots(botId) {
+ await rt.load()
+ const team = rt.teamFolder()
+ const requested = rt.workDirOf({ botId })
+ const working = requested !== undefined && await rt.isFolder(requested) ? requested : team
+ return [...new Set([working, team].filter(root => typeof root === 'string' && isAbsolute(root)))]
+ }
- const mounted = mountBrowserPlugin(rt.ctx, {
+ const mounted = {}
+ mountBrowserPlugin(rt.ctx, {
+ api: mounted,
toolDefs: plugin.tools ?? plugin.toolDefs,
defineTool,
profileRoot: join(rt.home, 'browser-profiles'),
diff --cc ds-bot/src/host/browser/mount.js
index 711f9bd1,f65d1002..f4b95cc6
--- a/ds-bot/src/host/browser/mount.js
+++ b/ds-bot/src/host/browser/mount.js
@@@ -31,19 -19,11 +31,19 @@@ export const browserOutput =
/**
* @param {any} ctx
- * @param {{ toolDefs: any[], defineTool: Function, keyOf: (exec: any) => Promise<string|undefined>, profileRoot: string, downloadRoot?: string, downloadRoots?: (botId: string) => Promise<string[]>, uploadRoots?: (botId: string) => Promise<string[]>, headless: boolean, playwrightUrl?: string, executablePath?: string, actionTimeout?: number, authorize?: (exec: any, botId: string, action: any) => Promise<void>, completeFor?: (exec: any) => Function, connect?: (botId: string, downloadRoots?: string[]) => Promise<string>, getHold?: (botId: string) => any, onHold?: (botId: string, hold: any) => void, subscribeHolds?: (listener: (botId: string, hold: any) => void) => (() => void) | undefined, openSession?: typeof openBotBrowser }} options
- * @param {{ toolDefs: any[], defineTool: Function, keyOf: (exec: any) => Promise<string|undefined>, profileRoot: string, downloadRoot?: string, uploadRoots?: (botId: string) => Promise<string[]>, headless: boolean, playwrightUrl?: string, executablePath?: string, actionTimeout?: number, authorize?: (exec: any, botId: string, action: any) => Promise<void>, completeFor?: (exec: any) => Function, api?: object }} options
++ * @param {{ toolDefs: any[], defineTool: Function, keyOf: (exec: any) => Promise<string|undefined>, profileRoot: string, downloadRoot?: string, downloadRoots?: (botId: string) => Promise<string[]>, uploadRoots?: (botId: string) => Promise<string[]>, headless: boolean, playwrightUrl?: string, executablePath?: string, actionTimeout?: number, authorize?: (exec: any, botId: string, action: any) => Promise<void>, completeFor?: (exec: any) => Function, connect?: (botId: string, downloadRoots?: string[]) => Promise<string>, getHold?: (botId: string) => any, onHold?: (botId: string, hold: any) => void, subscribeHolds?: (listener: (botId: string, hold: any) => void) => (() => void) | undefined, openSession?: typeof openBotBrowser, api?: object }} options
*/
- export function mountBrowserPlugin(ctx, { toolDefs, defineTool, keyOf, profileRoot, downloadRoot, downloadRoots, uploadRoots, headless, playwrightUrl, executablePath, actionTimeout, authorize, completeFor, connect, getHold, onHold, subscribeHolds, openSession = openBotBrowser }) {
-export function mountBrowserPlugin(ctx, { toolDefs, defineTool, keyOf, profileRoot, downloadRoot, uploadRoots, headless, playwrightUrl, executablePath, actionTimeout, authorize, completeFor, api }) {
++export function mountBrowserPlugin(ctx, { toolDefs, defineTool, keyOf, profileRoot, downloadRoot, downloadRoots, uploadRoots, headless, playwrightUrl, executablePath, actionTimeout, authorize, completeFor, connect, getHold, onHold, subscribeHolds, openSession = openBotBrowser, api }) {
const sessions = new Map()
+ const unsubscribeHolds = subscribeHolds?.((botId, hold) => {
+ if (hold?.by !== 'user') return
+ const session = sessions.get(botId)
+ if (!session) return
+ sessions.delete(botId)
+ void Promise.resolve(session).then(s => s.close(), () => {}).catch(() => {})
+ })
ctx.effect(() => async () => {
+ unsubscribeHolds?.()
const open = [...sessions.values()]
sessions.clear()
await Promise.all(open.map(session => Promise.resolve(session).then(opened => opened.close(), () => {})))