New package @magpie-community/opencode-inkstone-auth 0.1.0 for Intern InkStone (书生·端砚, Shanghai AI Lab) Token Plan, provider id `intern-inkstone`. Community package by yunwang2442-creator. What it does: - Browser sign-in (Edge/Chrome, its own profile under $XDG_CONFIG_HOME or ~/.config/magpie/inkstone-browser, or %LOCALAPPDATA%\magpie\inkstone-browser). The login window has no debugging port. A headless CDP read takes the uaa-token cookie, and the same read renews it silently later. - Usage card: ink-credit balance, 5-hour and 7-day windows, credit packs. - Chat: a pasted ink-* API key, or one the sign-in creates, named ink-<host4>-<acct4>-<rand4> (18 of the console's 20 characters). An idempotency clash (-15109) retries with a fresh name, up to three times. Pruning is on by default. It only touches this machine's and account's prefix, keeps the newest two and the key this sign-in created, and never deletes manual keys or keys of unknown age. - Closing on Unix: SIGTERM, then SIGKILL only after a 15s grace. Leftover browsers are matched by --user-data-dir=<escaped profile>, and Windows uses .Contains(). - The login wait comes from an injected waitForLogin in tests. No env hook is left in production code. - Hosts: discovery.intern-ai.org.cn, discovery-api.intern-ai.org.cn, 127.0.0.1 (CDP). Outside the package: scripts/opencode2.mjs lets a prompt with `required: false` stay optional (`p.required !== false`). Every package's copy is synced byte for byte, so all 39 copies in the merged tree are blobafe074cb. No other package sets `required: false` on a prompt, so this changes nothing for them. Also a root README row and a registry entry. Review at 36412a15, on mote, HOME=$(mktemp -d), Bun 1.4.2: - bun test packages/inkstone: 68 pass, 0 fail in Asia/Shanghai, UTC, America/Los_Angeles and Pacific/Kiritimati. - bun scripts/check.mjs inkstone and bun scripts/check.mjs: ok. - bun test (repo), on 36412a15 merged with origin/maine7cb9dc5: 6743 pass, 20 skip, 0 fail. main has since moved by cline 0.1.14 and zcode 0.1.55 only, and none of the adapter copies changed. - Broken by hand, each red: no protectName protection; prune_keys default off; no post-sign-in prune; no SIGTERM on close; the -15109 retry keeping its name. Not tried: a real InkStone account sign-in on macOS, Linux or Windows (no account here); a live chat request; magpie end to end with the plugin.
@magpie-community/opencode-loomy-auth
OpenCode / magpie provider 插件:Loomy(讯飞,loomyad.xunfei.cn)——登录、模型清单、聊天转发、双积分钱包与每日赠送积分刷新(签到)。
请求形态移植自 aimod-cc/agent2api(MIT)的 providers/loomy,按 magpie 插件 API 重写。
安装
magpie plugin add @magpie-community/opencode-loomy-auth
magpie plugin login loomy # 选「短信验证码登录」或「手动粘贴 session」
能力
- 登录:
短信验证码登录(发码 → 输入 6 位码完成,session 14 天)或手动粘贴 session。 - 无续期接口:session 过期(业务码
020002/100002)需重新登录(短信或粘贴)。 - 聊天:
POST {modelBase}/chat/completions,OpenAI 形态基本透传,两处适配(参照实现reasoning_patch/images.rs):思考档折进 low/medium/high(超档删除)、旧版 DeepSeek(deepseek-v4-flash-0731)的 data-URI 图片转<image_base64>标记(DeepSeek-V4.1-Flash 收 OpenAIimage_url,不转,#811);SSE;请求头必须带charset=utf-8(上游对无 charset 的 body 按 GBK 解码)。 - 画图:
POST {modelBase}/images/generations(doubao-seedream-5-lite / qwen-image-3.0-pro / Hy-Image-3.5-preview),body 按 magpie 写的原样透传,Accept: application/json(不是 SSE),回答是普通 JSON(data[].url、points_consumed)。401/403 报登录失效。/images/edits(改图)暂不转发:magpie 发给插件的改图是 multipart,Loomy 网关收不收这种改图没有实测过(#609)。 - 模型:登录前给静态表(2026-10-16 实抓
/api/v1/models的 chat 模型:DeepSeek-V4.1-Flash / deepseek-v4-flash-0731 / MiniMax-M3 / Kimi-k2.6 / qwen-3.8-max / GLM-5.3-Flash / qwen3.8-flash / spark-x / mimo-v2.5 / auto),登录后以GET /api/v1/models的实时目录为准(能力位读capabilities;展示名尾部倍率(x3.0)拆为 rate 字段)。 - 余额(usage):
GET /api/v2/points/records?...→ 永久积分 + 每日赠送积分两个窗口;每日窗口用厂商自己的dailyLimitPoints/dailyRemainingPoints报「已用/剩余/上限」,厂商未带这一对时按无上限的余额展示(不编造上限)。响应缺余额字段时报 error("未知"不冒充 0)。 - 签到判定:
first-login接口对"当天首登"与"重复调用"都返回成功,插件用调用前后的每日余额差判定——涨了 =claimed(今日首登奖励),没涨 =done(已领过/无每日钱包)。 - 每日签到(checkin):
POST /api/v1/points/first-login(body{})——服务端按"当天是否第一次"把每日赠送刷回;按天幂等,重复调=成功。这是厂商客户端自己就会发的那个单请求(判定见上)。
账号域签名说明
登录两步(POST https://account.xfinfr.com/login/phone/{sendMsgCode,checkCode})带 HMAC-SHA1 签名头(9 段待签串,AK/SK 为客户端内置常量),插件按参照实现同款实现(见 index.mjs 的 signHeaders)。
环境变量(测试 / 镜像用,与 agent2api 同名)
| 变量 | 默认 |
|---|---|
LOOMY_XFYUN_BASE_URL |
https://account.xfinfr.com(登录域,HMAC 签名;来自客户端安装包 app.asar 内解密的 .env.prod 的 VITE_XFYUN_BASE_URL,是讯飞账号域 CAccount 自己的 host) |
LOOMY_POINTS_BASE_URL |
https://loomyad.xunfei.cn(积分/签到/模型网关) |
测试
bun test packages/loomy
测试打到本地假上游(fake.mjs),不触网、不使用真实 token。
许可
MIT。请求逻辑移植自 aimod-cc/agent2api(MIT)。