mslxdff 0.1.231 → 0.1.232

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 (104) hide show
  1. package/bin/mslxdff.js +3 -3
  2. package/package.json +1 -1
  3. package/src/auto.js +254 -254
  4. package/src/bench/cline-bench.js +42 -42
  5. package/src/bench/probe.js +70 -70
  6. package/src/bench/report.js +162 -162
  7. package/src/bench/runner.js +77 -77
  8. package/src/bench/via-probe.js +124 -124
  9. package/src/bench/via-routes.js +87 -87
  10. package/src/bench/workbuddy-bench.js +54 -54
  11. package/src/chat/engine.js +160 -160
  12. package/src/chat/gateway.js +163 -163
  13. package/src/chat/orchestrator.js +234 -234
  14. package/src/chat/prompt.js +70 -70
  15. package/src/chat/repl.js +88 -88
  16. package/src/chat/terminal.js +135 -135
  17. package/src/chat/tools.js +306 -306
  18. package/src/chat-pipeline/index.js +145 -145
  19. package/src/chat-pipeline/policy.js +84 -84
  20. package/src/cli/commands/group.js +266 -266
  21. package/src/cli/commands/model/picks.js +50 -50
  22. package/src/cli/commands/provider/bench-via.js +247 -247
  23. package/src/cli/commands/provider/bench.js +141 -141
  24. package/src/cli/commands/provider/index.js +139 -139
  25. package/src/cli/commands/provider/models.js +149 -149
  26. package/src/cli/commands/provider/qwenwork-login.js +119 -119
  27. package/src/cli/commands/provider/raccoon-quota.js +156 -156
  28. package/src/cli/commands/sync.js +310 -310
  29. package/src/cli/status.js +279 -279
  30. package/src/daemon.js +246 -246
  31. package/src/model-capabilities/enrich.js +86 -86
  32. package/src/model-capabilities/index.js +183 -183
  33. package/src/model-capabilities/parse.js +70 -70
  34. package/src/models.js +225 -225
  35. package/src/peers.js +345 -345
  36. package/src/providers/agentrouter.js +238 -238
  37. package/src/providers/base.js +164 -164
  38. package/src/providers/cline/auth.js +228 -228
  39. package/src/providers/cline/chat.js +307 -307
  40. package/src/providers/cline.js +2 -2
  41. package/src/providers/codearts/chat.js +207 -207
  42. package/src/providers/dispatcher.js +147 -147
  43. package/src/providers/globalqwenwork/cosy.js +123 -123
  44. package/src/providers/globalqwenwork/crypto.js +218 -218
  45. package/src/providers/globalqwenwork/http.js +20 -20
  46. package/src/providers/globalqwenwork/rsa.js +54 -54
  47. package/src/providers/globalqwenwork/sse.js +268 -268
  48. package/src/providers/globalqwenwork/stream.js +130 -130
  49. package/src/providers/globalqwenwork/upstream.js +122 -122
  50. package/src/providers/keyring.js +60 -60
  51. package/src/providers/qoder/chat.js +203 -203
  52. package/src/providers/qoder/index.js +249 -249
  53. package/src/providers/qoder/sse.js +145 -145
  54. package/src/providers/qwenwork/account-store.js +133 -133
  55. package/src/providers/qwenwork/constants.js +67 -67
  56. package/src/providers/qwenwork/cosy.js +120 -120
  57. package/src/providers/qwenwork/crypto.js +218 -218
  58. package/src/providers/qwenwork/http.js +20 -20
  59. package/src/providers/qwenwork/index.js +337 -337
  60. package/src/providers/qwenwork/payload.js +144 -144
  61. package/src/providers/qwenwork/rsa.js +54 -54
  62. package/src/providers/qwenwork/sse.js +268 -268
  63. package/src/providers/qwenwork/stream.js +130 -130
  64. package/src/providers/qwenwork/upstream.js +120 -120
  65. package/src/providers/qwenwork.js +1 -1
  66. package/src/providers/raccoon/const.js +202 -202
  67. package/src/providers/raccoon/credits.js +285 -285
  68. package/src/providers/registry.js +89 -89
  69. package/src/providers/workbuddy/auth.js +16 -0
  70. package/src/providers/workbuddy/chat.js +298 -264
  71. package/src/providers/workbuddy/client-headers.js +148 -0
  72. package/src/providers/workbuddy/desktop-info.js +17 -1
  73. package/src/providers/workbuddy/models.js +8 -20
  74. package/src/providers/workbuddy/reshape.js +152 -152
  75. package/src/providers/workbuddy.js +2 -2
  76. package/src/reasoning.js +32 -32
  77. package/src/routes/chat/broadband-handler.js +80 -80
  78. package/src/routes/chat/gateway.js +46 -46
  79. package/src/routes/chat/relay-pipeline.js +282 -282
  80. package/src/routes/chat/via-route-handler.js +156 -156
  81. package/src/routes/hedge.js +260 -260
  82. package/src/routes/models-route.js +167 -167
  83. package/src/routes/peers.js +373 -373
  84. package/src/routes/stream.js +347 -347
  85. package/src/runtime/bootstrap.js +75 -75
  86. package/src/runtime/keep-warm.js +135 -135
  87. package/src/runtime/provider-gate.js +75 -75
  88. package/src/runtime/providers-setup.js +187 -187
  89. package/src/runtime/raccoon-checkin.js +175 -175
  90. package/src/server.js +85 -85
  91. package/src/state/schemas/allowlist.js +92 -92
  92. package/src/sync-opencode.js +280 -280
  93. package/src/transport/index.js +244 -244
  94. package/src/transport/pool.js +56 -56
  95. package/src/transport/retry.js +24 -24
  96. package/src/transport/sse.js +93 -93
  97. package/src/upstream-probe/display.js +52 -52
  98. package/src/upstream-probe/probe.js +49 -49
  99. package/src/upstream-probe/rotate.js +110 -110
  100. package/src/upstream-probe/start.js +45 -45
  101. package/src/upstream.js +355 -355
  102. package/docs/cli_help_mini.md +0 -148
  103. package/src/providers/AGENTS.md +0 -49
  104. package/src/routes/AGENTS.md +0 -37
@@ -1,89 +1,89 @@
1
- /**
2
- * 可扩展供应商注册表:新增特殊供应商时,仅在此文件注册 + 新增对应 provider 文件即可
3
- * 每个条目:{ id, match(id, baseUrl) => bool, load() => Promise<factory> }
4
- * 匹配优先级:按数组顺序,首个命中即用;未命中走通用 generic
5
- */
6
-
7
- export const customProviders = [
8
- {
9
- id: "workbuddy",
10
- match: (id, baseUrl) => id === "workbuddy" || String(baseUrl).includes("copilot.tencent"),
11
- load: () => import("./workbuddy.js").then((m) => m.createWorkbuddyProvider),
12
- },
13
- {
14
- id: "traework",
15
- match: (id, baseUrl) => id === "traework" || String(baseUrl).includes("trae"),
16
- load: () => import("./traework.js").then((m) => m.createTraeworkProvider),
17
- },
18
- {
19
- id: "cline",
20
- match: (id, baseUrl) => id === "cline" || String(baseUrl).includes("cline.bot"),
21
- load: () => import("./cline.js").then((m) => m.createClineProvider),
22
- },
23
- {
24
- id: "codearts",
25
- match: (id, baseUrl) => id === "codearts" || String(baseUrl).includes("myhuaweicloud.com"),
26
- load: () => import("./codearts.js").then((m) => m.createCodeartsProvider),
27
- },
28
- {
29
- id: "qoder",
30
- match: (id, baseUrl) => id === "qoder" || String(baseUrl).includes("qoder"),
31
- load: () => import("./qoder/index.js").then((m) => m.createQoderProvider),
32
- },
33
- {
34
- // ⚠ 必须排在 qwenwork 之前:qwenwork 的 match 用 `includes("qwenwork")`,
35
- // 而 "globalqwenwork" 与 "gateway.qwenwork.ai"/"globalqwenwork://native" 都含该子串,
36
- // 若后置会被 cn 条目抢先命中(first-match-wins),把国际站 token 打到 cn 网关。
37
- id: "globalqwenwork",
38
- match: (id, baseUrl) => id === "globalqwenwork" || String(baseUrl).includes("qwenwork.ai"),
39
- load: () => import("./globalqwenwork/index.js").then((m) => m.createGlobalQwenworkProvider),
40
- },
41
- {
42
- id: "qwenwork",
43
- match: (id, baseUrl) => id === "qwenwork" || String(baseUrl).includes("qwenwork"),
44
- load: () => import("./qwenwork/index.js").then((m) => m.createQwenworkProvider),
45
- },
46
- {
47
- id: "zcode",
48
- match: (id, baseUrl) => id === "zcode" || String(baseUrl).includes("zcode.z.ai"),
49
- load: () => import("./zcode/index.js").then((m) => m.createZcodeProvider),
50
- },
51
- {
52
- id: "railway",
53
- // opencode zen free 层的另一个 IP 出口(Railway 反代),只暴露 free 模型。
54
- // 匹配必须排在 generic 之前,且不能与其它条目撞(railway.app 域名足够独特)。
55
- match: (id, baseUrl) => id === "railway" || String(baseUrl).includes("railway.app"),
56
- load: () => import("./railway.js").then((m) => m.createRailwayProvider),
57
- },
58
- {
59
- id: "raccoon",
60
- match: (id, baseUrl) => id === "raccoon" || String(baseUrl).includes("xiaohuanxiong.com"),
61
- load: () => import("./raccoon/index.js").then((m) => m.createRaccoonProvider),
62
- },
63
- // agentrouter 定制工厂已于 2026-10-21 摘除:现网成功率仅 ~48%(502/400/422/500 高发),
64
- // 从注册表 + 预热名单移除后网关不再解析 agentrouter/* 模型。工厂文件 src/providers/agentrouter.js
65
- // 与其测试保留,日后要重新启用只需在此加回一条 { id:"agentrouter", ... } 并同步 dispatcher 预热名单。
66
- ];
67
-
68
- // 供 bench/probe 等需要定制化解析模型列表的场景
69
- export const customNormalizers = [
70
- {
71
- id: "cline",
72
- match: (baseUrl) => String(baseUrl).includes("cline.bot"),
73
- normalize: (json) => Array.isArray(json?.free) ? json.free : null,
74
- },
75
- ];
76
-
77
- export async function getCustomProviderFactory(id, baseUrl) {
78
- for (const entry of customProviders) {
79
- try { if (entry.match(id, baseUrl)) return await entry.load(); } catch {}
80
- }
81
- return null;
82
- }
83
-
84
- export function getCustomNormalizer(baseUrl) {
85
- for (const entry of customNormalizers) {
86
- try { if (entry.match(baseUrl)) return entry.normalize; } catch {}
87
- }
88
- return null;
89
- }
1
+ /**
2
+ * 可扩展供应商注册表:新增特殊供应商时,仅在此文件注册 + 新增对应 provider 文件即可
3
+ * 每个条目:{ id, match(id, baseUrl) => bool, load() => Promise<factory> }
4
+ * 匹配优先级:按数组顺序,首个命中即用;未命中走通用 generic
5
+ */
6
+
7
+ export const customProviders = [
8
+ {
9
+ id: "workbuddy",
10
+ match: (id, baseUrl) => id === "workbuddy" || String(baseUrl).includes("copilot.tencent"),
11
+ load: () => import("./workbuddy.js").then((m) => m.createWorkbuddyProvider),
12
+ },
13
+ {
14
+ id: "traework",
15
+ match: (id, baseUrl) => id === "traework" || String(baseUrl).includes("trae"),
16
+ load: () => import("./traework.js").then((m) => m.createTraeworkProvider),
17
+ },
18
+ {
19
+ id: "cline",
20
+ match: (id, baseUrl) => id === "cline" || String(baseUrl).includes("cline.bot"),
21
+ load: () => import("./cline.js").then((m) => m.createClineProvider),
22
+ },
23
+ {
24
+ id: "codearts",
25
+ match: (id, baseUrl) => id === "codearts" || String(baseUrl).includes("myhuaweicloud.com"),
26
+ load: () => import("./codearts.js").then((m) => m.createCodeartsProvider),
27
+ },
28
+ {
29
+ id: "qoder",
30
+ match: (id, baseUrl) => id === "qoder" || String(baseUrl).includes("qoder"),
31
+ load: () => import("./qoder/index.js").then((m) => m.createQoderProvider),
32
+ },
33
+ {
34
+ // ⚠ 必须排在 qwenwork 之前:qwenwork 的 match 用 `includes("qwenwork")`,
35
+ // 而 "globalqwenwork" 与 "gateway.qwenwork.ai"/"globalqwenwork://native" 都含该子串,
36
+ // 若后置会被 cn 条目抢先命中(first-match-wins),把国际站 token 打到 cn 网关。
37
+ id: "globalqwenwork",
38
+ match: (id, baseUrl) => id === "globalqwenwork" || String(baseUrl).includes("qwenwork.ai"),
39
+ load: () => import("./globalqwenwork/index.js").then((m) => m.createGlobalQwenworkProvider),
40
+ },
41
+ {
42
+ id: "qwenwork",
43
+ match: (id, baseUrl) => id === "qwenwork" || String(baseUrl).includes("qwenwork"),
44
+ load: () => import("./qwenwork/index.js").then((m) => m.createQwenworkProvider),
45
+ },
46
+ {
47
+ id: "zcode",
48
+ match: (id, baseUrl) => id === "zcode" || String(baseUrl).includes("zcode.z.ai"),
49
+ load: () => import("./zcode/index.js").then((m) => m.createZcodeProvider),
50
+ },
51
+ {
52
+ id: "railway",
53
+ // opencode zen free 层的另一个 IP 出口(Railway 反代),只暴露 free 模型。
54
+ // 匹配必须排在 generic 之前,且不能与其它条目撞(railway.app 域名足够独特)。
55
+ match: (id, baseUrl) => id === "railway" || String(baseUrl).includes("railway.app"),
56
+ load: () => import("./railway.js").then((m) => m.createRailwayProvider),
57
+ },
58
+ {
59
+ id: "raccoon",
60
+ match: (id, baseUrl) => id === "raccoon" || String(baseUrl).includes("xiaohuanxiong.com"),
61
+ load: () => import("./raccoon/index.js").then((m) => m.createRaccoonProvider),
62
+ },
63
+ // agentrouter 定制工厂已于 2026-10-21 摘除:现网成功率仅 ~48%(502/400/422/500 高发),
64
+ // 从注册表 + 预热名单移除后网关不再解析 agentrouter/* 模型。工厂文件 src/providers/agentrouter.js
65
+ // 与其测试保留,日后要重新启用只需在此加回一条 { id:"agentrouter", ... } 并同步 dispatcher 预热名单。
66
+ ];
67
+
68
+ // 供 bench/probe 等需要定制化解析模型列表的场景
69
+ export const customNormalizers = [
70
+ {
71
+ id: "cline",
72
+ match: (baseUrl) => String(baseUrl).includes("cline.bot"),
73
+ normalize: (json) => Array.isArray(json?.free) ? json.free : null,
74
+ },
75
+ ];
76
+
77
+ export async function getCustomProviderFactory(id, baseUrl) {
78
+ for (const entry of customProviders) {
79
+ try { if (entry.match(id, baseUrl)) return await entry.load(); } catch {}
80
+ }
81
+ return null;
82
+ }
83
+
84
+ export function getCustomNormalizer(baseUrl) {
85
+ for (const entry of customNormalizers) {
86
+ try { if (entry.match(baseUrl)) return entry.normalize; } catch {}
87
+ }
88
+ return null;
89
+ }
@@ -53,6 +53,18 @@ export function parseRateLimitResetMs(bodyText, clock = Date.now) {
53
53
  return ms > 0 ? ms : 0;
54
54
  }
55
55
 
56
+ // 账号级风控封禁:腾讯 workbuddy `403 {"code":11140,"msg":"request illegal",displayMsg:"…restricted due to unusual activity/账号存在异常行为…"}`。
57
+ // 与 auth 失败、额度耗尽、限流都不同:**刷新 token 无效**(2026-10-21 实测:refresh 成功换发新 token 后照样 11140,
58
+ // 且换新 UA/完整客户端头集合同样 11140——判的是账号本体,不是凭据或请求指纹)。
59
+ // 命中即应长冷却该号并如实把 403 透回,绝不进 refresh→重打 的连锁(旧链每个用户请求白烧 号数×2 次上游调用 + 号数 次 refresh)。
60
+ export function isAccountRestricted(status, bodyText) {
61
+ if (status !== 403) return false;
62
+ const t = String(bodyText || "");
63
+ if (/"code"\s*:\s*11140\b/.test(t)) return true;
64
+ const lower = t.toLowerCase();
65
+ return lower.includes("request illegal") || lower.includes("restricted due to unusual activity") || t.includes("账号存在异常行为");
66
+ }
67
+
56
68
  export function isAuthError(status, bodyText) {
57
69
  if (status === 401 || status === 403) return true;
58
70
  const t = String(bodyText || "").toLowerCase();
@@ -86,10 +98,14 @@ export function createAuthService({
86
98
  }
87
99
  const p = (async () => {
88
100
  const url = joinUrl(resolvedBase, "/v2/plugin/auth/token/refresh");
101
+ // 回退到 2026-10-21 17:09 实测**可用**的旧头形(refresh 成功换发过新 token):refresh 无活体抓包,
102
+ // 不赌未验证口径;11140 只打 chat、refresh 不在风控画像主战场。X-Refresh-Token 是 refresh 特有凭据头。
103
+ // X-Auth-Refresh-Source: "plugin" 是 CLI bundle 三条 refreshSession 逐字共有的真值(@7064132/@7126898/@7144850),补上无副作用。
89
104
  const headers = {
90
105
  "Content-Type": "application/json",
91
106
  Authorization: `Bearer ${key}`,
92
107
  "X-Refresh-Token": rt,
108
+ "X-Auth-Refresh-Source": "plugin",
93
109
  "X-User-Id": uid,
94
110
  "X-Domain": auth.domain || "www.codebuddy.cn",
95
111
  "User-Agent": "CLI/2.115.0 WorkBuddy/2.115.0",