On a signed-in agy, `agy models` takes about 4.4s and `agy acp`'s
session/new about 3s. provider.models() needed three calls before
claude-opus-5-5, claude-sonnet-5-5 and gpt-oss-120b showed up, and
OpenCode 2.x calls it once.
What changed:
- packages/agy-cli/index.mjs:
- The offered-model probe now starts in listAgyModels' .then, as soon as
a non-empty list arrives and a caller asked for probeOffered. It no
longer waits for the next models() call. A hung or failed `agy models`
still never spawns the probe.
- probeSignedIn reuses the `agy models` stdout it already has. The same
parser (parseAgyModels, split out of listAgyModels) fills
cachedModelCatalog, and the probe starts. Sign-in waits for the probe
for at most 3s.
- The offer (acpOfferedModels, acpOfferedKey, offeredProbeAt and any
in-flight probe) is forgotten when agyPath changes and after a new
sign-in finishes. A generation counter drops the answer of a probe
that started before the reset.
- provider.warming() returns a promise while a list or probe is still
running, and null when nothing is.
- scripts/opencode2.mjs, copied byte for byte to every
packages/*/opencode2.mjs: after the first background refresh, the
adapter awaits hooks.provider.warming() once, for at most 60s, and then
refreshes once more. It does not loop. Plugins without warming() behave
as before.
- Not done: the issue's on-disk catalog cache (point 3), skipped as asked.
Known gap: agy-cli has no `config` hook, so under OpenCode 2.x the adapter
lists no provider for it. refresh() returns before it calls
provider.models(), so the follow-up refresh can't add agy's models on 2.x
until agy-cli gets a config hook.
Tests: test/testkit.mjs's fake agy takes a sessionNewDelayMs. The new
tests in test/catalog.mjs set 1.5s on both `agy models` and session/new
and wait for state through warming(), with no fixed sleeps:
- On a slow cold start, the first models() after warming lists Claude and
GPT, from one probe spawn.
- authorize() on a signed-in agy fills the catalog, and the next models()
runs no second `agy models`.
- The sign-in wait is bounded: with a 6s session/new, sign-in returns in
about 4.5s.
- Changing agyPath probes again.
The hang test now awaits warming() before it counts acp spawns.
scripts/opencode2.test.mjs: the warming list is read a second time when
warming ends, and only once when nothing is warming.
Run on Linux (a separate test Mac was over its load limit):
- packages/agy-cli bun test: 17 pass, 0 fail.
- bun scripts/check.mjs agy-cli: ok.
- bun scripts/check.mjs (all packages): ok.
- Root bun test in a temp HOME: 8530 pass, 19 skip, 0 fail.
Broken by hand on Linux, each red, then restored green:
- No probe in the .then: the slow cold-start test.
- probeSignedIn drops the list: the authorize and bounded-wait tests.
- agyPath change keeps the old offer: the agyPath test.
- Unbounded sign-in wait: the bounded-wait test (7514ms).
- Probe also on a failed listing: the hang test.
- origin/main's index.mjs with the new tests: all four #1064 tests.
- Adapter reads the list once: the warming adapter test, and the
copy-identity check.
Not tried: a real agy (no Google sign-in, no network). The reset after
login.finish has no unit test of its own.
Reported-by: hiee3
豆包工作 (Doubao Work)
This is not a model API. Doubao Work has no model interface for other
clients. An agent that picks a doubao-work/* model gets one run of
Doubao's cloud agent: the request is flattened into one message, Doubao
plans and uses its own tools, and the client's tool calls are read back
from text. One request at a time, text only.
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 its desktop app, 豆包工作 (DoubaoWork), the way a person does instead, and gives what it reads back as an OpenAI chat completion. 豆包 (Doubao), whose 工作任务 are the same, works too:
-
It starts the app from a profile of its own (under
~/Library/Application Support/magpie-doubao-workon macOS,%LOCALAPPDATA%\magpie-doubao-workon Windows; 豆包工作's indoubaoworkthere), with Chrome DevTools on a local port. Your everyday profile is not touched; you sign in once in this second window.The app is 豆包工作 when it is installed (
/Applications/DoubaoWork.appor~/Applications/DoubaoWork.appon macOS,%LOCALAPPDATA%\DoubaoWork\Application\app\DoubaoWork.exeon Windows), else 豆包 (Doubao.app,%LOCALAPPDATA%\Doubao\Application\app\Doubao.exe). If you signed in to 豆包 through the plugin before 0.1.5, it stays on 豆包 while 豆包 is installed.An app installed somewhere else (
D:\Apps\DoubaoWork, an external disk) is found without setting anything: on Windows from its uninstall entry, its App Paths entry or a running copy; on macOS from Spotlight, a running copy, or one folder down in/Applications,~/Applicationsand/Volumes/*. -
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.
-
It reads the reply from the message Doubao renders, as it streams: the raw markdown, and the thinking as
reasoning_content. -
The client's tools are asked for as text,
<tool_call>{"name": …, "arguments": …}</tool_call>, and given back astool_calls.
Models: the plugin reads Doubao's own model menu, so whatever the app offers
is what magpie lists. The menu row text becomes the id: 自动 (auto), 豆包 2.1
Lite (doubao-2.1-lite), 豆包 2.1 Pro (doubao-2.1-pro, needs a paid Doubao
plan), DeepSeek V4.1 Flash (deepseek-v4.1-flash), GLM 5.3 (glm-5.3) and so
on. Rows that open a submenu (推理强度) are not models and are skipped.
The list is read when you sign in, and again on a request once the cached list
is more than six hours old, or at once when a request names a model the
cached list doesn't have (at most once a minute); it is kept in models.json under
DOUBAO_WORK_HOME (~/Library/Application Support/magpie-doubao-work on
macOS, %LOCALAPPDATA%\magpie-doubao-work on Windows) and read before
anything else. The three models the plugin was written with stay as the
fallback for when the menu cannot be read.
A list never read (an account that signed in before the plugin read menus) is
read when magpie lists the models, once a minute at most, and only from an app
the plugin has started before. Rows whose names differ only in Chinese get
distinct ids: Kimi K3.1 Pro 高速 is kimi-k3.1-pro-fast.
Third-party models you added to 豆包工作 yourself (your own API key) are not served here: the plugin lists only what the app's model menu offers from Doubao's side, and a model that runs on your own key is a direct call to that vendor, not a Doubao task. Add that API to magpie as its own provider instead.
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.
- On macOS, the app runs one copy at a time. If you opened it yourself, quit it (⌘Q) first: the plugin's copy can't start beside it, and yours can't be driven (Chromium allows debugging only off the default profile). While the plugin's copy runs, opening Doubao brings up its window, which you can use as well. On Windows the plugin's copy runs beside yours, in a second window.
- 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 and Windows. Neither app has a Linux build.
Settings
DOUBAO_WORK_APP: the app's binary, if it is not in one of the places above and the system does not know it. A path naming DoubaoWork is driven as 豆包工作, any other as 豆包.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.