dsh-free-model 0.2.5 → 0.5.1
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.
- package/README.md +4 -2
- package/README_EN.md +4 -2
- package/SECURITY-AUDIT.md +3 -3
- package/package.json +1 -1
- package/vendor/channel-pack/NOTICE.md +17 -0
- package/vendor/channel-pack/pack.js +265 -47
package/README.md
CHANGED
|
@@ -88,7 +88,7 @@ dsh plugin --profile web add dsh-our-free-model # 回滚到上游 2.1.0
|
|
|
88
88
|
| `packages/standalone/`(独立 Web 产品)、`worker/`(EAC 的 Cloudflare 授权网关)、`feed/` + `catalog/`(公告源与发布清单) | 三块卫星全部 `import` 被删车道,留着就是一套永远跑不起来的代码。 |
|
|
89
89
|
|
|
90
90
|
规模变化:`src/` 从 **58 个模块 → 5 个**(`store/key/chan-relay/egress/trust`),宿主 `index.js` 从
|
|
91
|
-
**2343 行 → 684 行**,浏览器半身 `client.js` 从 **5992 行 → 2531 行**,离线测试从 45 个套件 → **
|
|
91
|
+
**2343 行 → 684 行**,浏览器半身 `client.js` 从 **5992 行 → 2531 行**,离线测试从 45 个套件 → **18 个**。
|
|
92
92
|
界面里所有 `animation` 与 `@keyframes` 也已删除。
|
|
93
93
|
|
|
94
94
|
## 配置
|
|
@@ -142,7 +142,7 @@ POST /chan-gateway/rotate 轮换中继密钥
|
|
|
142
142
|
## 测试
|
|
143
143
|
|
|
144
144
|
```bash
|
|
145
|
-
npm test #
|
|
145
|
+
npm test # 18 个离线套件,无需网络、不花额度
|
|
146
146
|
node scripts/host-smoke-test.mjs # 只跑宿主 HTTP 面
|
|
147
147
|
node scripts/client-lint.mjs # 只跑浏览器半身(字典键一一对应 + CSS 规则可达)
|
|
148
148
|
```
|
|
@@ -160,6 +160,8 @@ node scripts/client-lint.mjs # 只跑浏览器半身(字典键一一
|
|
|
160
160
|
| `channel-cline-dev` | Cline 的 models.dev 目录:`Accept-Encoding: br, gzip`、ETag/条件请求、**304 回退成上次结果**(不许变空表)、超时 60s、`supportsImage: false` 保真 |
|
|
161
161
|
| `channel-officeace-lock` / `channel-officeace-login` | 移植渠道 OfficeAce:登录闭环真走 RPC(authorize URL → poll → 换 token → 落库);锁定分道的**判定与执行**逐条断言(未锁定逐字走旧路径、锁定+只剩永久桶必须抛错不回落)|
|
|
162
162
|
| `channel-accio` | 移植渠道 Accio:真走 RPC 完成回调式登录(授权页 → 本地回调 → 换 token → 按**账号 ref** 落库),并断言自动续期表覆盖 accio / officeace(漏一项 = 静默不续期且零日志)|
|
|
163
|
+
| `channel-buddy-conv` | WorkBuddy/CodeBuddy:`send()` 必发三枚非空 `X-Conversation-*`(缺则特定账号整条渠道 `400/11128` 全灭);渠道校验档换号、**不写冷却**、报 `PERMISSION_DENIED` 指向账号;单账号池不误报 `QUOTA_EXCEEDED`;11140 仍写冷却 |
|
|
164
|
+
| `channel-fingerprint` | 腾讯系内容指纹改写:assistant 正文那格一旦漏改,带毒历史每轮重放 ⇒ **会话报废且换任何腾讯系模型都一样**;白名单严格只有 buddy/workbuddy;良性文本不被破坏 |
|
|
163
165
|
|
|
164
166
|
上游的 45 个套件里,其余的都在测被删掉的车道,已一并移除。测试**只在仓库里跑**(npm 包不含 `scripts/`)。
|
|
165
167
|
|
package/README_EN.md
CHANGED
|
@@ -95,7 +95,7 @@ Four settings pages (down from nine):
|
|
|
95
95
|
|
|
96
96
|
Sizes: `src/` went from **58 modules to 5** (`store/key/chan-relay/egress/trust`), the host `index.js`
|
|
97
97
|
from **2343 to 684 lines**, the browser half `client.js` from **5992 to 2538 lines**, and the offline
|
|
98
|
-
suites from 45 to **
|
|
98
|
+
suites from 45 to **18**. Every `animation` and `@keyframes` rule is gone as well.
|
|
99
99
|
|
|
100
100
|
## Configuration
|
|
101
101
|
|
|
@@ -148,7 +148,7 @@ the browser half talks to it over the shell's `connection` RPC (`usage.tokenLedg
|
|
|
148
148
|
## Tests
|
|
149
149
|
|
|
150
150
|
```bash
|
|
151
|
-
npm test #
|
|
151
|
+
npm test # 18 offline suites: no network, no quota
|
|
152
152
|
node scripts/host-smoke-test.mjs # the host HTTP surface only
|
|
153
153
|
node scripts/client-lint.mjs # the browser half only (dictionary keys, CSS reachability)
|
|
154
154
|
```
|
|
@@ -166,6 +166,8 @@ node scripts/client-lint.mjs # the browser half only (dictionary keys, C
|
|
|
166
166
|
| `channel-cline-dev` | Cline's models.dev catalog: `Accept-Encoding: br, gzip`, ETag conditional requests, **304 falling back to the previous result** (never an empty catalog), 60s timeout, and `supportsImage: false` preserved |
|
|
167
167
|
| `channel-officeace-lock` / `channel-officeace-login` | The ported OfficeAce channel: the login loop really goes through RPC (authorize URL → poll → token → persisted); the lock **decision and its execution** are asserted case by case (unlocked keeps the old path verbatim, locked-with-only-permanent must throw and never fall back to the pool) |
|
|
168
168
|
| `channel-accio` | The ported Accio channel: a callback-style login really goes through RPC (authorize page → local callback → token exchange → persisted under the **account's own ref**), plus the auto-renew table is asserted to cover accio / officeace (a missing entry = silently never renewed, with no log) |
|
|
169
|
+
| `channel-buddy-conv` | WorkBuddy/CodeBuddy: `send()` must emit three non-empty `X-Conversation-*` headers (without them, certain accounts get the whole channel dead on `400/11128` every turn); the channel-verification tier rotates accounts, **writes no cooldown**, and reports `PERMISSION_DENIED` pointing at the account; a single-account pool must not misreport `QUOTA_EXCEEDED`; 11140 still writes its cooldown |
|
|
170
|
+
| `channel-fingerprint` | Tencent content-fingerprint rewriting: missing the assistant-body case means a poisoned history replays every turn — the session is dead **and switching to any other Tencent model does not help**; the allowlist is exactly buddy/workbuddy; benign text is left intact |
|
|
169
171
|
|
|
170
172
|
The other 37 of upstream's 45 suites tested lanes this fork deletes. The suites run **from a checkout
|
|
171
173
|
only** — the npm package does not ship `scripts/`.
|
package/SECURITY-AUDIT.md
CHANGED
|
@@ -12,12 +12,12 @@
|
|
|
12
12
|
| --- | --- |
|
|
13
13
|
| `index.js` | `a932bcb6bdeef608496071a60d1f9e8499997fca52765e0eb300171d8728aa57` |
|
|
14
14
|
| `client.js` | `13332f9b4102e5cc7125998983126df7b50cfa6a32ef5e20aefc51aca0a5e820` |
|
|
15
|
-
| `vendor/channel-pack/pack.js` | `
|
|
15
|
+
| `vendor/channel-pack/pack.js` | `b0162b38daa781ff79f1a79fef0f2528e7101c7812339f721815c015f2186e72` |
|
|
16
16
|
|
|
17
17
|
⚠️ `pack.js` 的指纹随每次「刷新模型数据 / 移植上游修复」而变(它是构建产物)。
|
|
18
|
-
|
|
18
|
+
上面的值对应**补上 DSH 自身 system 首句指纹(2026-10-21,CodeBuddy 国内版整条渠道 400 的根因)之后**的版本;
|
|
19
19
|
域名面结论未变,`scripts/egress-audit.mjs` 可随时重跑复验。
|
|
20
|
-
(上一版 `
|
|
20
|
+
(上一版 `e1d8d46c…` 是腾讯指纹改写到 assistant 正文后的产物。)
|
|
21
21
|
|
|
22
22
|
## 结论
|
|
23
23
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-free-model",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "dsh 插件(DeepSeek Harness / cordis bundle)· 模型接入 —— 把 CodeArts、CodeBuddy / WorkBuddy、LobsterAI、Qoder / Qoder CN、TRAE、Cline、Loomy、Raccoon、MiniMax Code、ZCode、Gemini、OfficeAce、Accio Work 十五个账号渠道接进 dsh 的模型选择器,并保留数据看板、运行日志与本地网关(含局域网中继)。上游 2.1.0 的匿名免费车道、EAC 协付车道、聚合渠道、省 Token、路由、公告/升级/热重载与独立 Web 产品已全部移除。",
|
|
6
6
|
"main": "./index.js",
|
|
@@ -44,6 +44,23 @@ Cline、Loomy、Raccoon、MiniMax Code、ZCode、Gemini、OfficeAce、Accio Work
|
|
|
44
44
|
`STS5.1806 invalid refresh token: 'decode jwt header failed'`(2026-10-19 实发)。
|
|
45
45
|
现全部脚本进程级隔离该变量。
|
|
46
46
|
|
|
47
|
+
### 后续单点修复移植(2026-10-21)
|
|
48
|
+
|
|
49
|
+
| 上游 | 修的是什么 | 本地改动 |
|
|
50
|
+
| --- | --- | --- |
|
|
51
|
+
| `83ced0d`(IKM3A0) | `officeace-product.ts` 的 `contextWindow` 初版**全是估值**(GLM 三行 202_752 抄自 CodeArts 表、`deepseek-v4.1-flash` 196_608 查无出处)⇒ 比真实上限小 5.3 倍,DSH 压缩阈值 `0.8×contextWindow` 提前触发,**1M 能力永远吃不到**(静默降级,不报错)| 逐字覆盖为上游真机取证值(glm-5.3/deepseek-v4.1-flash `1_048_576`、glm-5.2/deepseek-v4-flash `1_044_480`、kimi-k2.6 `262_144`,含取证注释整段)|
|
|
52
|
+
| `b554b73`+`eeda381`+`510bf91`+`7b24e23`(IKM73W/IKM7SG) | WorkBuddy 的 `send()` **缺 `X-Conversation-*` 三头** ⇒ 特定账号每轮 `HTTP 400 {"code":11128,"msg":"request illegal"}`,**整条渠道全灭**(真机探针复现:无三头 400 → 带三头 200);且 11128 不满足 `isRateLimited` ⇒ 落进「非限流即抛」,换号救不了 | `send()` 补三头(根因);`buddy-adapter.ts` 搬入渠道校验判据三条腿 + 排除腿(`isContentRejection` 不再把 11128 误判成 11140 而误封可用账号 30 分钟)+ 四处集成(认证/限流两换号循环、两处出口、流内帧),调用点 7 处与上游对齐 |
|
|
53
|
+
|
|
54
|
+
⚠️ 11128 判据**必须按 `msg` 措辞、绝不按 `code===11128` 放宽**:同码至少四族子原因
|
|
55
|
+
(渠道校验=换号 / unapproved channel=改内容 / 非 system 首条=补 system / 内容指纹=改写),
|
|
56
|
+
按 code 会把后几族也拖进换号 ⇒ 误伤。回归钉子:`scripts/channel-buddy-conv-test.mjs`
|
|
57
|
+
(三头非空 / 单账号 11128 报 PERMISSION_DENIED 不写冷却 / 换号 / 11140 仍写冷却;
|
|
58
|
+
两条变异验证过有牙)。
|
|
59
|
+
|
|
60
|
+
⚠️ 本轮还修了测试桩 `scripts/lib/channel-pack-kernel.mjs` 的一个错位:`LlmError`
|
|
61
|
+
形参写成 `(code, message)`,真实签名是 `(message, code)` ⇒ 桩不校验,任何断言
|
|
62
|
+
`err.code` 的用例拿到的都是 message。桩对齐真实签名后 4 条断言才可信。
|
|
63
|
+
|
|
47
64
|
⚠️ **移植一个带「锁定永久积分」的渠道,必须同时登记 `channel-pack-rpc.ts` 的
|
|
48
65
|
`PERMANENT_LOCK_PROVIDERS`** —— 上游那个 issue 的缺陷是「UI 有按钮、执行代码没有」,
|
|
49
66
|
而**只接执行代码、漏登记白名单是它的镜像**:写入被白名单先一步拒掉 ⇒
|
|
@@ -34536,6 +34536,144 @@ function isPositiveFinite(value) {
|
|
|
34536
34536
|
return typeof value === "number" && Number.isFinite(value) && value > 0;
|
|
34537
34537
|
}
|
|
34538
34538
|
|
|
34539
|
+
// vendor/channel-pack/src/openai-gateway/tencent-fingerprint.ts
|
|
34540
|
+
var TENCENT_PROVIDERS = ["buddy", "workbuddy"];
|
|
34541
|
+
var CONTENT_FINGERPRINTS = [
|
|
34542
|
+
{
|
|
34543
|
+
// ★ **DSH 自己的 system 提示词首句**(2026-10-21 本机实测新增,issue 无此条)。
|
|
34544
|
+
//
|
|
34545
|
+
// 这条与其余几条**来源不同**:那几条是「外部客户端(ZCode / Claude Code)往
|
|
34546
|
+
// system 里注了什么」,本条是 **DeepSeek Harness 自己**的 agent 提示词开头。
|
|
34547
|
+
// 也就是说 —— 用 DSH 直连腾讯系渠道时,**每一轮都会带上它**,于是 CodeBuddy
|
|
34548
|
+
// (国内 `copilot.tencent.com`)**整条渠道必然 400**,与用户内容无关。
|
|
34549
|
+
//
|
|
34550
|
+
// ## 实测(2026-10-21,国内站,真实账号)
|
|
34551
|
+
//
|
|
34552
|
+
// 触发判据是**逐字符 + 行首锚定**,比其余几条更窄:
|
|
34553
|
+
//
|
|
34554
|
+
// | 探针 | 结果 |
|
|
34555
|
+
// |---|---|
|
|
34556
|
+
// | `You are an AI agent powered by DeepSeek Harness.` | ❌ **400/11128** |
|
|
34557
|
+
// | 前接 `Hello. `(同句移到句中) | ✅ 200 ⇒ **行首锚定** |
|
|
34558
|
+
// | 只留 `You are an AI agent powered by` | ✅ 200 ⇒ 缺后半句不触发 |
|
|
34559
|
+
// | 只留 `powered by DeepSeek Harness` | ✅ 200 ⇒ 同上 |
|
|
34560
|
+
// | 只留 `DeepSeek Harness` / `You are an AI agent` | ✅ 200 ⇒ 单独词不触发 |
|
|
34561
|
+
// | 同句第二句(`You are a coding agent powered by …`) | ✅ 200 ⇒ **只认这一句** |
|
|
34562
|
+
//
|
|
34563
|
+
// 改写后放行(3 个模型各验一遍,`deepseek-v4.1-flash` / `hy3` / `step-5-preview`):
|
|
34564
|
+
// 原句全部 ❌ 400,改 `running on` 后全部 ✅ 200。
|
|
34565
|
+
//
|
|
34566
|
+
// ⚠️ **只改这一个词**(`powered by` → `running on`):语义不变、句长不变,
|
|
34567
|
+
// 且不动后半句 —— 破坏 agent 提示词的语义比多拦一轮更糟。
|
|
34568
|
+
// ⚠️ 匹配仍走本文件的**大小写不敏感 + 位置无关** replaceAll(行首锚定是
|
|
34569
|
+
// 服务端的判据,不是我们的改写范围)—— 改写范围宁可略宽。
|
|
34570
|
+
find: "You are an AI agent powered by DeepSeek Harness.",
|
|
34571
|
+
replace: "You are an AI agent running on DeepSeek Harness.",
|
|
34572
|
+
note: "2026-10-21 \u672C\u673A\u5BF9 copilot.tencent.com \u5B9E\u6D4B\uFF1A\u539F\u53E5 400/11128\u3001\u6539\u5199\u540E 200\uFF083 \u6A21\u578B\u590D\u9A8C\uFF09"
|
|
34573
|
+
},
|
|
34574
|
+
{
|
|
34575
|
+
// ZCode 内建常量:`$Js="Main branch (you will usually use this for PRs)"`。
|
|
34576
|
+
// 每个 git 仓库里的会话都会被注入(拼在 `Main branch … : <分支名>` 这一行)。
|
|
34577
|
+
find: "Main branch (you will usually use this for PRs)",
|
|
34578
|
+
replace: "Main branch (PRs usually go here)",
|
|
34579
|
+
note: "Gitee IKJNA1\uFF1B\u672C\u673A 2026-10-05 \u5BF9 workbuddy / CodeBuddy \u53CC\u7AEF\u70B9\u5B9E\u6D4B\u590D\u73B0"
|
|
34580
|
+
},
|
|
34581
|
+
{
|
|
34582
|
+
// Claude Code 内建常量(v2.1.295 的 `yl`):
|
|
34583
|
+
// `"You are Claude Code, Anthropic's official CLI for Claude."`
|
|
34584
|
+
//
|
|
34585
|
+
// ⚠️ **`find` 刻意不带尾句点**,一条同时覆盖两个常量(本机实测两者改写后都放行):
|
|
34586
|
+
// - `yl` = `You are Claude Code, Anthropic's official CLI for Claude.`
|
|
34587
|
+
// - `sf` = 同句 + `, running within the Claude Agent SDK.`
|
|
34588
|
+
// 第三个常量 `af`(`You are a Claude agent, built on Anthropic's Claude Agent SDK.`)
|
|
34589
|
+
// 实测**不被拦**,故刻意不登记(多一条就是替上游无谓改写用户提示词)。
|
|
34590
|
+
//
|
|
34591
|
+
// ## ⚠️⚠️ 本条的匹配语义**不是**「位置无关」,而是**行首锚定**(与 ZCode 那条相反)
|
|
34592
|
+
//
|
|
34593
|
+
// 2026-10-14 本机对两个端点的逐格实测(详见 `docs/agent-notes/providers-buddy.md`
|
|
34594
|
+
// 「Claude Code 身份句」一节):该指纹**只在文本绝对开头**被拦 ——
|
|
34595
|
+
// | 形态 | 结果 |
|
|
34596
|
+
// |---|---|
|
|
34597
|
+
// | 裸串 | ❌ 400/11128 |
|
|
34598
|
+
// | 前接空格 / 前换行 / 前接任意前言 | ✅ **200 放行** |
|
|
34599
|
+
// | 后接句点 / 破折号 / 中文句号 / 长正文 | ❌ 400/11128 |
|
|
34600
|
+
// 即**前导字符一个都不容忍、后缀完全自由**,与 ZCode 那条的「位置无关」不同。
|
|
34601
|
+
//
|
|
34602
|
+
// 这不影响改写本身(下面 `replaceAll` 照样生效),但**影响怎么为新指纹做探针**:
|
|
34603
|
+
// 只测「夹在句中」会得到「已放行」的**假阴性**(真因是锚点,不是这句不再触发)。
|
|
34604
|
+
// 故本条的实测凭据必须含**贪心探针**(覆盖行首与非行首两侧),见
|
|
34605
|
+
// `tests/e2e/buddy-fingerprint-roles.e2e.spec.ts` 的 Claude 段。
|
|
34606
|
+
//
|
|
34607
|
+
// ⚠️ **改成行首锚定的正则**(如 `^` 配 `m`)是**错**的:改写范围宁可略宽 ——
|
|
34608
|
+
// 漏改一处就换来整轮 400,多改一处只是语义等价的措辞变化(原文已不存在
|
|
34609
|
+
// 「位置无关」的相反证据)。故与上一条共用同一条实现路径。
|
|
34610
|
+
find: "You are Claude Code, Anthropic's official CLI for Claude",
|
|
34611
|
+
replace: "You are Claude Code, Anthropic's CLI for Claude",
|
|
34612
|
+
note: "Gitee IKLS2L\uFF1B\u672C\u673A 2026-10-14 \u5BF9 workbuddy / CodeBuddy \u53CC\u7AEF\u70B9\u5B9E\u6D4B\uFF1Asystem \u4E0E assistant \u6B63\u6587\u4F4D\u7F6E\u5747 400/11128\uFF0C\u6539\u5199\u540E\u4E24\u7AEF\u70B9\u5747 200\uFF08\u542B SDK \u53D8\u4F53\uFF09"
|
|
34613
|
+
},
|
|
34614
|
+
{
|
|
34615
|
+
// Claude Code system prompt 的「帮助 / 反馈」段默认句(Gitee issue IKLYCT):
|
|
34616
|
+
// `To give feedback, users should report the issue at
|
|
34617
|
+
// https://github.com/anthropics/claude-code/issues`
|
|
34618
|
+
//
|
|
34619
|
+
// ## 与上一条(身份句)不同:这一条**每轮必带**,不是概率性泄漏
|
|
34620
|
+
//
|
|
34621
|
+
// 身份句只有 cc-switch 的 `mrt()` 探测路径漏传 `skipSystemPromptPrefix` 时才注入
|
|
34622
|
+
// (实测约 34%);本句属于 Claude Code system prompt 的**固定段落**,
|
|
34623
|
+
// 只要客户端把默认 system 整份发过来就必然带上 ⇒ **漏登记 = 必然命中**。
|
|
34624
|
+
// 用户侧实测:单日 buddy/workbuddy 因它白撞 647 次。
|
|
34625
|
+
//
|
|
34626
|
+
// ## ⚠️ 匹配语义:**位置无关**(与身份句的「行首锚定」相反)
|
|
34627
|
+
//
|
|
34628
|
+
// 2026-10-18 本机对 `www.workbuddy.ai` + `copilot.tencent.com` 双端点逐格实测:
|
|
34629
|
+
// | 形态 | 结果 |
|
|
34630
|
+
// |---|---|
|
|
34631
|
+
// | 裸串 / 前接 `Note: ` / 前接行首 ` - ` | ❌ 400/11128 ⇒ 位置无关 |
|
|
34632
|
+
// | 后接换行 + 其他文本 | ❌ 400/11128 |
|
|
34633
|
+
// | 全大写 | ❌ 400/11128 ⇒ 与另两条同型(大小写不敏感) |
|
|
34634
|
+
// | 换 org/repo、换域名、改一个词、只留 URL | ✅ 200 ⇒ **逐字符** |
|
|
34635
|
+
// | **砍掉前半 / 砍掉后半** | ✅ 200 ⇒ **`find` 必须写整句** |
|
|
34636
|
+
//
|
|
34637
|
+
// ⚠️ 最后那一格是本条的**要害**:子串本身不触发,写短了等于空跑 ——
|
|
34638
|
+
// 而空跑的症状是「登记了却仍每轮 400」,极难归因。
|
|
34639
|
+
//
|
|
34640
|
+
// ⚠️ 本条的 `find`(整句 99 字符)已经**贴着**上游屏蔽名单的粒度,
|
|
34641
|
+
// 不要再按 ZCode 那条的思路去「缩短 find 覆盖更多变体」:实测换域名即放行。
|
|
34642
|
+
// ⚠️⚠️ **「缩短/删字」这类变异只有实发能验,单测锁不住**:
|
|
34643
|
+
// 单测能证明「砍掉半句时我们**不**改写」(那是真事实),但证明不了
|
|
34644
|
+
// 「砍掉半句后上游**仍会拦**」—— 那只有 e2e 能验(见上面那两格)。
|
|
34645
|
+
// ⇒ 改本行时**必须**跑一遍 `DSH_BUDDY_FINGERPRINT_E2E=1` 那节。
|
|
34646
|
+
//
|
|
34647
|
+
// ⚠️ 与身份句同理**不做行首锚定**:改写宁可略宽(漏改 = 整轮 400,
|
|
34648
|
+
// 多改 = 语义等价的措辞变化)。
|
|
34649
|
+
find: "To give feedback, users should report the issue at https://github.com/anthropics/claude-code/issues",
|
|
34650
|
+
// 实测两端点均 200(buddy / workbuddy,2026-10-18)。措辞与原文等义。
|
|
34651
|
+
replace: "To give feedback, users should report the issue at the project issue tracker",
|
|
34652
|
+
note: "Gitee IKLYCT\uFF1B\u672C\u673A 2026-10-18 \u5BF9 workbuddy / CodeBuddy \u53CC\u7AEF\u70B9\u5B9E\u6D4B\uFF1Asystem\uFF08\u542B\u975E\u9996\u4F4D\uFF09\u4E0E assistant \u6B63\u6587\u5747 400/11128\uFF0Cuser / reasoning_content / tool \u7ED3\u679C\u653E\u884C\uFF0C\u6539\u5199\u540E\u4E24\u7AEF\u70B9\u5747 200"
|
|
34653
|
+
}
|
|
34654
|
+
];
|
|
34655
|
+
function escapeRegExp(literal) {
|
|
34656
|
+
return literal.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
34657
|
+
}
|
|
34658
|
+
var COMPILED = CONTENT_FINGERPRINTS.map((rule) => ({
|
|
34659
|
+
replace: rule.replace,
|
|
34660
|
+
findLower: rule.find.toLowerCase(),
|
|
34661
|
+
// `g` = 全部出现都改写;`i` = 大小写不敏感(实测全小写 / 全大写同样被拦)。
|
|
34662
|
+
pattern: new RegExp(escapeRegExp(rule.find), "gi")
|
|
34663
|
+
}));
|
|
34664
|
+
function isTencentContentFingerprintProvider(provider) {
|
|
34665
|
+
return TENCENT_PROVIDERS.includes(provider);
|
|
34666
|
+
}
|
|
34667
|
+
function rewriteTencentContentFingerprints(text, provider) {
|
|
34668
|
+
if (!isTencentContentFingerprintProvider(provider)) return text;
|
|
34669
|
+
let out = text;
|
|
34670
|
+
for (const rule of COMPILED) {
|
|
34671
|
+
if (!out.toLowerCase().includes(rule.findLower)) continue;
|
|
34672
|
+
out = out.replace(rule.pattern, rule.replace);
|
|
34673
|
+
}
|
|
34674
|
+
return out;
|
|
34675
|
+
}
|
|
34676
|
+
|
|
34539
34677
|
// vendor/channel-pack/src/buddy-adapter.ts
|
|
34540
34678
|
function isDeepSeekModel(model) {
|
|
34541
34679
|
return /^deepseek/i.test(model.trim());
|
|
@@ -34621,7 +34759,7 @@ function contentToText2(content) {
|
|
|
34621
34759
|
return content.filter((block) => typeof block === "object" && block !== null && block.type === "text").map((block) => String(block.text)).join("");
|
|
34622
34760
|
}
|
|
34623
34761
|
var TOOL_RESULT_IMAGE_TEXT = "Attached image(s) from tool result:";
|
|
34624
|
-
function serializeMessages2(messages, imageUrls) {
|
|
34762
|
+
function serializeMessages2(messages, imageUrls, provider) {
|
|
34625
34763
|
const wire = [];
|
|
34626
34764
|
let pendingToolImages = [];
|
|
34627
34765
|
const flushToolImages = () => {
|
|
@@ -34647,7 +34785,7 @@ function serializeMessages2(messages, imageUrls) {
|
|
|
34647
34785
|
function: { name: String(block.name), arguments: normalizeToolArguments(String(block.arguments)) }
|
|
34648
34786
|
}));
|
|
34649
34787
|
const reasoning = content2.filter((block) => typeof block === "object" && block !== null && block.type === "reasoning").map((block) => String(block.text)).join("");
|
|
34650
|
-
const text2 = contentToText2(content2);
|
|
34788
|
+
const text2 = rewriteTencentContentFingerprints(contentToText2(content2), provider);
|
|
34651
34789
|
flushToolImages();
|
|
34652
34790
|
wire.push({
|
|
34653
34791
|
role: "assistant",
|
|
@@ -34660,7 +34798,7 @@ function serializeMessages2(messages, imageUrls) {
|
|
|
34660
34798
|
}
|
|
34661
34799
|
if (message2.role === "system") {
|
|
34662
34800
|
flushToolImages();
|
|
34663
|
-
wire.push({ role: "system", content: contentToText2(message2.content) });
|
|
34801
|
+
wire.push({ role: "system", content: rewriteTencentContentFingerprints(contentToText2(message2.content), provider) });
|
|
34664
34802
|
continue;
|
|
34665
34803
|
}
|
|
34666
34804
|
const content = Array.isArray(message2.content) ? message2.content : [];
|
|
@@ -34709,8 +34847,65 @@ function errorMessage2(error) {
|
|
|
34709
34847
|
return "unknown error";
|
|
34710
34848
|
}
|
|
34711
34849
|
}
|
|
34850
|
+
var ILLEGAL_CODE = /"code"\s*:\s*"?11128(?![\d.])/iu;
|
|
34851
|
+
var ILLEGAL_MSG = /"m(?:sg|essage)"\s*:\s*"[^"]{0,200}?request(?:[\s:_\-\p{Cf}]|\\[nrt])+illegal/iu;
|
|
34852
|
+
var CONTENT_BLOCKED_CODE = /"code"\s*:\s*"?11128(?![\d.])/iu;
|
|
34853
|
+
var CONTENT_BLOCKED_MSG = /"m(?:sg|essage)"\s*:\s*"[^"]{0,200}?illegal\s+api\s+invocation/iu;
|
|
34854
|
+
var CHANNEL_VERIFICATION_MSG_FIELD = /"m(?:sg|essage)"\s*:\s*"[^"]*conversation(?:[\s:_\-\p{Cf}]|\\[nrt])+id(?:[\s:_\-\p{Cf}]|\\[nrt])+missing/iu;
|
|
34855
|
+
var CHANNEL_VERIFICATION_BARE = /conversation(?:[\s:_\-\p{Cf}]|\\[nrt])+id(?:[\s:_\-\p{Cf}]|\\[nrt])+missing/iu;
|
|
34856
|
+
var CHANNEL_VERIFICATION_PHRASE = /"m(?:sg|essage)"\s*:\s*"[^"]*?(?:conversation(?:[\s:_\-\p{Cf}]|\\[nrt])+id(?:[\s:_\-\p{Cf}]|\\[nrt])+missing|request(?:[\s:_\-\p{Cf}]|\\[nrt])+illegal)/iu;
|
|
34857
|
+
function isChannelVerificationIllegalBody(body) {
|
|
34858
|
+
return ILLEGAL_CODE.test(body) && ILLEGAL_MSG.test(body);
|
|
34859
|
+
}
|
|
34860
|
+
function isChannelVerificationBody(body) {
|
|
34861
|
+
return ILLEGAL_CODE.test(body) && CHANNEL_VERIFICATION_PHRASE.test(body);
|
|
34862
|
+
}
|
|
34863
|
+
function isContentBlockedIllegalBody(body) {
|
|
34864
|
+
return CONTENT_BLOCKED_CODE.test(body) && CONTENT_BLOCKED_MSG.test(body);
|
|
34865
|
+
}
|
|
34866
|
+
function isChannelVerificationRejection(body, status) {
|
|
34867
|
+
if (body.length === 0) return false;
|
|
34868
|
+
if (CHANNEL_VERIFICATION_MSG_FIELD.test(body)) return true;
|
|
34869
|
+
if (isChannelVerificationIllegalBody(body)) return true;
|
|
34870
|
+
if (status !== void 0 && status !== 400 && status !== 403) return false;
|
|
34871
|
+
if (/"m(?:sg|essage)"\s*:/.test(body)) return false;
|
|
34872
|
+
if (/^\s*\{/.test(body) && /"code"\s*:/.test(body)) return false;
|
|
34873
|
+
return CHANNEL_VERIFICATION_BARE.test(body);
|
|
34874
|
+
}
|
|
34875
|
+
function redactUpstreamActionHints(text) {
|
|
34876
|
+
const REDACTED = "\uFF08\u5DF2\u62B9\u53BB\u4E0A\u6E38\u7684\u884C\u52A8\u6307\u5F15\uFF09";
|
|
34877
|
+
return text.replace(/请[^。;\n]{0,12}?(?:重新发送|重新傳送|重新传|重发)/g, REDACTED).replace(/\b(?:please\s+)?(?:re)?send\b[^.\n]{0,20}?(?:\bagain\b|from the official client)/gi, REDACTED);
|
|
34878
|
+
}
|
|
34879
|
+
function channelVerificationUpstreamId(body) {
|
|
34880
|
+
try {
|
|
34881
|
+
const data = JSON.parse(body);
|
|
34882
|
+
const inner = typeof data.error === "object" && data.error !== null ? data.error : void 0;
|
|
34883
|
+
const asText2 = (value) => typeof value === "string" || typeof value === "number" ? String(value) : void 0;
|
|
34884
|
+
const code = asText2(data.code) ?? asText2(inner?.code);
|
|
34885
|
+
const msg = asText2(data.msg) ?? asText2(data.message) ?? asText2(inner?.msg) ?? asText2(inner?.message);
|
|
34886
|
+
const requestId = asText2(data.requestId) ?? asText2(inner?.requestId);
|
|
34887
|
+
const parts = [
|
|
34888
|
+
code === void 0 ? void 0 : `code ${code}`,
|
|
34889
|
+
msg === void 0 ? void 0 : `msg ${msg}`,
|
|
34890
|
+
requestId === void 0 ? void 0 : `requestId ${requestId}`
|
|
34891
|
+
].filter((value) => value !== void 0);
|
|
34892
|
+
if (parts.length > 0) return redactUpstreamActionHints(parts.join(" / "));
|
|
34893
|
+
} catch {
|
|
34894
|
+
}
|
|
34895
|
+
return redactUpstreamActionHints(errorDetail2(body).slice(0, 200));
|
|
34896
|
+
}
|
|
34897
|
+
function channelVerificationError(productId, status, body, rotated) {
|
|
34898
|
+
const scope = rotated ? `\u5168\u90E8\u8D26\u53F7\u5747\u672A\u901A\u8FC7\u6E20\u9053\u6821\u9A8C\uFF08HTTP ${status}\uFF0C\u5DF2\u9010\u4E2A\u6362\u53F7\u91CD\u8BD5\uFF09` : `\u5F53\u524D\u8D26\u53F7\u672A\u901A\u8FC7\u6E20\u9053\u6821\u9A8C\uFF08HTTP ${status}\uFF0C\u6D41\u5185\u9519\u8BEF\u5E27\u4E0B\u53D1\uFF09`;
|
|
34899
|
+
return new LlmError3(
|
|
34900
|
+
`${productId}: ${scope}\u3002\u8BE5\u62D2\u7EDD\u6309\u8D26\u53F7\u751F\u6548\uFF08\u540C\u4E00\u8BF7\u6C42\u5728\u5176\u4ED6\u8D26\u53F7\u53EF\u6B63\u5E38\u8FD4\u56DE\uFF09\uFF0C\u4E14\u91CD\u53D1\u65E0\u6548 \u2014\u2014 \u8BF7\u5728 Channel Pack \u505C\u7528\u6216\u8C03\u6574\u8BE5\u8D26\u53F7\u7684\u987A\u5E8F\u540E\u91CD\u8BD5\uFF0C\u6216\u6539\u7528\u5176\u5B83 provider\u3002\u4E0A\u6E38\uFF1A${channelVerificationUpstreamId(body)}`,
|
|
34901
|
+
"PERMISSION_DENIED",
|
|
34902
|
+
{ status }
|
|
34903
|
+
);
|
|
34904
|
+
}
|
|
34712
34905
|
function isContentRejection(body) {
|
|
34713
34906
|
if (body.length === 0) return false;
|
|
34907
|
+
if (isChannelVerificationBody(body)) return false;
|
|
34908
|
+
if (isContentBlockedIllegalBody(body)) return false;
|
|
34714
34909
|
return /"code"\s*:\s*11140/.test(body) || /request illegal/i.test(body) || /安全审核|safety review/i.test(body);
|
|
34715
34910
|
}
|
|
34716
34911
|
var BUDDY_POLICY_BLOCK_COOLDOWN_MS = 30 * 6e4;
|
|
@@ -35248,9 +35443,12 @@ var BuddyAdapter = class _BuddyAdapter extends LlmAdapter2 {
|
|
|
35248
35443
|
imageUrls.set(id, `data:${image.mediaType};base64,${Buffer.from(image.data).toString("base64")}`);
|
|
35249
35444
|
}
|
|
35250
35445
|
}
|
|
35251
|
-
const messages = serializeMessages2(options.messages, imageUrls);
|
|
35446
|
+
const messages = serializeMessages2(options.messages, imageUrls, this.product.id);
|
|
35252
35447
|
if (options.system !== void 0 && options.system.length > 0) {
|
|
35253
|
-
messages.unshift({
|
|
35448
|
+
messages.unshift({
|
|
35449
|
+
role: "system",
|
|
35450
|
+
content: rewriteTencentContentFingerprints(options.system, this.product.id)
|
|
35451
|
+
});
|
|
35254
35452
|
}
|
|
35255
35453
|
const tools = options.tools?.map((tool) => ({
|
|
35256
35454
|
type: "function",
|
|
@@ -35294,6 +35492,7 @@ var BuddyAdapter = class _BuddyAdapter extends LlmAdapter2 {
|
|
|
35294
35492
|
if (!response.ok && (response.status === 401 || response.status === 403)) {
|
|
35295
35493
|
const rejectedBody = await response.clone().text().catch(() => "");
|
|
35296
35494
|
const contentRejected = isContentRejection(rejectedBody);
|
|
35495
|
+
const channelRejected = isChannelVerificationRejection(rejectedBody, response.status);
|
|
35297
35496
|
if (contentRejected) {
|
|
35298
35497
|
console.warn(
|
|
35299
35498
|
`[${this.product.id}] \u8D26\u53F7 ${currentAccountId || "(current)"} \u88AB\u5B89\u5168\u7B56\u7565\u62E6\u622A\uFF08HTTP ${response.status}\uFF0Ccode 11140\uFF09\uFF0C\u7EE7\u7EED\u6362\u53F7\uFF1A${errorDetail2(rejectedBody).slice(0, 200)}`
|
|
@@ -35327,6 +35526,9 @@ var BuddyAdapter = class _BuddyAdapter extends LlmAdapter2 {
|
|
|
35327
35526
|
let sawContentRejection = contentRejected;
|
|
35328
35527
|
let rejectionStatus = contentRejected ? authStatus : 0;
|
|
35329
35528
|
let rejectionBody = contentRejected ? rejectedBody : "";
|
|
35529
|
+
let sawChannelVerification = channelRejected;
|
|
35530
|
+
let channelVerificationStatus = channelRejected ? authStatus : 0;
|
|
35531
|
+
let channelVerificationBody = channelRejected ? rejectedBody : "";
|
|
35330
35532
|
if ((response.status === 401 || response.status === 403) && this.options.accountPool !== void 0) {
|
|
35331
35533
|
for (; ; ) {
|
|
35332
35534
|
const next = await this.options.accountPool.getAvailableAccount(
|
|
@@ -35356,6 +35558,11 @@ var BuddyAdapter = class _BuddyAdapter extends LlmAdapter2 {
|
|
|
35356
35558
|
options.model
|
|
35357
35559
|
);
|
|
35358
35560
|
}
|
|
35561
|
+
if (isChannelVerificationRejection(rotatedBody, response.status)) {
|
|
35562
|
+
sawChannelVerification = true;
|
|
35563
|
+
channelVerificationStatus = response.status;
|
|
35564
|
+
channelVerificationBody = rotatedBody;
|
|
35565
|
+
}
|
|
35359
35566
|
if (response.status !== 401 && response.status !== 403) break;
|
|
35360
35567
|
}
|
|
35361
35568
|
}
|
|
@@ -35368,6 +35575,14 @@ var BuddyAdapter = class _BuddyAdapter extends LlmAdapter2 {
|
|
|
35368
35575
|
true
|
|
35369
35576
|
);
|
|
35370
35577
|
}
|
|
35578
|
+
if (sawChannelVerification) {
|
|
35579
|
+
throw channelVerificationError(
|
|
35580
|
+
this.product.id,
|
|
35581
|
+
channelVerificationStatus === 0 ? authStatus : channelVerificationStatus,
|
|
35582
|
+
channelVerificationBody.length === 0 ? rejectedBody : channelVerificationBody,
|
|
35583
|
+
true
|
|
35584
|
+
);
|
|
35585
|
+
}
|
|
35371
35586
|
throw new LlmError3(`${this.product.id}: credential expired and refresh failed`, "AUTH", { status: authStatus });
|
|
35372
35587
|
}
|
|
35373
35588
|
if (response.status === 401 || response.status === 403) {
|
|
@@ -35380,6 +35595,14 @@ var BuddyAdapter = class _BuddyAdapter extends LlmAdapter2 {
|
|
|
35380
35595
|
true
|
|
35381
35596
|
);
|
|
35382
35597
|
}
|
|
35598
|
+
if (sawChannelVerification || isChannelVerificationRejection(detail, authStatus)) {
|
|
35599
|
+
throw channelVerificationError(
|
|
35600
|
+
this.product.id,
|
|
35601
|
+
channelVerificationStatus === 0 ? authStatus : channelVerificationStatus,
|
|
35602
|
+
channelVerificationBody.length === 0 ? detail : channelVerificationBody,
|
|
35603
|
+
true
|
|
35604
|
+
);
|
|
35605
|
+
}
|
|
35383
35606
|
throw new LlmError3(
|
|
35384
35607
|
`${this.product.id}: \u6240\u6709\u8D26\u53F7\u5747\u88AB\u62D2\u7EDD\uFF08HTTP ${authStatus}${authStatus === 401 ? "\uFF0C\u8BF7\u5728 Channel Pack \u91CD\u65B0\u767B\u5F55" : ""}\uFF09\uFF1A${errorDetail2(detail)}`,
|
|
35385
35608
|
httpErrorCode2(authStatus, detail),
|
|
@@ -35412,12 +35635,16 @@ var BuddyAdapter = class _BuddyAdapter extends LlmAdapter2 {
|
|
|
35412
35635
|
);
|
|
35413
35636
|
}
|
|
35414
35637
|
}
|
|
35415
|
-
|
|
35638
|
+
const channelRejected = isChannelVerificationRejection(errorText, response.status);
|
|
35639
|
+
if (this.options.accountPool && (isRateLimited(errorText, response.status) || channelRejected)) {
|
|
35416
35640
|
const tried = /* @__PURE__ */ new Set();
|
|
35417
35641
|
if (currentAccountId) tried.add(currentAccountId);
|
|
35418
35642
|
let sawContentRejection = false;
|
|
35419
35643
|
let contentRejectionStatus = 0;
|
|
35420
35644
|
let contentRejectionBody = "";
|
|
35645
|
+
let sawChannelVerification = channelRejected;
|
|
35646
|
+
let channelVerificationStatus = channelRejected ? response.status : 0;
|
|
35647
|
+
let channelVerificationBody = channelRejected ? errorText : "";
|
|
35421
35648
|
const rateLimitMarked = /* @__PURE__ */ new Set();
|
|
35422
35649
|
for (; ; ) {
|
|
35423
35650
|
if (currentAccountId !== "" && isRateLimited(errorText, response.status) && !rateLimitMarked.has(currentAccountId)) {
|
|
@@ -35459,6 +35686,15 @@ var BuddyAdapter = class _BuddyAdapter extends LlmAdapter2 {
|
|
|
35459
35686
|
);
|
|
35460
35687
|
continue;
|
|
35461
35688
|
}
|
|
35689
|
+
if (isChannelVerificationRejection(errorText, response.status)) {
|
|
35690
|
+
sawChannelVerification = true;
|
|
35691
|
+
channelVerificationStatus = response.status;
|
|
35692
|
+
channelVerificationBody = errorText;
|
|
35693
|
+
console.warn(
|
|
35694
|
+
`[${this.product.id}] \u8D26\u53F7 ${currentAccountId || "(current)"} \u672A\u901A\u8FC7\u6E20\u9053\u6821\u9A8C\uFF08HTTP ${response.status}\uFF0Ccode 11128\uFF09\uFF0C\u7EE7\u7EED\u6362\u53F7\uFF08\u4E0D\u5199\u51B7\u5374\uFF09\uFF1A${errorDetail2(errorText).slice(0, 200)}`
|
|
35695
|
+
);
|
|
35696
|
+
continue;
|
|
35697
|
+
}
|
|
35462
35698
|
if (response.status === 401 || response.status === 403) continue;
|
|
35463
35699
|
if (!isRateLimited(errorText, response.status)) {
|
|
35464
35700
|
throw new LlmError3(`${this.product.id}: ${errorDetail2(errorText)}`, httpErrorCode2(response.status, errorText), { status: response.status });
|
|
@@ -35472,6 +35708,14 @@ var BuddyAdapter = class _BuddyAdapter extends LlmAdapter2 {
|
|
|
35472
35708
|
true
|
|
35473
35709
|
);
|
|
35474
35710
|
}
|
|
35711
|
+
if (sawChannelVerification) {
|
|
35712
|
+
throw channelVerificationError(
|
|
35713
|
+
this.product.id,
|
|
35714
|
+
channelVerificationStatus || 400,
|
|
35715
|
+
channelVerificationBody,
|
|
35716
|
+
true
|
|
35717
|
+
);
|
|
35718
|
+
}
|
|
35475
35719
|
throw new LlmError3(`${this.product.id}: \u6A21\u578B ${options.model} \u6240\u6709\u8D26\u53F7\u5747\u53D7\u9650\uFF0C\u8BF7\u7A0D\u540E\u518D\u8BD5`, "QUOTA_EXCEEDED");
|
|
35476
35720
|
}
|
|
35477
35721
|
throw new LlmError3(`${this.product.id}: ${errorDetail2(errorText)}`, httpErrorCode2(response.status, errorText), { status: response.status });
|
|
@@ -35487,6 +35731,10 @@ var BuddyAdapter = class _BuddyAdapter extends LlmAdapter2 {
|
|
|
35487
35731
|
headers.set(HTTP_HEADER_DOMAIN, this.product.apiDomain || credential.domain || "");
|
|
35488
35732
|
headers.set(HTTP_HEADER_PRODUCT_CODE, this.product.productCode);
|
|
35489
35733
|
headers.set("X-Agent-Purpose", "conversation");
|
|
35734
|
+
const conversationId = crypto.randomUUID().replace(/-/g, "");
|
|
35735
|
+
headers.set("X-Conversation-ID", conversationId);
|
|
35736
|
+
headers.set("X-Conversation-Request-ID", conversationId);
|
|
35737
|
+
headers.set("X-Conversation-Message-ID", conversationId);
|
|
35490
35738
|
headers.set("X-IDE-Name", this.product.attributionName);
|
|
35491
35739
|
headers.set("X-IDE-Type", this.product.attributionName);
|
|
35492
35740
|
headers.set("X-IDE-Version", this.product.clientVersion);
|
|
@@ -35568,6 +35816,9 @@ var BuddyAdapter = class _BuddyAdapter extends LlmAdapter2 {
|
|
|
35568
35816
|
} catch {
|
|
35569
35817
|
continue;
|
|
35570
35818
|
}
|
|
35819
|
+
if (data.choices === void 0 && isChannelVerificationRejection(payload, response.status)) {
|
|
35820
|
+
throw channelVerificationError(this.product.id, 200, payload, false);
|
|
35821
|
+
}
|
|
35571
35822
|
if (data.choices === void 0 && isContentRejection(payload)) {
|
|
35572
35823
|
await markPolicyBlockedAccount(
|
|
35573
35824
|
this.options.accountPool,
|
|
@@ -56300,12 +56551,12 @@ var OFFICEACE = {
|
|
|
56300
56551
|
chunkTimeoutMs: 3e5
|
|
56301
56552
|
};
|
|
56302
56553
|
var OFFICEACE_MODELS = [
|
|
56303
|
-
{ id: "glm-5.3", name: "GLM-5.3", contextWindow:
|
|
56304
|
-
{ id: "glm-5.2", name: "GLM-5.2", contextWindow:
|
|
56305
|
-
{ id: "glm-5.1", name: "GLM-5.1", contextWindow:
|
|
56306
|
-
{ id: "deepseek-v4.1-flash", name: "DeepSeek-V4.1-Flash", contextWindow:
|
|
56307
|
-
{ id: "deepseek-v4-flash", name: "DeepSeek-V4-Flash", contextWindow:
|
|
56308
|
-
{ id: "kimi-k2.6", name: "Kimi-K2.6", contextWindow:
|
|
56554
|
+
{ id: "glm-5.3", name: "GLM-5.3", contextWindow: 1048576, maxTokens: 131072 },
|
|
56555
|
+
{ id: "glm-5.2", name: "GLM-5.2", contextWindow: 1044480, maxTokens: 131072 },
|
|
56556
|
+
{ id: "glm-5.1", name: "GLM-5.1", contextWindow: 196608, maxTokens: 131072 },
|
|
56557
|
+
{ id: "deepseek-v4.1-flash", name: "DeepSeek-V4.1-Flash", contextWindow: 1048576, maxTokens: 393216, multimodal: true },
|
|
56558
|
+
{ id: "deepseek-v4-flash", name: "DeepSeek-V4-Flash", contextWindow: 1044480, maxTokens: 393216 },
|
|
56559
|
+
{ id: "kimi-k2.6", name: "Kimi-K2.6", contextWindow: 262144, maxTokens: 131072, multimodal: true },
|
|
56309
56560
|
{ id: "qwen3-32b", name: "Qwen3-32B", contextWindow: 131072, maxTokens: 65536 },
|
|
56310
56561
|
{ id: "qwen3-30b-a3b", name: "Qwen3-30B-A3B", contextWindow: 131072, maxTokens: 65536 }
|
|
56311
56562
|
];
|
|
@@ -63340,39 +63591,6 @@ async function toImageBlock2(url, bridge, limits, already) {
|
|
|
63340
63591
|
return { type: "image", attachment: ref };
|
|
63341
63592
|
}
|
|
63342
63593
|
|
|
63343
|
-
// vendor/channel-pack/src/openai-gateway/tencent-fingerprint.ts
|
|
63344
|
-
var TENCENT_PROVIDERS = ["buddy", "workbuddy"];
|
|
63345
|
-
var CONTENT_FINGERPRINTS = [
|
|
63346
|
-
{
|
|
63347
|
-
// ZCode 内建常量:`$Js="Main branch (you will usually use this for PRs)"`。
|
|
63348
|
-
// 每个 git 仓库里的会话都会被注入(拼在 `Main branch … : <分支名>` 这一行)。
|
|
63349
|
-
find: "Main branch (you will usually use this for PRs)",
|
|
63350
|
-
replace: "Main branch (PRs usually go here)",
|
|
63351
|
-
note: "Gitee IKJNA1\uFF1B\u672C\u673A 2026-10-05 \u5BF9 workbuddy / CodeBuddy \u53CC\u7AEF\u70B9\u5B9E\u6D4B\u590D\u73B0"
|
|
63352
|
-
}
|
|
63353
|
-
];
|
|
63354
|
-
function escapeRegExp(literal) {
|
|
63355
|
-
return literal.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
63356
|
-
}
|
|
63357
|
-
var COMPILED = CONTENT_FINGERPRINTS.map((rule) => ({
|
|
63358
|
-
replace: rule.replace,
|
|
63359
|
-
findLower: rule.find.toLowerCase(),
|
|
63360
|
-
// `g` = 全部出现都改写;`i` = 大小写不敏感(实测全小写 / 全大写同样被拦)。
|
|
63361
|
-
pattern: new RegExp(escapeRegExp(rule.find), "gi")
|
|
63362
|
-
}));
|
|
63363
|
-
function isTencentContentFingerprintProvider(provider) {
|
|
63364
|
-
return TENCENT_PROVIDERS.includes(provider);
|
|
63365
|
-
}
|
|
63366
|
-
function rewriteTencentContentFingerprints(text, provider) {
|
|
63367
|
-
if (!isTencentContentFingerprintProvider(provider)) return text;
|
|
63368
|
-
let out = text;
|
|
63369
|
-
for (const rule of COMPILED) {
|
|
63370
|
-
if (!out.toLowerCase().includes(rule.findLower)) continue;
|
|
63371
|
-
out = out.replace(rule.pattern, rule.replace);
|
|
63372
|
-
}
|
|
63373
|
-
return out;
|
|
63374
|
-
}
|
|
63375
|
-
|
|
63376
63594
|
// vendor/channel-pack/src/openai-gateway/messages.ts
|
|
63377
63595
|
var OpenAiGatewayError = class extends Error {
|
|
63378
63596
|
constructor(message2, status = 400, type = "invalid_request_error", code = "invalid_request") {
|
|
@@ -63514,7 +63732,7 @@ async function convertMessage(raw, provider, model, bridge, limits) {
|
|
|
63514
63732
|
return createGatewayMessage("user", await partsFromContent(value.content, bridge, limits), { kind: "user" });
|
|
63515
63733
|
}
|
|
63516
63734
|
if (role === "assistant") {
|
|
63517
|
-
const text = textFromContent(value.content);
|
|
63735
|
+
const text = rewriteTencentContentFingerprints(textFromContent(value.content), provider);
|
|
63518
63736
|
const content = text.length > 0 ? [{ type: "text", text }] : [];
|
|
63519
63737
|
if (value.tool_calls !== void 0) content.push(...convertToolCalls(value.tool_calls));
|
|
63520
63738
|
return createGatewayMessage("assistant", content, { kind: "model", provider, model });
|
|
@@ -64064,7 +64282,7 @@ async function toMessages(input, provider, model, bridge, limits) {
|
|
|
64064
64282
|
continue;
|
|
64065
64283
|
}
|
|
64066
64284
|
if (raw.role === "assistant") {
|
|
64067
|
-
const text = textFromContent(content);
|
|
64285
|
+
const text = rewriteTencentContentFingerprints(textFromContent(content), provider);
|
|
64068
64286
|
pushAssistant(text.length > 0 ? [{ type: "text", text }] : []);
|
|
64069
64287
|
continue;
|
|
64070
64288
|
}
|