@huai_xin/dsh-workbuddy 0.1.12 → 0.1.14
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 +0 -10
- package/docs/workbuddy-protocol.md +36 -2
- package/package.json +1 -1
- package/src/adapter.js +23 -12
- package/src/catalog.js +1 -1
package/README.md
CHANGED
|
@@ -306,15 +306,6 @@ node test/live/policy-probe.mjs # 两版白名单与准入结果对照
|
|
|
306
306
|
- **思考档位只认服务端声明的 `reasoning.supportedEfforts`**(两个源合并后国内 15/34、国际 21/28);只声明了默认档的模型不给档位列表 —— 与网页端行为一致。合并后仍无档位的,请求里不带 `reasoning_effort`,由服务端取默认。
|
|
307
307
|
- 实时**繁忙程度**只有大陆版有(`POST /v2/chat/busy`,海外版 404,`regions.js` 的 `hasBusy` 决定那一列是否显示)。它**不是可用性信号**:只对白名单内的活跃模型返回 `idle/normal/busy/congested`,其余一律 `unknown`(面板显示「未知」,不当成故障)。插件侧 50 秒缓存,与官方前端一致。
|
|
308
308
|
- 两版**条目数会变**:2026-10-22 实测大陆版 30 个(`ok` 22 / `dead` 8)、海外版 25 个(`ok` 13 / `denied` 12)。`gpt-5.3-codex` 只在账号名单里,两个 `/v3/config` 都没有它,倍率因此是「未知」。
|
|
309
|
-
- **长上下文下模型会"说话说一半就收尾"(上游行为,非插件问题)**:海外版 `deepseek-v4.1-flash` 在上下文很长时会不调用工具、只用一句话叙述下一步然后 `finish_reason: "stop"`(例如「我需要先读取该文件,才能准确修改。」)。实测(2026-10-22,`node test/live/long-context-probe.mjs`):
|
|
310
|
-
|
|
311
|
-
| 输入规模 | 正确调用工具 | 提前 `stop` |
|
|
312
|
-
| --- | --- | --- |
|
|
313
|
-
| 0k(1 条消息) | 2/2 | 0/2 |
|
|
314
|
-
| 30k 字符(613 条) | 2/2 | 0/2 |
|
|
315
|
-
| 89k 字符(1825 条) | 1/2 | **1/2** |
|
|
316
|
-
|
|
317
|
-
用户侧复现阈值约 **120k 上下文**起明显(其它模型未测)。判据是**换了上下文长度、其它一切不变**即可复现/消失,且流里**一个 tool-call 分片都没有**、`finish_reason` 就是 `stop` —— 所以既不是适配器丢帧(丢帧会看到 `finish_reason: "tool_calls"`),也不是采样(四档温度 16/16 正常)、不是工具 schema(70 个工具 / 单个 / 简化 schema 9/9 正常)。`stop` 是模型自己采到 EOS,属于上游质量问题;缓解手段只有换模型、把会话压短(harness 的压缩),或回一句"继续"。
|
|
318
309
|
|
|
319
310
|
## 上游行为与错误映射
|
|
320
311
|
|
|
@@ -359,7 +350,6 @@ node test/live/stream-cut-probe.mjs cn --selftest # 离线验证"断流"分
|
|
|
359
350
|
node test/live/stream-cut-probe.mjs intl 10 --long # 真实压测断流率(免费模型零消耗)
|
|
360
351
|
node test/live/find-message.mjs "关键词" <会话前缀> # 按文本定位某一步,并打出前后事件
|
|
361
352
|
node test/live/dump-stream.mjs <会话前缀> <seq,…> # 打印那一步存下来的原始流帧
|
|
362
|
-
node test/live/sampling-probe.mjs intl 4 # 同一提示在各 temperature 下的"提前 stop"率
|
|
363
353
|
```
|
|
364
354
|
|
|
365
355
|
## 许可
|
|
@@ -394,7 +394,7 @@ data: [DONE]
|
|
|
394
394
|
| INTL scoped → `500`(openresty/APISIX,HTML 错误页) | 2026-10-21 起持续;`/v3/config` 正常 ✅ |
|
|
395
395
|
| `glm-5.1` 图片能力两个端点矛盾 | scoped 报 `false`、`/v3/config` 报 `true`,实测能看图(📖 参考实现据此写了覆盖白名单) |
|
|
396
396
|
| 目录包含渠道不服务的模型 | 见 `11102`(§6)✅ |
|
|
397
|
-
| 长上下文下"说话说一半就收尾"(`finish_reason: stop`,无工具调用) |
|
|
397
|
+
| 长上下文下"说话说一半就收尾"(`finish_reason: stop`,无工具调用) | 上游/模型行为,**不是插件问题**。对外跟踪入口:[issue #1](https://github.com/2424830124/dsh-workbuddy/issues/1)(含两次真实截断的 `responseId`/`outputTokens` 与已排除项)。实测:同一提示、同一套工具、只改前面的对话长度 —— 0k 2/2 正常、30k 1/2(一次 181 字后 `stop`)、89k 1/2;每次 finish 诊断块都标 `workbuddy-intl/deepseek-v4.1-flash`。判据:流里**没有任何 tool-call 分片**、`finish_reason` 就是 `stop`(若丢帧会是 `tool_calls` 且能看到分片)。已排除:采样(五档 16/16 与 2–3/8 两个实验都无差别)、工具 schema/数量(70 个 / 单个 / 简化 schema 9/9 正常)、`prompt_cache_key` 与 `stream_options`(去掉后 1/8 vs 2/8)、提示词校验(海外版无 11128 之外的拦截,请求体按原样转发)。复现:`node test/live/long-context-probe.mjs 2`、`node test/live/repro-probe.mjs 3 deepseek-v4.1-flash 280000`;取证:`node test/live/session-tail-live.mjs <会话前缀> 8 dsh-model-picker`(读 `response.stopReason` 原话)。缓解只有换模型/压缩上下文/回一句"继续" —— 合法的 `stop` 不能当错误重试。 |
|
|
398
398
|
|
|
399
399
|
### 4.7 模型选择器里每一项元数据的来源
|
|
400
400
|
|
|
@@ -694,6 +694,22 @@ POST /v2/chat/completions {"model":"glm-4.6", …}
|
|
|
694
694
|
|
|
695
695
|
结论:这是**行首锚定的品牌指纹**(「某 AI agent powered by <品牌> Harness」),不是内容审查。规避方式:把这一句改写成中性表述(本插件统一改写为 `You are an AI agent.`,两个部署都改)✅。
|
|
696
696
|
|
|
697
|
+
#### 7.1.1 规则扩大:整段 DSH 提示词被拦(2026-10-23)
|
|
698
|
+
|
|
699
|
+
同一天再次实测:**完整的 DSH 系统提示词(5.7k 字符)整段被拦**,而短提示词通过。二分结果:
|
|
700
|
+
|
|
701
|
+
| 送什么 | 结果 |
|
|
702
|
+
| --- | --- |
|
|
703
|
+
| 完整 DSH 提示词(只做 7.1 的开头改写) | **拦(11128)** |
|
|
704
|
+
| 同一份,只去掉最后那段 Web GUI 开发指引 | 过 ✅ |
|
|
705
|
+
| 只送那一段(1002 字符) | 过 ✅ |
|
|
706
|
+
| 那一段的每一句单独送 | 全都过 ✅ |
|
|
707
|
+
| 中性提示词填充到 5.7k / 10k 字符 | 过 ✅(不是长度) |
|
|
708
|
+
|
|
709
|
+
所以**不是一个词、也不是长度**,而是「提示词整体 + 那段开发指引」的组合命中。那段内容是 `pnpm run dev:web` / `apps/web` / HMR / "do not start a replacement server" —— **给改 harness 自身的人看的**,对一次聊天补全毫无用处,所以插件直接**整行删掉**,并把 `DeepSeek Harness` 统一改写成 `this harness`(顺序很重要:先删行再改名,否则模式匹配不到原文)。
|
|
710
|
+
|
|
711
|
+
> 注意:这条规则**会继续扩大**。再遇到 11128 时,用 `node test/live/cn-prompt-fingerprint.mjs` 二分定位新命中的段落,再决定删还是改,别猜。
|
|
712
|
+
|
|
697
713
|
### 7.2 其它渠道相关事实
|
|
698
714
|
|
|
699
715
|
- `X-Conversation-ID` 可复用;一旦被判定为异常渠道,**换新会话标识无效**(实测:换标识 + 切备用主机仍被拒),但换一个**合法 system 提示词**立刻恢复 ✅。
|
|
@@ -876,7 +892,7 @@ provider 与全部 HTTP 路由都没注册,设置面板只剩一个 `HTTP 404`
|
|
|
876
892
|
| `prompt_cache_key` | 发(会话级) | **不发** | 反向差异;实测对本问题无影响(去掉后 1/8 vs 2/8),保留以提高前缀缓存命中 ✓ |
|
|
877
893
|
| `stop` | 仅调用方给 | 不发 | 等价 ✓ |
|
|
878
894
|
| `store` / `prompt_cache_retention` | 不发 | 发(配置值,通常未设置) | 等价 ✓ |
|
|
879
|
-
| 请求头 | `Authorization` / `Accept` / `X-Domain` / `X-Product` / `X-Product-Code` / `User-Agent` | 同类内部头(`X-User-Id`/`X-Enterprise-Id`/`X-Tenant-Id`/`X-Department-Info`/`X-Domain`/`User-Agent
|
|
895
|
+
| 请求头 | `Authorization` / `Accept` / `X-Domain` / `X-Product` / `X-Product-Code` / `X-Agent-Purpose` / **`X-Agent-Intent: craft`** / `X-Agent-Runtime` / `X-IDE-Name` / `X-IDE-Type` / `X-IDE-Version` / `X-Session-ID` / `X-Model-ID` / `X-Conversation-ID` / **`X-Conversation-Message-ID`** / `X-Conversation-Request-ID` / **`X-Request-ID`** / `User-Agent` | 同类内部头(`X-User-Id`/`X-Enterprise-Id`/`X-Tenant-Id`/`X-Department-Info`/`X-Domain`/`User-Agent`),转发前还会**剔除**内部头 | **网关会校验**:2026-10-23 实测,裸请求缺 `X-Agent-Purpose`/`X-Conversation-*`/`X-IDE-*` → `400 code 11128 request illegal`。已按官方常量对齐(`X-Agent-Intent` 默认 `craft`;`X-Conversation-Message-ID`/`X-Request-ID` 标识"被回答的那条消息",用最后一条 user 消息的哈希,重试时保持不变) |
|
|
880
896
|
|
|
881
897
|
**结论:结构上不是"完全一样",但没有一处会造成"提前收尾"** —— 唯一的实质差异是官方总带采样参数,
|
|
882
898
|
而实测它对这个问题无效。`refusal` 的含义见 §12.2。
|
|
@@ -916,6 +932,24 @@ provider 与全部 HTTP 路由都没注册,设置面板只剩一个 `HTTP 404`
|
|
|
916
932
|
| `test/live/picker-contract-check.mjs` | 适配器实际给模型选择器什么(`providerInfo` / `listModels` / `resolveModel`) |
|
|
917
933
|
| `test/live/harness-contract-replay.mjs` | 复刻 harness 校验规则,定位「选择器整组消失」 |
|
|
918
934
|
| `test/live/dead-code-report.mjs` | 死代码审计:未使用的 CSS 类、词典键、导出 |
|
|
935
|
+
| `test/live/installed-package-check.mjs [dir]` | 检查**已安装副本**(真目录、依赖为空、provider 注册、选择器可选项、资源齐全) |
|
|
936
|
+
| `test/live/leak-scan.mjs [ref]` | 发布前必跑:工作区 + git 历史的账户信息/凭据泄露扫描 |
|
|
937
|
+
| **会话取证("回答为什么中断")** | |
|
|
938
|
+
| `test/live/session-tail-live.mjs [前缀] [步数] [项目过滤]` | 读最新会话的末尾几步;容残帧(`ZSTD_e_flush`),带 `stopReason`/`outputTokens`/正文 |
|
|
939
|
+
| `test/live/last-finishes.mjs [前缀] [步数] [项目过滤]` | 只看每步的 `upstream.stopReason` 与"stop 且无工具调用"的步,附分布统计 |
|
|
940
|
+
| `test/live/find-message.mjs "关键词" [会话前缀]` | 按正文定位某一步,并打出前后事件 |
|
|
941
|
+
| `test/live/dump-stream.mjs [会话前缀] <seq,…>` | 打印某一步存下来的原始流帧(含 finish 的 `response` 诊断块) |
|
|
942
|
+
| `test/live/toolcall-audit.mjs [会话前缀] [步数]` | 上游宣告了工具调用、但一个分片都没交付的"丢失指纹" |
|
|
943
|
+
| **流与请求结构实验(改协议相关代码前跑)** | |
|
|
944
|
+
| `test/live/stream-cut-probe.mjs [cn\|intl] [次数] [模型] [--selftest]` | 断流分类:`--selftest` 离线自检,长回答模式可压测断流率 |
|
|
945
|
+
| `test/live/repro-probe.mjs [次数] [模型] [填充字符]` | 长上下文 + 真实 70 工具集下"是否调用工具",每行打印原始 `finish_reason` |
|
|
946
|
+
| `test/live/long-context-probe.mjs [次数] [模型]` | 只改上下文长度,看提前收尾率(可复现的对照实验) |
|
|
947
|
+
| `test/live/context-size-probe.mjs [字符数…]` | 填充上下文实际值多少 token(网关 `inputTokens` 为准) |
|
|
948
|
+
| `test/live/thinking-field-probe.mjs [次数] [模型] [部署]` | 带/不带 `thinking` 字段时思考量对比(档位才是开关) |
|
|
949
|
+
| `test/live/dsh-prompt-probe.mjs [次数] [字符数…]` | **用会话里存的 DSH 原版系统提示词** + 真实 70 工具集跑长上下文,看会不会调用工具(2026-10-23:0k/90k/280k 各 3 次,9/9 都调用 `read`) |
|
|
950
|
+
| `test/live/system-prompt-probe.mjs [次数]` | 判定上游是否注入/覆盖 system:两个代号实验 + 不给 system 时它自认是谁(答「DeepSeek」= 无厂商注入)+ 语言服从性 |
|
|
951
|
+
| `test/live/request-structure.mjs` / `test/live/free-models.mjs` | 各厂商请求结构、免费档清单的逐字段试探 |
|
|
952
|
+
| `test/live/verify-policy.mjs` | 实时目录扣掉台账里 `dead` 的判定后,两版的条目数对照 |
|
|
919
953
|
| **契约与 UI 参考(写 UI 插件用)** | |
|
|
920
954
|
| `test/live/slot-inventory.mjs [outFile]` | 列出客户端实际渲染的所有插槽 |
|
|
921
955
|
| `test/live/model-seat-kind-probe.mjs` | 模型席位的 kind 与占用者(决定能不能接管) |
|
package/package.json
CHANGED
package/src/adapter.js
CHANGED
|
@@ -607,23 +607,34 @@ export class WorkBuddyAdapter {
|
|
|
607
607
|
}
|
|
608
608
|
|
|
609
609
|
/**
|
|
610
|
-
* Neutralise the
|
|
610
|
+
* Neutralise the system-prompt fingerprints the China gateway blocks.
|
|
611
611
|
*
|
|
612
|
-
* Verified 2026-10-21 against `copilot.tencent.com`: a system message whose
|
|
613
|
-
*
|
|
614
|
-
*
|
|
615
|
-
* `code 11128 Illegal API invocation from an unapproved channel`. The bare
|
|
616
|
-
* phrase, a leading word, and the same sentence with another noun all pass,
|
|
617
|
-
* so the rule is an anchored brand fingerprint rather than a content filter.
|
|
618
|
-
* Rewriting that opening keeps every other instruction intact.
|
|
612
|
+
* Verified 2026-10-21 against `copilot.tencent.com`: a system message whose text
|
|
613
|
+
* *begins* with `You are an AI agent powered by DeepSeek Harness` is answered with
|
|
614
|
+
* `code 11128 Illegal API invocation from an unapproved channel`.
|
|
619
615
|
*
|
|
620
|
-
*
|
|
621
|
-
*
|
|
622
|
-
*
|
|
616
|
+
* Verified again 2026-10-23: the rule now catches more of the harness prompt. The
|
|
617
|
+
* whole 5.7k-character prompt is rejected while a short one passes, and bisecting it
|
|
618
|
+
* shows the harness's Web-GUI development guidance at the end is part of what
|
|
619
|
+
* trips the check (dropping that paragraph unblocks the same prompt). That guidance
|
|
620
|
+
* is instructions for a coding session about the harness's own web shell — useless
|
|
621
|
+
* to a chat completion — so it is dropped for this route rather than rewritten.
|
|
622
|
+
* Brand mentions are generalised for the same reason.
|
|
623
|
+
*
|
|
624
|
+
* Applied to both deployments: the international gateway accepts the original
|
|
625
|
+
* wording, but one prompt shape for both routes is simpler to reason about.
|
|
623
626
|
*/
|
|
624
627
|
sanitizeSystem(text) {
|
|
625
628
|
if (typeof text !== 'string') return text
|
|
626
|
-
return text
|
|
629
|
+
return text
|
|
630
|
+
.replace(/^[ \t\r\n]*you are an ai agent powered by deepseek harness\.?/i, 'You are an AI agent.')
|
|
631
|
+
// Drop the Web-GUI development paragraphs: `pnpm run dev:web`, `apps/web`,
|
|
632
|
+
// the HMR receiver and the "do not start a replacement server" advice are all
|
|
633
|
+
// for editing the harness itself, and this route never needs them. This runs
|
|
634
|
+
// before the brand rename below, or the pattern would no longer match.
|
|
635
|
+
.replace(/[^\n]*(?:pnpm run dev:web|apps\/web|client-plugin HMR|DeepSeek Harness Web GUI|replacement server)[^\n]*\n?/gi, '')
|
|
636
|
+
.replace(/DeepSeek Harness/g, 'this harness')
|
|
637
|
+
.replace(/\n{3,}/g, '\n\n')
|
|
627
638
|
}
|
|
628
639
|
|
|
629
640
|
buildBody(options, model, entry, imageUrls) {
|
package/src/catalog.js
CHANGED
|
@@ -224,7 +224,7 @@ export function entryFromMeta(id, meta) {
|
|
|
224
224
|
* normally. So this is a preference order and a "officially sanctioned" marker,
|
|
225
225
|
* never a filter.
|
|
226
226
|
*/
|
|
227
|
-
|
|
227
|
+
function whitelistedIds(agents) {
|
|
228
228
|
if (!Array.isArray(agents)) return []
|
|
229
229
|
for (const agentName of ['cli', 'craft']) {
|
|
230
230
|
const agent = agents.find((entry) => typeof entry === 'object' && entry !== null && entry.name === agentName)
|