@zeppeli777/tools-doubao 0.1.0 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/index.mjs +10 -3
  2. package/package.json +1 -1
package/index.mjs CHANGED
@@ -172,6 +172,7 @@ export const DoubaoTools = async (input, options) => {
172
172
  // 弹出二维码图片 → 用户手机豆包 App 扫码确认 → 轮询拿到 sessionid 写入 config.json。
173
173
  auth: {
174
174
  provider: PLUGIN_ID,
175
+ single: true, // 账号由插件 config.json 管理,Magpie 侧只存一份登录态
175
176
  methods: [
176
177
  {
177
178
  type: "oauth",
@@ -189,7 +190,13 @@ export const DoubaoTools = async (input, options) => {
189
190
  },
190
191
  });
191
192
  const file = writeAccountToConfig(result, "扫码登录");
192
- return { type: "success", accountId: `豆包 · ${result.sessionid.slice(0, 6)}…`, configFile: file };
193
+ // magpie 的 save() 只持久化带 key/refresh 的结果;key = sessionid
194
+ return {
195
+ type: "success",
196
+ accountId: result.userName || (result.userId ? `豆包用户 ${result.userId}` : "豆包账号"),
197
+ key: result.sessionid,
198
+ metadata: { ttwid: result.ttwid || "", passport_csrf_token: result.passport_csrf_token || "", deviceId: result.deviceId || "", webId: result.webId || "", configFile: file },
199
+ };
193
200
  } catch (err) {
194
201
  return { type: "failed", error: `豆包扫码登录失败:${err?.message || err}` };
195
202
  }
@@ -200,5 +207,5 @@ export const DoubaoTools = async (input, options) => {
200
207
  },
201
208
  };
202
209
  };
203
-
204
- export default DoubaoTools;
210
+ // 注意:这里不能再 export default —— Magpie 把"每个导出函数"都当作插件,
211
+ // default 重复导出会让同一 provider id 注册两次,UI 会报"已登录但无法列出"。
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zeppeli777/tools-doubao",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "description": "Doubao (豆包) image generation relay for Magpie: text-to-image and image-to-image with the user's own Doubao web session (QR-code sign-in), served to every agent via /mcp/magpie/tools",
5
5
  "type": "module",
6
6
  "main": "./index.mjs",