The model list is read off the app's menu on sign-in and again only once
the cached list is six hours old. A model Doubao added in between (the new
DeepSeek, Kimi and GLM rows) was answered 404 "没有模型", whether picked
from the list or typed by hand. Now a request that names a model the
cached list doesn't have reads the menu again first, queued behind any
running ask, at most once a minute so a made-up name doesn't open the
menu each time. A menu that can't be read leaves the model unknown and
the list as it was. The 404 now names the models the menu has.
Run on a separate test Mac (Bun 1.4.2, temp HOME):
- bun test packages/doubao-work: 39 pass, 0 fail (3 new).
- bun scripts/check.mjs doubao-work: ok.
Broken by hand, each red then restored:
- the plugin never asks the menu again: 1 fail.
- no once-a-minute limit: 1 fail.
Not tried: the real 豆包工作 or 豆包 app (no install for a review); the
reporter's menu may differ in a way the read doesn't handle, so #1048
stays open for them.
Reported-by: lumiai101
binary() looked only for /Applications/Doubao.app (豆包,
com.bot.pc.doubao). The reporter has only 豆包工作 at
/Applications/DoubaoWork.app/Contents/MacOS/DoubaoWork
(com.work.pc.doubao), so sign-in always said the app was missing.
choose() now picks { app, binary, dataDir } from both apps, 豆包工作
first, in /Applications and ~/Applications on macOS and under
%LOCALAPPDATA% on Windows. A user already signed in to 豆包 through
the plugin (its profile exists) stays on 豆包 while it is installed, so
the update signs no one out. 豆包工作 keeps its profile, port and model
list in a doubaowork/ subfolder. DOUBAO_WORK_APP still names the binary.
The chat page check (owns, connect) accepts doubaowork://doubaowork-chat/chat
and chrome://doubaowork-chat/chat as well as 豆包's. The busy and
not-installed messages name the chosen app and its download page.
Run (mote, worktree at 6cb5dbe8 + this change; origin/main 1bdc4d4b only
adds an autoclaw change):
- bun test packages/doubao-work: 36 pass, 0 fail.
- bun scripts/check.mjs: exit 0, doubao-work ok.
- Live on this Mac with DoubaoWork 2.36.3 (copied out of the official
dmg) and a sandbox DOUBAO_WORK_HOME: choose picked 豆包工作, App.start
launched it, owns accepted it, the page reported
chrome://doubaowork-chat/chat, input present, signed out; the model
menu read 自动 / 豆包 2.1 Lite / 豆包 2.1 Pro; the new-task and 云电脑
steps ran on the real page. A second connect reused the running app.
- 豆包 2.35.8 with a temp profile: same chat page test ids.
Broken by hand (mote): choose searching only 豆包 made "a Mac with only
豆包工作 drives 豆包工作 (#917)" red; the old owns regex made "both apps'
chat pages are the plugin's" red (34 pass, 2 fail). The old code has no
choose/isChat and binary() returns Doubao.app, so the #917 test is red
on it.
Not tried: a signed-in request (no 豆包工作 account here). Windows: the
path %LOCALAPPDATA%\DoubaoWork\Application\app\DoubaoWork.exe comes from
DoubaoWork_installer_2.36.3.exe's config (install_dir_name DoubaoWork,
exe_file_name DoubaoWork.exe) and 豆包's layout; not installed on the
Windows box. Running 豆包工作 and 豆包 side by side.
Reported-by: sinoyster
Reads Doubao Work's model list from the app's own model menu, keeps it in
models.json, and offers those models (0.1.4).
Reviewed at 43b3d5d (the author's 50c1448 plus a maintainer fix: the
config hook now keeps a model the user declared themselves, as every
other package does).
Run on mote: bun test packages/doubao-work 34 pass; bun scripts/check.mjs
doubao-work ok. Broken by hand: model lookup back on the built-in table
fails 2 tests; the old merge order fails the user-settings assertion.
Not tried: a real Doubao app (the author ran it on macOS, 8 models).
WANGY1ER asked on X for Windows: the plugin said "macOS only", because
binary() knew only /Applications/Doubao.app. Doubao's Windows app is the
same Chromium 147 fork with the same chat page (doubao://doubao-chat/chat),
so the plugin drives it the same way.
- binary(): %LOCALAPPDATA%\Doubao\Application\app\Doubao.exe, the per-user
install's own exe (Application\Doubao.exe beside it is a launcher).
- dataDir(): %LOCALAPPDATA%\magpie-doubao-work.
- copies() is empty on Windows: Chromium keeps one copy per profile there,
so the user's own Doubao keeps running and the plugin's copy opens
beside it, in a second window. No "quit Doubao first" on Windows.
- Linux stays unsupported: Doubao has no Linux build. Its download page's
platform list is ios, android, mac, OpenHarmony, windows. The sign-in
says so.
Run:
- bun test packages/doubao-work: 29 pass on mote (temp HOME, as CI),
win-run (Windows 11) and wsl-run (Ubuntu 24.04). bun scripts/check.mjs ok.
- Live on xiaomi-gpu (Windows 11, Doubao 2.34.6 / Chromium 147), with the
owner's own Doubao running in the console session: the plugin's App
started app\Doubao.exe from its own profile beside it, its DevTools port
answered with doubao://doubao-chat/chat, owns() took it, and each step
of an ask ran in the real page: NEW_TASK "", CLOUD "" (mode 云电脑),
自动 and 豆包 2.1 Lite picked, 豆包 2.1 Pro "upgrade", fill wrote three
lines into tiptap. The owner's copy was untouched throughout.
Broken by hand:
- binary() without its win32 line: "the app is found on macOS and
Windows" is red on mote and Windows.
- copies() without its win32 line: "on Windows a running copy never
blocks" is red on mote.
Not tried: a signed-in request on Windows. That Doubao has no account
signed in (its cookie jar is empty), so Enter was not sent; signed-in
STATE relies on data-testid=sidebar_bottom as on macOS.
The owner's sign-in spun with no end. Doubao runs one copy at a time: with
the user's own Doubao open, the plugin's copy (its own profile, debugging
port) quits within a second of starting, so the port never opens.
waitSignedIn took every error but app_missing as "not signed in yet" and
started it again for five minutes, saying nothing.
- App.start looks for a running copy of the binary on another profile
before it starts one, and fails with app_busy. The user's copy can't be
driven instead: Chromium allows debugging only off the default profile.
- waitSignedIn ends on any app_* error (busy, missing, start timeout) and
on abort; only a window still loading is waited for.
- Sign-in and requests say: quit Doubao (⌘Q) and try again. A request
gets 503.
Run: bun test packages/doubao-work on mote (+ check.mjs), Linux (WSL) and
Windows: 28 pass, 0 fail. With waitSignedIn's old catch put back, the new
waitSignedIn test is red (60s timeout instead of app_busy). Live on this
Mac, with a Doubao running from another profile: waitSignedIn threw
app_busy in 92ms, nothing spawned, no profile made. That a second copy
quits was tried first: Doubao with a fresh profile and port exited in ~1s,
port never up.
Not tried: the owner's Mac (10.0.0.175) itself.
magpie shows a model as "<name> · <provider>", so "豆包工作 · 自动" read
"豆包工作 · 自动 · 豆包工作" in pi. The names are now Doubao's menu names.
The models gave no modalities, so magpie asked models.dev about "auto",
another vendor's model, and told pi it takes images and a thinking level
map. Each model now says text in, text out.
Run: bun test packages/doubao-work on mote (with check.mjs), Linux (WSL)
and Windows: 25 pass, 0 fail. The new assertions fail on 0.1.0's names.
c1ed1b51's publish run went red on ubuntu: the sign-in test read the real
binary(), which is "" off macOS, so the callback said "macOS only". Its
App test spawned /bin/sh, which Windows doesn't have. Both passed on mote
(macOS) only.
createPlugin takes appBinary (default binary()), and the sign-in test gives
each case: a Mac path signs in, "" says macOS only. A new test holds
binary() per platform and DOUBAO_WORK_APP. The App test uses a file it
makes.
Run: bun test packages/doubao-work, 25 pass on mote (temp HOME, as CI),
wsl-run (Ubuntu 24.04) and win-run (Windows 11). bun scripts/check.mjs ok.
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).