Skip to content

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

Expose the browser drop through an api out-param, not a plugin return

Fei241185c9791fc9e8
diff --git a/ds-bot/src/host/browser-plugins.js b/ds-bot/src/host/browser-plugins.js
index 746abbcb..66b1026e 100644
--- a/ds-bot/src/host/browser-plugins.js
+++ b/ds-bot/src/host/browser-plugins.js
@@ -94,7 +94,9 @@ export function install(rt) {
? rt.config.browserHeadless
: defaultBrowserHeadless(process.platform)
const downloadRoot = join(rt.home, 'browser-downloads')
- 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 --git a/ds-bot/src/host/browser/mount.js b/ds-bot/src/host/browser/mount.js
index 8777badb..f65d1002 100644
--- a/ds-bot/src/host/browser/mount.js
+++ b/ds-bot/src/host/browser/mount.js
@@ -19,9 +19,9 @@ export const browserOutput = {
/**
* @param {any} ctx
- * @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 }} 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
*/
-export function mountBrowserPlugin(ctx, { toolDefs, defineTool, keyOf, profileRoot, downloadRoot, uploadRoots, headless, playwrightUrl, executablePath, actionTimeout, authorize, completeFor }) {
+export function mountBrowserPlugin(ctx, { toolDefs, defineTool, keyOf, profileRoot, downloadRoot, uploadRoots, headless, playwrightUrl, executablePath, actionTimeout, authorize, completeFor, api }) {
const sessions = new Map()
ctx.effect(() => async () => {
const open = [...sessions.values()]
@@ -77,5 +77,6 @@ export function mountBrowserPlugin(ctx, { toolDefs, defineTool, keyOf, profileRo
}))
}
- return { drop }
+ // An object return would be collected as an effect by cordis, so the api is an out-param.
+ if (api) api.drop = drop
}