From d9a2610706c97d1c338186ad4c00f136911e7636 Mon Sep 17 00:00:00 2001 From: awork Date: Sun, 18 Oct 2026 17:53:47 +0800 Subject: [PATCH] docs: document DSH inspector fetch-accessor conflict + workaround (#3528) --- CONFIGURATION.md | 2 +- CONFIGURATION.zh-CN.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CONFIGURATION.md b/CONFIGURATION.md index 06a3ff3555..4e0bb0788b 100644 --- a/CONFIGURATION.md +++ b/CONFIGURATION.md @@ -1810,7 +1810,7 @@ File keys resolve only when the matching env var is unset. Defaults in parenthes | `BILI_IMAGE_RESCALE_MAX_DIM` | Longest-edge trigger threshold (px) for the egress downscale pass (#3400): an image is a rescale candidate when its longest edge exceeds this value OR its base64 body exceeds 100 KB; fit-inside resizing never upscales. Default `1600`; non-numeric or values below `128` are ignored (default applies). Env-only by design — no config-file mirror. See [`imageRescale`](#imagerescale). | | `BILI_PREFLIGHT_HOLD_MS` | Grace period (ms) before a long preflight compression starts holding the client with keep-alive bytes (default `30000`; see #568). | | `BILI_STREAM_KEEPALIVE_MS` | Streaming-phase client hold (#1647): when an SSE response has written zero bytes to the client for this many milliseconds, bili emits one SSE comment line (`: bili-keepalive`, a spec-level no-op) so the client's undici `bodyTimeout` (default 300s; Node built-in fetch cannot override it per request) cannot kill long prefills whose upstream pings the rewriter/strip pipes swallow. Default `15000`; `0` disables. Sibling of `BILI_PREFLIGHT_HOLD_MS`, which covers compression-preflight silence — this covers upstream-caused silence during streaming. | -| `BILI_RECLAIM_FETCH_PATCH` | Set to `0` to disable the native-mode fetch self-heal re-arm (#1158). By default the native fetch intercept installs `globalThis.fetch` as a guarded accessor, so a third-party patch that re-installs `globalThis.fetch` (e.g. dsh-http-proxy's settings refresh writing its frozen pre-bili `originalFetch`) is re-chained as the downstream and model traffic keeps routing through bili. With `0` the classic direct install stays: a third-party re-arm then wins and bili stops seeing model traffic for the session. **Egress note:** while the guard holds, claimed model traffic is dispatched by the bili proxy itself — it no longer rides the third-party chain's egress (e.g. a SOCKS5 proxy configured in dsh-http-proxy; bili's own upstream proxying supports HTTP proxies only). If you need the third-party egress back, set `0` and configure the egress at bili's level (`"proxy": "http://…"`). | +| `BILI_RECLAIM_FETCH_PATCH` | Set to `0` to disable the native-mode fetch self-heal re-arm (#1158). By default the native fetch intercept installs `globalThis.fetch` as a guarded accessor, so a third-party patch that re-installs `globalThis.fetch` (e.g. dsh-http-proxy's settings refresh writing its frozen pre-bili `originalFetch`) is re-chained as the downstream and model traffic keeps routing through bili. With `0` the classic direct install stays: a third-party re-arm then wins and bili stops seeing model traffic for the session. **Egress note:** while the guard holds, claimed model traffic is dispatched by the bili proxy itself — it no longer rides the third-party chain's egress (e.g. a SOCKS5 proxy configured in dsh-http-proxy; bili's own upstream proxying supports HTTP proxies only). If you need the third-party egress back, set `0` and configure the egress at bili's level (`"proxy": "http://…"`). **Coexistence note (#3528):** the default accessor form is incompatible with third-party components that require `globalThis.fetch` to be a plain writable data property — they read its property descriptor, find no `value`, and abort their fetch observer at load (reported: DSH Desktop's Developer Tools / NodeJS diagnostic plugin, `@deepseek-ai/dsh-experimental-inspector`). Set `0` (then fully restart the host) so such observers load via the classic direct install; you accept the trade-offs above. See #3528. | | `BILI_RESIGN` | Set to `0` to un-deploy the #1884 re-sign arm end to end (pre-fix behavior: signed bodies ride the normal rewrite path and fail upstream with 401). Default: armed — a signed model request that can be re-signed (SDK-HMAC-SHA256 with a resolvable credential) tunnels with every egress body re-signed; the arm needs no configuration on dsh (account-pool discovery via the credentials service). A BUILT-IN-scheme request that CANNOT be re-signed (no resolvable credential) is refused locally with 403 and an actionable message — its fix (provide the credential) is actionable. Every OTHER detected scheme (SigV4, gateway-invented headers like `x-ofm-signature` — detection is shape-based, #2090) has no credential source anywhere in bili, so it is ALWAYS refused (binary contract: re-signed+compressed or refused, never passed through unsigned): a 403 naming the scheme, remembered in `resign-pending.json`, and re-warned at every startup (and shown in the web UI) until bili ships the scheme's re-signer. `BILI_RESIGN_PASSTHROUGH=1` turns on verbatim no-compression forwarding for the BUILT-IN scheme only — it is inert for every other scheme. `enabled` / `passthrough` / `credentialRef` have config-file twins under the [`resign`](#resign) block, keyed by signature scheme (`resign["sdk-hmac-sha256"]`; `providers..resign[""]` is the level-2 override) — env vars win over the file. Scheme keys pin the passthrough opt-in: only the scheme whose key sets it tunnels. Related: `BILI_RESIGN_BENEFIT` (comma-separated list of CodeArts benefit models whose requests get the signed `maas_type: benefit` header — wins over the whole three-level tree; file-side twin is the level-3 `models..benefit` boolean, unset falls back to the built-in `glm-5.3-flash,deepseek-v4.1-flash`, mirroring the dsh codearts plugin's `CODEARTS_BENEFIT_FALLBACK`) and `BILI_CODEARTS_REF` (force the dsh credentials-service ref used for re-signing instead of discovering enabled `codearts` accounts from `$DSH_HOME/jet-hub/state.json`). | | `BILI_CONFIG_FILE` | Override the config file path (point at any JSON file). | | `ACP_PORT` / `PORT` | Override the listen port. | diff --git a/CONFIGURATION.zh-CN.md b/CONFIGURATION.zh-CN.md index 5633a0e246..ca3c2b11c2 100644 --- a/CONFIGURATION.zh-CN.md +++ b/CONFIGURATION.zh-CN.md @@ -1808,7 +1808,7 @@ ACP 原生 agent(当前为 `pi` 扩展)会在每个进程内向代理上报 | `BILI_IMAGE_RESCALE_MAX_DIM` | 出站降采样 pass 的最长边触发阈值(像素,#3400):图片最长边超过该值**或** base64 体积超过 100 KB 即成为降采样候选;fit-inside 缩放从不放大。默认 `1600`;非数字或低于 `128` 的取值被忽略(按默认处理)。设计上仅环境变量、无配置文件镜像。详见 [`imageRescale`](#imagerescale)。 | | `BILI_PREFLIGHT_HOLD_MS` | 预压缩超过该宽限期(毫秒)后,代理提前提交响应并用保活字节挂住客户端(默认 `30000`;见 #568)。 | | `BILI_STREAM_KEEPALIVE_MS` | 流式阶段客户端保活(#1647):SSE 响应连续该毫秒数没有向客户端写出任何字节时,bili 发一条 SSE 注释行(`: bili-keepalive`,协议层 no-op),防止客户端 undici `bodyTimeout`(默认 300s;Node 内置 fetch 无法按请求覆盖)在长 prefill 时断连——上游的 ping 注释会被重写器/剥离管道吞掉。默认 `15000`;`0` 关闭。与 `BILI_PREFLIGHT_HOLD_MS` 互补:后者覆盖压缩预检期的静默,本变量覆盖流式期上游导致的静默。 | -| `BILI_RECLAIM_FETCH_PATCH` | 设为 `0` 关闭 native 模式 fetch 自愈重武装(#1158)。默认情况下 native fetch 拦截会把 `globalThis.fetch` 装成受保护的访问器:第三方补丁重新赋值 `globalThis.fetch` 时(如 dsh-http-proxy 的 settings 刷新用冻结的 pre-bili `originalFetch` 盲覆盖),会被接链为下游,模型流量继续经过 bili。设 `0` 则回到经典直装:第三方重装生效,bili 将看不到本会话的模型流量。**出口提示:** 自愈生效期间,被认领的模型流量由 bili 代理自身派发——不再走第三方链的出口(例如 dsh-http-proxy 里配置的 SOCKS5;bili 自身的上游代理仅支持 HTTP 形式)。若需要回退第三方出口,设 `0` 并在 bili 层配置出口(`"proxy": "http://…"`)。 | +| `BILI_RECLAIM_FETCH_PATCH` | 设为 `0` 关闭 native 模式 fetch 自愈重武装(#1158)。默认情况下 native fetch 拦截会把 `globalThis.fetch` 装成受保护的访问器:第三方补丁重新赋值 `globalThis.fetch` 时(如 dsh-http-proxy 的 settings 刷新用冻结的 pre-bili `originalFetch` 盲覆盖),会被接链为下游,模型流量继续经过 bili。设 `0` 则回到经典直装:第三方重装生效,bili 将看不到本会话的模型流量。**出口提示:** 自愈生效期间,被认领的模型流量由 bili 代理自身派发——不再走第三方链的出口(例如 dsh-http-proxy 里配置的 SOCKS5;bili 自身的上游代理仅支持 HTTP 形式)。若需要回退第三方出口,设 `0` 并在 bili 层配置出口(`"proxy": "http://…"`)。**共存提示(#3528):** 默认的访问器形态与要求 `globalThis.fetch` 为普通可写数据属性的第三方组件不兼容——它们读取其属性描述符、发现没有 `value`,便在加载时中止 fetch 观察者(已报告:DSH 桌面「开发者工具 / NodeJS 诊断」插件,`@deepseek-ai/dsh-experimental-inspector`)。设 `0`(然后完全重启宿主)让此类观察者经经典直装正常加载;代价见上文。详见 #3528。 | | `BILI_RESIGN` | 设为 `0` 整体卸载 #1884 重签臂(回到修复前行为:带签名的请求照常改写、上游 401)。默认开启——可重签的签名请求(SDK-HMAC-SHA256 且能解析出凭据)走隧道,每个出站 body 都重签;重签臂在 dsh 上无需任何配置(经 credentials 服务做账号池发现)。**内置方案**无法重签的请求(解析不出凭据)本地拒收 403 并给出可操作提示——其修复(提供凭据)是可操作的。其他任何被检测到的方案(SigV4、`x-ofm-signature` 等网关自造头——检测是形状判定,#2090)在 bili 内部没有凭据来源也没有重签器,因此**一律本地拒收**(二元契约:重签+压缩或拒绝,绝不无签名放行):403 指明方案名,记入 `resign-pending.json`,每次启动(以及 web UI)反复提醒直到 bili 补上该方案的重签器。`BILI_RESIGN_PASSTHROUGH=1` 仅对内置方案开启原样转发(不压缩)——对其余方案无效。`enabled` / `passthrough` / `credentialRef` 有配置文件孪生项,见 [`resign`](#resign) 块——按签名方案分键(`resign["sdk-hmac-sha256"]`;`providers..resign["<方案>"]` 是二级覆盖)——环境变量优先于文件。方案键把 passthrough 钉死到具体签名:只有自己的键设了的方案才走隧道。相关:`BILI_RESIGN_BENEFIT`(逗号分隔的 CodeArts benefit 模型列表,这些请求附带参与签名的 `maas_type: benefit` 头——优先于整棵三级树;文件侧孪生项是三级的 `models..benefit` 布尔,未设置落到内置 `glm-5.3-flash,deepseek-v4.1-flash`,对齐 dsh codearts 插件的 `CODEARTS_BENEFIT_FALLBACK`)与 `BILI_CODEARTS_REF`(强制指定重签用的 dsh credentials 服务 ref,而不是从 `$DSH_HOME/jet-hub/state.json` 里发现启用的 `codearts` 账号)。 | | `BILI_CONFIG_FILE` | 覆盖配置文件路径(指向任意 JSON 文件)。 | | `ACP_PORT` / `PORT` | 覆盖监听端口。 |