From a10df3de0f53304be6500a53d74d4e840d477d23 Mon Sep 17 00:00:00 2001 From: ework-agent Date: Thu, 1 Oct 2026 00:37:20 +0800 Subject: [PATCH] docs(dsh): user-preset recipe disables native auto-compaction in web profiles (#1772) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The #1777 warning said native auto-compaction 'stays enabled' in web profiles because no patch layer can reach the preset-nested compaction-basic instance. That is true for the bundle patch, but dsh itself exposes a sanctioned path: the preset roster's user root ($DSH_HOME/.agent-presets/), which the Web UI preset picker already writes to. Duplicate the standard preset, give its compaction-basic row config: { auto: false } (compaction-basic only registers automatic compaction when this.config.auto), select the copy as the default — manual /compact and the tool-result pruner are kept. - CLIENTS.md / CLIENTS.zh-CN.md: full recipe under the #1772 caveat, with the verified-against-dsh-0.2.0-rc.2 notes and the caveats (no shipped-id reuse — the shipped root shadows duplicates; snapshot drift on preset upgrades; pre-switch sessions keep the old preset). - src/agent/dsh-native.ts: the one-time boot warning now points at the recipe instead of a dead end; same channel, same once-per-process gating, wire/persistence behavior unchanged. - tests/dsh-native.test.ts: assert the warning names the remedy. - README.md / README.zh-CN.md: bili dsh line now says web profiles switch presets per the recipe instead of 'off outside web profiles'. --- CLIENTS.md | 19 +++++++++++++++++++ CLIENTS.zh-CN.md | 1 + README.md | 2 +- README.zh-CN.md | 2 +- src/agent/dsh-native.ts | 2 +- tests/dsh-native.test.ts | 2 ++ 6 files changed, 25 insertions(+), 3 deletions(-) diff --git a/CLIENTS.md b/CLIENTS.md index ac69b7c175..cf93cad1b3 100644 --- a/CLIENTS.md +++ b/CLIENTS.md @@ -88,6 +88,25 @@ Two lanes, same plugin (#941): already-disabled host-plane row and the preset instance keeps auto-compaction ON. The plugin logs a one-time `[dsh-client]` warning at boot in such profiles; ACP compression is unaffected. + - **Turning it off anyway (#1772 recipe):** dsh's preset roster carries a + user root (`$DSH_HOME/.agent-presets/`) that the Web UI's preset picker + already writes to — Settings → General → agent preset → *Duplicate* the + `standard` preset, then edit the copy's `agent.cordis.yml`: under the + `compaction` group give the `compaction-basic` row `config: { auto: false }` + (keeps manual `/compact` and the tool-result pruner), and select the copy + as the default. Same effect without the UI: copy the shipped preset + directory (`presets/standard/` inside the installed + `@deepseek-ai/dsh-agent-presets` package — both `preset.yml` and + `agent.cordis.yml`), apply the one-line edit, and set the default by + writing the settings document the picker uses (`agent-presets:` → + `default: `) or by picking the copy in the UI. Verified against + dsh 0.2.0-rc.2: the copy parses under the loader's own `entryListSchema`, + `compaction-basic` honors `auto: false` (it only registers automatic + compaction `if (this.config.auto)`), and preset rows resolve + `@deepseek-ai/*` packages from the installed harness. Caveats: a user + preset id must differ from shipped ids (the shipped root shadows + duplicates), the copy is a snapshot — re-apply the edit after dsh upgrades + its presets — and sessions created before the switch keep the old preset. Under a `bili dsh` launch the plugin ATTACHES to the launcher's proxy (no second spawn). Raw upstream URLs rewrite to `/bili/` like diff --git a/CLIENTS.zh-CN.md b/CLIENTS.zh-CN.md index 028be6b704..43bac3be4a 100644 --- a/CLIENTS.zh-CN.md +++ b/CLIENTS.zh-CN.md @@ -15,6 +15,7 @@ - **自动更新保持各 profile 同步:** 刷新有两个触发器 —— 全局自更新完成后,以及**profile 自己的代理**在周期检查里发现注册表有新版本时(全局 bili 从不运行也一样刷新,#1196 —— 插件市场安装的用户往往根本没有全局安装)。两种触发器都扫描 `~/.dsh/profiles/*/package.json`,把注册表钉住的 `billion-context` 依赖刷新到目标版本(全局触发器刷到新全局版本,自触发刷到注册表最新),统一经 dsh 自己的 `plugin add` 通道,绝不在位覆盖 —— 加载的插件与代理从此不再漂移(#953);钉在本地源的 profile 不动。刷新是尽力而为,失败下个周期重试,绝不会让代理或更新本身失败。 - **已报告:Profile 安装下部分传输零代理流量(#1158,调查中):** dsh `llm-pi-ai` 层的部分传输服务会话**从未有任何模型请求到达代理**(日志无 `processTurn`,调用 bili 工具返回 404 "no model request has arrived"),而同宿主的其他 provider 正常。根因仍在用运行时证据定性 —— 候选:传输层 fetch 形态(SDK 注入 fetch / 非全局 dispatcher)或宿主侧归属缺口导致流量未被 takeover gate 认领。检测:此类情况会打一次性 `[plugin] NO MODEL REQUESTS seen for conversation …` 告警,dsh 插件还会把归属 gate 放行的每个端点各记一条日志(每进程一次)。期间可靠规避:改用 `bili dsh` 启动 —— 启动器的 settings overlay 会把那些 provider 的 `baseURL` 重写为 `/bili/` URL,无论传输层使用哪种 fetch、归属状态如何,流量都必然过代理。 - **Web profile 说明(#1772):** 当 profile 的 bundles 含 `@deepseek-ai/dsh-web-app` 时,真正运行的 `compaction-basic` 实例位于 agent preset(`preset-standard.config.plugins`)内部 —— dsh 的 patch 引擎只按 id 索引顶层条目与真 group(`group: true` 且 config 为数组)的子项,preset 内的嵌套行任何 patch 层都够不到。于是 bundle 里的 `auto: false` 落在 web-app 已禁用的宿主平面行上,preset 实例保持自动压缩开启。此类 profile 启动时插件打一条一次性 `[dsh-client]` 告警;ACP 压缩不受影响。 +- **照样关掉它(#1772 配方):** dsh 的 preset roster 自带用户根目录(`$DSH_HOME/.agent-presets/`),Web UI 的预设选择器就在往里写 —— 设置 → 通用 → 智能体预设里「复制」`standard` 预设,然后在副本的 `agent.cordis.yml` 里给 `compaction` group 下的 `compaction-basic` 行加上 `config: { auto: false }`(保留手动 `/compact` 与 tool-result 修剪),再把副本选为默认。不走 UI 的等价做法:拷贝已安装 `@deepseek-ai/dsh-agent-presets` 包内 `presets/standard/` 整目录(`preset.yml` + `agent.cordis.yml` 两份),打好同一行编辑,再写选择器所用的 settings 文档(`agent-presets:` → `default: <副本id>`)或直接在 UI 里选中。已在 dsh 0.2.0-rc.2 上验证:副本能通过 loader 自带的 `entryListSchema` 解析,`compaction-basic` 尊重 `auto: false`(它只在 `if (this.config.auto)` 时才注册自动压缩),preset 行的 `@deepseek-ai/*` 包名从已安装 harness 解析。注意:user preset 的 id 不能与已随包 id 同名(shipped root 会 shadow 同名);副本是快照,dsh 升级 preset 后需重打这一行;切换前已建的 session 仍用旧 preset。 `bili dsh` 启动下插件**附看**(attach)启动器的代理(不二次拉起)。裸上游 URL 与 spawn 模式一样重写为 `/bili/`(回环代理目标永不被代理 env 拦截,等于直接绕开 MITM);已经路由的 `/bili/` 前缀请求原样放行、只盖章。已知局限:手动 `/compact` 没有 dsh 侧事件钩子,其边界交给内核的自然 ingest diff(非 web profile 下自动压缩已关,影响罕见;web profile 见上方 #1772 说明)。 diff --git a/README.md b/README.md index c70e4f563c..35ec719206 100644 --- a/README.md +++ b/README.md @@ -227,7 +227,7 @@ bili claude # launch claude through the proxy bili omp # pi-style, file-free (#535): env + extension registerProvider + compaction cancel, real ~/.omp untouched bili opencode # OpenCode (1.x & 2.x): full guide in the [OpenCode](CLIENTS.md#opencode) section below bili hermes # file-free (#535): hermes proxy env (HTTPS_PROXY + combined CA bundle via SSL_CERT_FILE) — https via CONNECT MITM, http via absolute-form forward proxy; real ~/.hermes untouched -bili dsh # deepseek-harness: full native plugin injected via --patch (#941) — real dsh tools, session-bound /acp + /acp-cache (plugin mode); non-loopback upstreams ride proxy envs, loopback keeps the overlay DSH_HOME rewrite (#535); dsh auto-compaction off outside web profiles (#1772) +bili dsh # deepseek-harness: full native plugin injected via --patch (#941) — real dsh tools, session-bound /acp + /acp-cache (plugin mode); non-loopback upstreams ride proxy envs, loopback keeps the overlay DSH_HOME rewrite (#535); dsh auto-compaction off (web profiles: preset switch, #1772 recipe in CLIENTS.md) bili codebuddy # Tencent CodeBuddy Code CLI: CODEBUDDY_BASE_URL /bili/ rewrite (OpenAI chat completions wire), budget aligned via CODEBUDDY_AUTO_COMPACT_WINDOW; real ~/.codebuddy untouched bili qoder # qoder: model endpoint is hardcoded https (no /bili/ rewrite possible) — cert-MITM via HTTPS_PROXY + NODE_EXTRA_CA_CERTS, default model hosts whitelisted (#653) bili trae # Trae CLI (ByteDance, closed Go binary, no base-URL override) — cert-MITM via HTTPS_PROXY + SSL_CERT_FILE, model host from TRAE_CLI_API_HOST or the default enterprise gateway (#655) diff --git a/README.zh-CN.md b/README.zh-CN.md index c22439ab00..f6913de7ec 100644 --- a/README.zh-CN.md +++ b/README.zh-CN.md @@ -193,7 +193,7 @@ bili claude # 拉起 claude bili omp # pi 同款,file-free(#535):环境变量 + 扩展 registerProvider + 压缩取消,真实 ~/.omp 不动 bili opencode # OpenCode(1.x 与 2.x):完整指南见下文 [OpenCode](CLIENTS.zh-CN.md#opencode) 一节 bili hermes # file-free(#535):hermes 代理环境变量(HTTPS_PROXY + SSL_CERT_FILE 组合 CA bundle)—— https 走 CONNECT MITM,http 走绝对形式转发;真实 ~/.hermes 不动 -bili dsh # deepseek-harness:经 --patch 注入完整原生插件(#941) —— 真实 dsh 工具、会话绑定 /acp(plugin 模式);非回环上游走代理 env,回环保留 overlay DSH_HOME 改写(#535);dsh 自动压缩关(web profile 除外——preset 内实例无法经 patch 触及,#1772) +bili dsh # deepseek-harness:经 --patch 注入完整原生插件(#941) —— 真实 dsh 工具、会话绑定 /acp(plugin 模式);非回环上游走代理 env,回环保留 overlay DSH_HOME 改写(#535);dsh 自动压缩关(web profile 换预设即可,#1772 配方见 CLIENTS.zh-CN.md) bili codebuddy # Tencent CodeBuddy Code CLI:CODEBUDDY_BASE_URL /bili/ 重写(OpenAI chat completions wire),预算对齐走 CODEBUDDY_AUTO_COMPACT_WINDOW;真实 ~/.codebuddy 不动 bili qoder # qoder:模型端点硬编码 https(无法 /bili/ 改写)—— 证书 MITM(HTTPS_PROXY + NODE_EXTRA_CA_CERTS),默认模型主机已加白名单(#653) bili trae # Trae CLI(字节跳动,闭源 Go 二进制,无 base-URL 覆盖)—— 证书 MITM(HTTPS_PROXY + SSL_CERT_FILE),模型主机取 TRAE_CLI_API_HOST 或默认企业网关(#655) diff --git a/src/agent/dsh-native.ts b/src/agent/dsh-native.ts index 0ac3f1b232..80978c2a12 100644 --- a/src/agent/dsh-native.ts +++ b/src/agent/dsh-native.ts @@ -767,7 +767,7 @@ export function apply(ctx: PluginContext): void { } if (bundles !== undefined && bundles.includes("@deepseek-ai/dsh-web-app")) { webProfileWarned = true; - persistClientEvent("profile bundles include @deepseek-ai/dsh-web-app — its agent presets run their own compaction-basic where the bundle patch cannot set auto:false (#1772); dsh native auto-compaction stays enabled in this profile (ACP compression unaffected)"); + persistClientEvent("profile bundles include @deepseek-ai/dsh-web-app — its agent presets run their own compaction-basic where the bundle patch cannot set auto:false (#1772); dsh native auto-compaction stays on for this profile until you switch to a preset whose compaction-basic sets auto:false (recipe: CLIENTS.md, DeepSeek Harness section; ACP compression unaffected)"); } } diff --git a/tests/dsh-native.test.ts b/tests/dsh-native.test.ts index 142155c466..b6a9da673e 100644 --- a/tests/dsh-native.test.ts +++ b/tests/dsh-native.test.ts @@ -781,6 +781,8 @@ test("#1772 apply(): web-profile compaction caveat warns once in the durable log apply(ctx); assert.equal(warnLines().length, 1); assert.match(warnLines()[0], /#1772/); + // the warning points at the remedy, not a dead end + assert.match(warnLines()[0], /preset whose compaction-basic sets auto:false/); // once-per-process: a later apply with the same profile adds nothing const again = mockCtx();