Skip to content
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ Versions follow the merge of a `*_release-v*` branch; CI publishes to npm on tag

### Changes

- **bili-authored dsh client compaction: the #1729 guard can now ANSWER instead of refuse (#3733, fixes #3723's growth loop).** dsh's own compaction was refused locally since #1729 because a landed dsh checkpoint durably shadows the raw history; post-#3644 that substrate concern is gone (the server snapshot is the base), but a native checkpoint is still a foreign summary and — worse — with the refusal standing, dsh's context gauge only grows while its session file balloons unboundedly (#3723: a 39.7 MB / 9001-message file choked the desktop UI). With `BILI_DSH_AUTHORED_COMPACTION=1` (env-only rollout window, read per-request), when the guard fires AND the session holds an active fold block, bili answers the compaction summarize call LOCALLY — zero egress, the autoModeForge discipline — with OUR folded snapshot as the payload: one identity header line `<bili-snapshot v1 conv="…" seq="…" blocks="…" />` plus every active block's summary in the kernel render format. dsh records that as its checkpoint, so the client file shrinks while the recorded content is byte-identical to what the upstream already reads — client display, model context and server state finally agree. The identity tag rides in the message text, so replay recognition is declarative (`carriesBiliSnapshotCheckpoint`, the #2621 carrier+novelty discipline): the #2432 rebase handles the landing exactly like a foreign checkpoint but records `dshAuthoredCheckpointLanded` and logs info instead of warn. Precedence: an explicit `allowDshCompaction` (forward natively) still wins; no active blocks → falls through to the same 422; the passthrough-lane guard (no session) is untouched. Originals stay recoverable via CCR/export/fork; `dshCompactionRefusedBytes` keeps recording the raw-ledger high-water on authored answers too, so the #2490 output-clamp regimes keep planning against the raw scale.
- **存储收尾六修+缺省模式翻 full(#3818,修复 #3135)**:`storage.unified` 缺省从 shadow 翻为 full——shadow 干跑自 #2815 起对账干净,索引成为默认加载路径;JSON 信封照写,legacy 仍是一行逃生口。同车修六项:①writerOff 存档在边车 3-strike 自禁用的当拍立即补写 JSON 信封(消除「两边都没有」窗口);②BILI_PERSIST=0/持久化关闭视为有意退出(banner 不再假报降级);③存档印章改为实例真实印章(边车开不了/自禁用→盖 legacy,不再把请求模式盖到只存在 JSON 上的记录上);④verifyDrift 计数上 /__bili/status wire,漂移会话回退信封供数直到下次采样干净;⑤自举缓存损坏(Node 大版本升级等)从「警告并永不再试」改为删缓存重下一次钉死下载(sha512 保证重试安全);⑥有界 boot 并入纯索引会话(jsonWriter=off 用户的会话重启后可枚举;并入仍受 maxSessions+解码字节双预算约束,预算口径=序列化记录字节,与文件路径 #2803 同律)。加保:索引无法忠实表达的记录(blockContents 带孤儿 id、state.blocks 无对应块——手搓档案/web seeds 形状)跳过镜像与 viewFor 重建,永远从 JSON 信封供数(orphanSkips 计数可见)——修掉该形状首载后 contents 静默丢失。真实 #2695 收割形状(块从 state.blocks 移除、原文保留给 decompress 兜底)同样命中该守卫并被钉为『永不入索引』语义;writerOff 下该形状触发安全阀强制落一份 JSON 信封(索引跳过+无文件=零副本死亡的窗口不存在)。

- **WS 摘图门收窄到真 WebSocket 传输(#3701 Finding 1)**:`network.wsOutboundBytes` 的发送前摘图门原先对「任何受管自定义传输」生效——dsh-inline 的受管 HTTP fetch 也被卷入,超 10 MiB 的 HTTP 请求会被无谓摘图(同一载荷走 HTTP 曾观测 16 MiB 正常送达,从无 1009 门限)。现在门只认 `markWsLaneTransport` 打标的 Responses-WS 传输(responses-ws.ts);文档「仅 WS 车道生效」的表述自此为真。回归钉:受管 HTTP 传输形状原样透传、零摘图。
Expand Down
5 changes: 3 additions & 2 deletions CONFIGURATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,7 @@ This index is generated from `website/config-reference/*.yaml` — edit the seed

| Key | Type | Default | Env | Description |
|-----|------|---------|-----|-------------|
| `BILI_DSH_AUTHORED_COMPACTION` | boolean | false | — | Let bili ANSWER dsh compaction summarize calls locally with the folded snapshot instead of refusing (#3733): identity header + kernel-rendered block summaries, zero egress; replay recognized via the #2432 rebase. |
| `BILI_CONFIG_FILE` | string | unset (XDG config path) | — | Override the config file path (path relocation). |
| `BILI_SESSIONS_DIR` | string | unset (XDG state path) | — | Where session records are stored (path relocation). |
| `BILI_ENCRYPTION_KEY` | string | unset | — | Key material for encrypted persisted payloads (secret). |
Expand Down Expand Up @@ -1863,8 +1864,8 @@ File keys resolve only when the matching env var is unset. Defaults in parenthes
| `BILI_AFFINITY_SIMHASH` | Set `0` to turn OFF simhash chain-alignment adoption (#2265): anonymous requests whose exact hash chain was broken by a client-side pervasive decorative rewrite (e.g. Trae re-stamping model tags on every assistant message) re-attach the existing session with its compression state instead of minting fresh and re-folding from zero. Guards: ≥90% coverage within Hamming 10, ≥20% mutated-but-similar positions (point edits still fork, #629), ≥1 byte-identical user message, unique candidate only. Default ON. `"affinitySimhash": false` in the config file does the same; the env var wins. |
| `BILI_RESUME_INHERITANCE` | Set `0` to turn OFF resume inheritance (ON by default) (#1486): when an identified client (sends its own session id, e.g. Claude Code's `x-claude-code-session-id`) resumes a conversation under a NEW session id while replaying the full transcript (`cc --resume` forks a fresh UUID), bili matches the incoming history byte-exactly against that client's tracked chains (≥8 messages, append-only tracking) and, on the resumed session's first request, inherits the parent's ref assignments — stale model citations then resolve to their ORIGINAL messages instead of mis-hitting renumbered ones — adopts the fully-present compression blocks (together with this inheritance, #1834: losing them on resume meant the folded originals came back on the wire and the upstream request ballooned; the old `forkAdoption` co-gate now applies only to anonymous forks, #629), and records the `derivedFrom` lineage. The parent is never modified and fresh messages number above the parent's ref space. A resume must strictly EXTEND the parent's history — an equal-depth byte-exact replay under another id is a duplicate, not a resume. Anonymous sessions are unaffected (they keep their own pfa-* world, #309). `"resumeInheritance": false` in the config file does the same; the env var wins. |
| `BILI_STABLE_SYSTEM_ANCHOR` | Set `1` to enable stable-system anchoring (#1085) — a **best-effort wire-layer fallback** for prefix caching: the root fix belongs client-side (the client owns its history and decides how to present instruction changes), this only stops the proxy from letting a changed head invalidate the whole cached prefix. **Plain-proxy mode only**: plugin-mode agents (`x-bili-plugin`) own their context management and are never anchored, so clients that already inject cache-friendly updates (e.g. claude-code-style system reminders) are not double-processed. When enabled, bili remembers each session's first-seen head system/instructions block and keeps re-sending those exact bytes even when the client's system prompt later changes. A **localized** change (a file-style edit sharing ≥70% of lines with the version in effect so far) appends a trailing `[System context update] …` user note carrying a compact line diff (`-` removed / `+` added; each note composes sequentially onto the previous one). A **non-localized** change (structural reshuffle, tool-def churn, timestamped banners, heads over 400 lines) is adopted outright — one deliberate cache miss beats appending noise that would mislead the model about its instructions. Churn guard: more than 8 accumulated notes likewise replace the anchor with the newest text and clear the log. The anchor and note log persist with the session and survive compression/compaction (session metadata, not kernel state). Known residual limitation: client-placed `cache_control` breakpoints may still misalign after a head swap. Excluded from anchoring: title-gen micro-requests (OpenAI/Google), Responses compaction-trigger requests, auto-mode classifier requests. Clients implementing their own variant (stable prompt + in-history updates) get zero extra injection — such updates pass through as ordinary history. Default is OFF. `"stableSystemAnchor": true` in the config file does the same; the env var wins. |
| `BILI_ALLOW_DSH_COMPACTION` | Set `1` to let dsh's built-in auto-compaction run through bili (#2028). By default the wire-level guard (#1729) **refuses dsh native compaction calls locally** (422) on every lane bili serves — openai, anthropic, and responses (responses added by #2360; it was the lane the pre-#2360 whitelist short-circuited before the marker was ever examined, so dsh desktop's compaction calls passed silently): dsh's `compaction-basic` answers context pressure by replaying the conversation prefix plus a fixed summarization directive as the final user message, and when such a call LANDS its checkpoint durably shadows the raw history — irreversible, and it destroys the proxy's compression substrate. This switch lifts the refusal so dsh-native compaction can actually execute. While the guard refuses, dsh's own context-pressure counter (its raw ledger) only grows — refused checkpoints never land — while bili's folds keep the wire payload small, so the session keeps working past the point where the client's gauge says "full", and dsh keeps re-requesting compaction (refused every time). Since #3384 the outgoing output budget is also no longer planned against that raw ledger, EXCEPT when bili's own folded view has already reached the enforced headroom target or the requested budget is >= 25% of the native window (the #2490 protection regimes) — before that fix the growing ledger silently shrank the model's output budget every turn, ending in error-free empty replies on onlyReasoning models. Scope note: on non-web profiles the shipped bundle patch (`auto: false`) still suppresses AUTO-triggering, so only manual `/compact` benefits there; on web profiles no patch layer can address the preset-nested row by id (#1772), so auto-triggering works as-is once allowed unless you apply the #2474 full-snapshot override of preset-standard from your profile's cordis.patch.yml. The web config page exposes the same switch; the env var wins over the file. Set `"dsh": { "allowDshCompaction": true }` in the config file to the same effect (a bare top-level `"allowDshCompaction"` in an older file is auto-relocated there on load). |
| `BILI_ALLOW_DSH_COMPACTION` | Set `1` to let dsh's built-in auto-compaction run through bili (#2028). By default the wire-level guard (#1729) **refuses dsh native compaction calls locally** (422) on every lane bili serves — openai, anthropic, and responses (responses added by #2360; it was the lane the pre-#2360 whitelist short-circuited before the marker was ever examined, so dsh desktop's compaction calls passed silently): dsh's `compaction-basic` answers context pressure by replaying the conversation prefix plus a fixed summarization directive as the final user message, and when such a call LANDS its checkpoint durably shadows the raw history — irreversible, and it destroys the proxy's compression substrate. This switch lifts the refusal so dsh-native compaction can actually execute. Scope note: with bili ON, dsh native auto-compaction is now off on every plane — the host-plane row via the shipped bundle patch (`auto: false`), and web-profile preset instances at load time via the #3354 overlay — so this switch mainly governs manual `/compact` on non-web profiles (auto-triggering stays suppressed there) and any residual auto-triggering on dsh builds where the #3354 overlay does not apply. The web config page exposes the same switch; the env var wins over the file. Set `"dsh": { "allowDshCompaction": true }` in the config file to the same effect (a bare top-level `"allowDshCompaction"` in an older file is auto-relocated there on load). |
| `BILI_ALLOW_DSH_COMPACTION` | Set `1` to let dsh's built-in auto-compaction run through bili (#2028). By default the wire-level guard (#1729) **refuses dsh native compaction calls locally** (422) on every lane bili serves — openai, anthropic, and responses (responses added by #2360; it was the lane the pre-#2360 whitelist short-circuited before the marker was ever examined, so dsh desktop's compaction calls passed silently): dsh's `compaction-basic` answers context pressure by replaying the conversation prefix plus a fixed summarization directive as the final user message, and when such a call LANDS its checkpoint durably shadows the raw history — irreversible, and it destroys the proxy's compression substrate. This switch lifts the refusal so dsh-native compaction can actually execute. While the guard refuses, dsh's own context-pressure counter (its raw ledger) only grows — refused checkpoints never land — while bili's folds keep the wire payload small, so the session keeps working past the point where the client's gauge says "full", and dsh keeps re-requesting compaction (refused every time). Since #3384 the outgoing output budget is also no longer planned against that raw ledger, EXCEPT when bili's own folded view has already reached the enforced headroom target or the requested budget is >= 25% of the native window (the #2490 protection regimes) — before that fix the growing ledger silently shrank the model's output budget every turn, ending in error-free empty replies on onlyReasoning models. Scope note: with bili ON, dsh native auto-compaction is now off on every plane — the host-plane row via the shipped bundle patch (`auto: false`), and web-profile preset instances at load time via the #3354 overlay — so this switch mainly governs manual `/compact` on non-web profiles (auto-triggering stays suppressed there) and any residual auto-triggering on dsh builds where the #3354 overlay does not apply. The web config page exposes the same switch; the env var wins over the file. Set `"dsh": { "allowDshCompaction": true }` in the config file to the same effect (a bare top-level `"allowDshCompaction"` in an older file is auto-relocated there on load). |
| `BILI_DSH_AUTHORED_COMPACTION` | Set `1` to have bili itself ANSWER dsh's compaction summarize calls locally instead of refusing them (#3733). Prerequisites per call: the #1729 guard fires (marker-decisive), the session holds at least one ACTIVE fold block, and `allowDshCompaction` is NOT enabled (the explicit "forward natively" choice always wins). The reply is forged with zero egress (the autoModeForge #2740 discipline): an identity header `<bili-snapshot v1 conv="…" seq="…" blocks="…" />` plus every active block's summary in the kernel render format — exactly the bytes the model already reads upstream, so client display, upstream context and server state agree for the first time, and dsh's checkpoint file shrinks (#3723's unbounded growth loop). Originals stay recoverable via CCR/export; the landed checkpoint is recognized on replay through the same #2432 rebase as a foreign one, but recorded as `dshAuthoredCheckpointLanded` (info, not warn). Env-only for the rollout window; read per-request, no restart needed. |
| `BILI_NO_CACHE_CONTROL` | Set `1` to disable bili's Anthropic-lane `cache_control` breakpoint stamping (#1637, shipped in #1639). On by default: Anthropic-style upstreams cache only what is explicitly breakpointed (max 4 per request, counted across system + tools + message blocks combined), so bili marks the system block plus up to 3 cumulative message marks — a marked message stays marked (byte-stable prefix), marks die only by folding, and the last 3 stable messages carry the advancing frontier. Any client-set `cache_control` (message blocks, tools entries) suppresses bili's stamps entirely — client-managed caching wins. Marks persist with the session. This switch is the escape hatch for upstreams that reject the field or relays with their own breakpoint policy. Plain-proxy Anthropic lane only; OpenAI/Responses lanes cache implicitly and are never stamped. Config-file twin: [`compat.noCacheControl`](#compat) — the env var wins. |
| `BILI_CHAIN_CONTENT` | Set `1` to turn ON the ACP-artifact / `<bili-chain …/>` checkpoint **body-content** detection of bili→bili chain awareness (#1086/#1421): when an inbound request carries compression artifacts (render tags / historical `acp_status`+`search_context` tool calls) or a digest-bearing checkpoint in its BODY but neither the `x-bili-hop` header nor local compression state for its session, bili records an advisory observation and/or applies first-processor-wins passthrough. **Default is OFF** (#1683 follow-up): by default ONLY the `x-bili-hop` header drives chain recognition, because scanning the request BODY can false-positive on CCR/file-introduced text and model-echoed tags that look like real markers. Enable it only for the narrow multi-bili relay case where an intermediate box strips `x-bili-hop` and you accept that false-positive risk. `"chainContentDetection": true` in the config file does the same; the env var wins. The `x-bili-hop` signal itself is unaffected by this switch. |
| `BILI_CHAIN_STAMP` | Set `1` to turn ON egress emission of the **model-visible** `<bili-chain …/>` chain-integrity checkpoint carrier (#1683, default OFF): when enabled, every request THIS instance actually processes leaves with a digest-bearing stamp so a downstream bili applies first-processor-wins even when the `x-bili-hop` header was stripped in transit (#1421). The carrier lands in a slot the terminal model also reads (a trailing `user` message on OpenAI/Responses, a trailing text part on Anthropic/Google), so models treat it as phantom user input and burn tokens commenting on it — which is why it is off by default. Enable it only for the narrow multi-bili relay case where `x-bili-hop` is stripped by an intermediate box and the digest-verified body-stamp is the sole guard against double-processing. Independent of `BILI_CHAIN_CONTENT` (inbound body-detection is also default OFF) and of the `x-bili-hop` passthrough, which works either way. `"chainEgressStamp": true` in the config file does the same; the env var wins. |
Expand Down
Loading
Loading