Files
plugins/packages/mclaw
yetone 0135b7b0ea agy-cli 0.1.32: the first model list after warming has agy's Claude and GPT models (#1064)
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
2026-11-13 10:59:13 +08:00
..

MClaw(中国移动云)

把中国移动云 MClaw(移动云盘 App 内的智能体,ai.yun.139.com)作为一个 OpenAI 兼容供应商接进 magpie 与 OpenCode:一次浏览器登录同时拿到 chat(llm 开放接口)、模型(账号实际可用清单与积分倍率)与用量(aitokens 池)。装好后所有 agent(Claude Code、Codex、openclaw 等)都能通过 magpie 用 mclaw/<model> 访问 MClaw 的模型,并享受 magpie 的用量统计与故障切换。

非官方插件,风险自负。本包与中国移动或 magpie 官方无隶属关系。接口协议 2026-11-04 从移动云盘 App 13.2.5 抓包逆向,平台未公开,随时可能变化或失效;本插件不绕过验证码、限流或任何平台限制。登录凭证只存 magpie 的 plugin-auth.json(600),插件目录不落任何凭证。

安装

magpie plugin add @magpie-community/opencode-mclaw-auth
magpie plugin login mclaw

(从源码跑:git clone https://github.com/joey-41/opencode-mclaw-auth.git MClaw && magpie plugin add ./MClaw)

登录

登录前提:浏览器登录由插件自己启动一个有界面的 Chromium 内核浏览器窗口(CDP --remote-debugging-pipe 驱动,收登录态),所以要求:

  • 本机安装了 Google Chrome / Microsoft Edge / Chromium / Brave 之一(macOS 上 Safari 不行:它不支持插件用的独立 --user-data-dir profile,也没有 CDP);
  • magpie 运行在有图形界面的本地会话里。远程服务器、SSH、容器、纯 headless 环境弹不出窗口——Linux 上未设置 DISPLAY / WAYLAND_DISPLAY 时插件会在选登录方式时直接报明原因。

浏览器装在非标准位置(或上述自动探测没找到)时,用 MCLAW_CHROME_PATH 指到可执行文件,例如 macOS:

MCLAW_CHROME_PATH="/Applications/Google Chrome.app/Contents/MacOS/Google Chrome" magpie plugin login mclaw

MCLAW_CHROME_PATH 会先校验存在/可执行,路径写错会明确报「指向的浏览器不存在或不可执行」,不会混成「找不到 Chrome」。没有可用的浏览器或没有图形界面时,无法完成浏览器登录,本插件目前只有这一种登录方式。


浏览器登录,一次登录凭证全自动,没有任何要填的输入:选「浏览器登录」→ 插件弹出一个专用浏览器窗口(每次登录一个全新 profile,不影响日常浏览器)→ 在窗口里登录移动云 yun.139.com(网页支持验证码、密码、扫码等多种方式,任选)→ 插件自动收走 authorization Cookie(= pc: 票,30 天期),其余全自动:llm chat key(na-…)与模型倍率表自动取回,openclawId 与账号实际模型清单自动发现,vip 会话由换票链自动维持(toSourceId 001005,与 App vip 会员中心同渠道;进程内复用,24h 期,失败 30 分钟冷却),用量窗口(含「重置于」与逐条明细)自动接上;账号显示名 = 掩码手机号(票里解出)。票到期前 3 天自动续期:headless 复开该账号自己的 profile(目录存在账号 metadata 里,多账号互不串票,续期时会校验收割到的票属于本账号),网页会话自己刷新后重新收割,票换了顺手刷新 key。取消登录、登录失败或超时都会立即关掉 Chrome 并清掉当次的 profile 目录。已知限制:重新登录同一账号会生成一个新 profile,旧目录会留在 mclaw-browser-profiles/ 下(内含不再被任何账号引用的历史登录态,可手动删除)。

模型

登录后模型目录与倍率自动发现(agent/list + config/get),无需硬编码 ID;下表是未登录时的静态目录。

模型 ID(mclaw/…) 名称 倍率 备注
blian_qwen38_flash Qwen3.8-Flash 0.18 推理;并行工具调用实测 8/8
blian_qwen38_max Qwen3.8-Max 1.5 推理
huoshan_glm_5_3 GLM-5.3 3.5 推理
blian_qwen37_plus Qwen3.7-Plus 1.5 推理
blian_qwen36_plus Qwen3.6-Plus 1.0
blian_qwen35_plus Qwen3.5-Plus 0.6 多模态
blian_deepseek_v4_pro DeepSeek-V4-Pro 2.5 推理
vlm_huoshan_2_0_lite_thinking_vision Seed-2.0-Lite 1.0 推理+视觉
vlm_huoshan_2_0_mini_thinking_vision Seed-2.0-Mini 0.3 推理+视觉
huoshan_deepseek_v4_1_flash DeepSeek-V4.1-Flash 未知 计费表未列出

rate 是 App 的 tokenRatio 计费倍率(如 flash 0.18×),不是美元价格。上下文/输出上限 App 未暴露,插件按 200k/32k 声明,仅作调度参考,以上游实际判定为准。

用量

aitokens 池窗口:总量、已用、剩余与「重置于」。重置于来自消耗明细里的权威 endTime(当前周期终点);vip 会话由插件自动维持(SSO 换票链,toSourceId 001005),没有可用会话时不显示重置时间——上游不给周期起止,插件不用别的账号的周期猜。上游报「无效的ApiKey」时插件转成明确的登录失效(401),重新登录即可。

Options

magpie plugin options mclaw '{"base": "https://ai.yun.139.com/api/llm/102001"}'

环境变量(浏览器登录相关):MCLAW_CHROME_PATH(Chrome / Edge / Chromium / Brave 可执行文件路径,默认按平台探测;设置后会校验存在/可执行)、MCLAW_BROWSER_PROFILE(登录 profile 目录的根,每个账号用其下的独立子目录,默认 ~/.config/magpie/mclaw-browser-profiles/)。登录前提见上文「登录」。

许可证

MIT