Files
plugins/packages/doubao-work/README.md
T
yetone c1ed1b511e doubao-work 0.1.0: 豆包工作 as a provider, by driving the Doubao desktop app
Doubao Work runs its agent loop in ByteDance's cloud and has no API. This
plugin uses the desktop app the way a person does and gives the reply back
as an OpenAI chat completion:

- cdp.mjs (knows nothing about Doubao): starts a Chromium-based app from a
  profile of its own with DevTools on a port it picked and saved, reuses it
  while it runs, never kills anything; Page evaluates and presses keys.
- doubao.mjs: per request a new 工作任务, switched to 云电脑 (Doubao's agent
  never touches this computer), the model picked (Pro needs a paid plan:
  403), the whole request written into tiptap one paragraph a line, Enter,
  and the reply read from the message's content_blocks_v2 (markdown, and
  thinking as reasoning_content) until is_finish. One request at a time.
- prompt.mjs / openai.mjs: system prompt, tools and turns flattened into one
  message; tools asked for as <tool_call>{json}</tool_call> and given back
  as tool_calls; SSE that holds text from the first call (or a tail that
  may start one), and that throws a failure before the reply begins so it
  goes back as an HTTP error.
- Sign-in waits for the account in the separate Doubao window.

Run:
- bun test packages/doubao-work on mote: 24 pass.
- Full suite on mote the way CI runs it (HOME=$(mktemp -d) bun test):
  6936 pass, 20 skip, 0 fail. bun scripts/check.mjs: doubao-work ok.
- Broken by hand: sleep without its aborted check; "an abort between two
  polls stops the ask too" goes red (runs to the 180s idle timeout), green
  with it. Found by the first run: an abort landing between polls was lost.
- Live, the loader against a signed-in Doubao 147 on macOS: auto plain
  answer 200 in 3.9s; doubao-2.1-lite streamed Bash tool call (first byte
  3.6s, total 4.8s); tool result follow-up answered "412 lines"; Pro gave
  403 doubao_upgrade; a 300-word story streamed as 20 content deltas with
  its ```python fence kept; a client abort ended the stream and the next
  request answered 200.

Not tried: through magpie's plugin host and a real agent (Claude Code
sized requests); Windows and Linux (unsupported, sign-in says so). A
stopped request stops being read but Doubao finishes its task (README).
2026-11-09 06:05:35 +08:00

2.5 KiB

豆包工作 (Doubao Work)

Doubao Work runs its agent loop in ByteDance's cloud and has no API, so there is no request to make on its behalf. This plugin uses the Doubao desktop app the way a person does instead, and gives what it reads back as an OpenAI chat completion:

  1. It starts Doubao from a profile of its own (~/Library/Application Support/magpie-doubao-work/profile), with Chrome DevTools on a local port. Your everyday Doubao is not touched; you sign in once in this second window.
  2. Each request opens a new 工作任务, switches it from 本地电脑 to 云电脑 (so Doubao's agent never reads or runs anything on your computer), picks the model, and writes the whole request (system prompt, tools, every turn) into the input as one message.
  3. It reads the reply from the message Doubao renders, as it streams: the raw markdown, and the thinking as reasoning_content.
  4. The client's tools are asked for as text, <tool_call>{"name": …, "arguments": …}</tool_call>, and given back as tool_calls.

Models: 自动 (auto), 豆包 2.1 Lite (doubao-2.1-lite) and 豆包 2.1 Pro (doubao-2.1-pro, needs a paid Doubao plan).

What it costs

  • Unofficial. It uses Doubao the way its own window does, but ByteDance may not like it. Use an account you can afford to lose.
  • One request at a time. There is one window.
  • Every request is a new task in your Doubao history.
  • A request the client stops stops being read, but Doubao finishes its task in the cloud anyway.
  • Slower than an API: a task takes a few seconds to open, and the reply is read about seven times a second.
  • Text only. Images and files in a request are left out.
  • Usage is Doubao's own prompt count; the reply's tokens are estimated.
  • The DevTools port is on 127.0.0.1 only, but any program on this computer can drive the signed-in Doubao window through it while it runs.
  • macOS only for now.

Settings

  • DOUBAO_WORK_APP: the Doubao binary, if it is not at /Applications/Doubao.app/Contents/MacOS/Doubao.
  • DOUBAO_WORK_HOME: where the profile and port live.

Adding another cloud agent

cdp.mjs knows nothing about Doubao: it starts a Chromium-based desktop app from its own profile and drives one page. doubao.mjs is everything that is Doubao's: which buttons to press and where the reply is. prompt.mjs and openai.mjs turn a chat request into one message and the reply back into a completion. Another app built on Chromium or Electron needs only its own doubao.mjs.