前言¶
在 DeepSeek Harness(DSH)里走 buddy、workbuddy 这类腾讯系渠道时,常见现象是:新会话第一条消息就失败,返回 400,错误码 11128,文案类似「Illegal API invocation from an unapproved channel」或「请求被拦截,请重新发送」。报错往往不指明具体是哪段请求头或哪句系统提示触发了拦截,排查成本高。
dsh-our-free-model 升级会整包覆盖相关文件;若只靠手工改本地 node_modules,修复会在下一次插件更新后丢失。下面介绍社区插件 dsh-tencent-channel-fix(维护者 basaltfold,分类:工作流),如何在每次 DSH 启动时自动修补两处已知问题,并在上游锚点漂移时给出可观测状态。
这是什么¶
dsh-tencent-channel-fix 是 DSH 插件,针对 dsh-our-free-model 内与腾讯渠道网关相关的两处缺陷做幂等修补,并在 dsh-our-free-model 每次升级后重新应用,避免回归。
- 目录页:https://www.skillhub.cn/plugins/basaltfold/dsh-tencent-channel-fix
- 源码:https://github.com/basaltfold/dsh-tencent-channel-fix
- 许可证:MIT(见仓库)
- 兼容:DSH
>= 0.2.0-rc.1;README 记载已在0.2.0-rc.2、0.2.1-rc.2与dsh-our-free-model2.5.6/2.5.7上验证
插件只改动 dsh-our-free-model 下的两个文件:adapter/kernel.js 与 vendor/channel-pack/pack.js,不修改 provider、模型行、路由、凭证或其他 DSH 配置。
网关实际拒绝的两件事¶
腾讯渠道网关会独立检查请求中的两类内容;只修其一仍会 400。
1. 归因 User-Agent¶
dsh-our-free-model/adapter/kernel.js 会把 Harness 身份写进请求的 User-Agent,例如:
deepseek-harness/0.2.1-rc.2 (+https://github.com/deepseek-ai/deepseek-harness)
其中 deepseek-harness 在网关黑名单内,且大小写不敏感(DeepSeek-Harness/0.2.1 同样会被拒)。README 记载,测试中 curl、node、axios 等 UA 均可通过。
2. 系统提示中的 Harness 身份句¶
DSH 基础系统提示开头包含:
You are an AI agent powered by DeepSeek Harness.
网关将 powered by DeepSeek Harness 视为内容指纹,出现在 system 消息中即整包拒绝。
dsh-our-free-model 已有 rewriteTencentContentFingerprints,但仅在 gateway 路径(convertMessage / toMessages)执行;buddy 实际使用的 direct adapter 路径用 messages.unshift(...) 组装 system 消息且未走 rewriter,因此该句会原样发出。
README 在真实端点上的对照结果:
| 请求组合 | 结果 |
|---|---|
| 原始 system + 原始 UA | 400 code 11128 |
| 原始 system + 修复 UA | 400 code 11128 |
| 改写 system + 修复 UA | 200 OK |
为什么用插件而不是手改文件¶
两处问题都是 dsh-our-free-model 包内文本;其更新器会整文件重写,手工修改会在下次更新后消失——这也是同类问题反复出现的直接原因。
该插件在每次启动的 apply() 中(早于首次模型请求、相关模块懒加载之前)修补上述文件,并具备:
- 幂等:已修补文件带标记则不再改写;
- 漂移感知:上游移动锚点时跳过对应 patch 并报告,不强行半写;
- 可回滚:写入前备份,写入后用
node --check校验,失败则恢复原件。
因此 dsh-our-free-model 升级后,修补可在下次启动自动重做,而不是静默回归。
核心功能¶
- 启动时自动应用三组修补(归因 UA、内容指纹、direct 路径 system 改写)。
- 斜杠命令
/tencent-fix:status(默认)、apply、restore、why。 - 本机 loopback:
GET /dsh-tencent-channel-fix返回与status相同的 JSON(非 GET 返回405)。 - 可选配置:
autoApply、target、verbose(见下文)。 pack.js内改写范围限定为TENCENT_PROVIDERS = ["buddy", "workbuddy"],其他渠道不受影响;UA 仍保留版本等信息,仅去掉被拦的 token 与 URL。
安装与启用¶
官方安装命令(来自 README):
dsh plugin add dsh-tencent-channel-fix
或从 GitHub 仓库安装:
dsh plugin add github:basaltfold/dsh-tencent-channel-fix
安装后重启 DSH 一次。启动日志可能出现:
[dsh-tencent-channel-fix] repair applied — applied attribution-user-agent, content-fingerprints, direct-system-rewrite. Active from the next model request.
或在上游变更导致锚点不匹配时:
[dsh-tencent-channel-fix] repair incomplete (upstream dsh-our-free-model changed) — drifted ...
插件以当前 DSH 进程权限运行,会在 profile 下的 dsh-our-free-model 目录写文件;安装前请阅读仓库源码与 MIT 许可证,确认符合你的安全与合规要求。
典型用法¶
查看修补状态¶
在 DSH 对话或命令入口执行:
/tencent-fix
或显式:
/tencent-fix status
示例输出(来自 README):
dsh-tencent-channel-fix · patch revision 1
target: C:\Users\you\.dsh\profiles\desktop\node_modules\dsh-our-free-model
dsh-our-free-model: 2.5.7
OK attribution-user-agent — Attribution User-Agent (400 / code 11128)
OK content-fingerprints — Rejected system-prompt fingerprints (400 / code 11128)
OK direct-system-rewrite — Direct adapter path system rewrite (400 / code 11128)
3/3 patches in place.
立即重打与恢复¶
/tencent-fix apply:强制立即修补,并打印成功项与 drift 项。/tencent-fix restore:用最新备份还原,撤销修补。/tencent-fix why:在会话内输出根因说明。
可选配置¶
在 bundle 中可插入(字段名以 README 为准):
- insert:
- id: tencent-channel-fix
name: 'dsh-tencent-channel-fix'
config:
autoApply: true # false = 仅报告 drift,不写文件
target: '' # 显式指定 dsh-our-free-model 目录
verbose: false # 记录每一步,含无操作的启动
target 为空时,会按当前 profile 解析 ${profile}/node_modules/dsh-our-free-model,再尝试 Node 解析路径与 ~/.dsh/profiles/*/node_modules/。
本地只读检查(不写安装目录)¶
node -e "import('dsh-tencent-channel-fix/patcher').then(m => console.log(m.formatStatus(m.resolveTarget({}))))"
适用场景与注意¶
适合谁:在 DSH 中配置并使用 buddy、workbuddy 渠道,且遇到首条消息即 400 / code 11128 的开发者;需要在 dsh-our-free-model 频繁升级后仍保持可用的工作流场景。
注意:
- 修补针对 DSH 自身发出的 UA 与 system 指纹;同类错误也可能来自其他 CLI 代理项目的提示词或头字段(README 提及与 buddy-proxy、magpie 等 issue 同源网关行为),本插件范围仅限上述两个文件内的 DSH 相关项。
- 若未来
dsh-our-free-model改动导致锚点漂移,/tencent-fix status会标为drifted并跳过该 patch;需根据新文件重新推导锚点并更新插件内PATCHES(维护者侧工作)。 - 社区插件目录(如 SkillHub)与 DeepSeek / 幻方无官方从属关系;安装与写盘行为由你本机 DSH 进程承担,请自行审计源码。
仓库提供 npm test(README:29 个测试,无网络、不触碰真实安装)用于维护者验证;普通用户以安装后 status 与渠道请求是否 200 为准即可。
结尾¶
dsh-tencent-channel-fix 把「腾讯渠道 11128」从反复手改 node_modules 变成可观测、可回滚、升级后可自愈的启动修补,专注 buddy / workbuddy 两条路径上的 UA 与 system 指纹问题。