Files
billion-context/website/config-reference/process.yaml
T
awork 58e86897d0 docs: seed storage.walJournalSizeLimitBytes in the config-reference generator (#3250)
CONFIGURATION.md / zh-CN / website docs are generated artifacts of website/config-reference/*.yaml (tools/gen-config-docs.mjs); the previous commit hand-edited the artifact and skipped the seed, tripping docs-sync + docs-coverage + config-surface-guard. Adds the seed entry and regenerates.
2026-10-15 15:19:50 +08:00

280 lines
21 KiB
YAML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Config reference seed — process & persistence blocks (#2107 single source of truth).
# Edit HERE, then run: node tools/gen-config-docs.mjs generate
domain: process
entries:
- key: network
type: object
default: "{} (all defaults)"
group: process
id: tt.network
site_group: proc
desc_en: "Transport timeouts, watchdogs and replay policy for upstream calls."
desc_zh: "上游调用的传输超时、看门狗与重放策略。"
site_en: "<code>network</code> — transport timeouts &amp; replays: <span class='mech'>upstreamTimeoutMs 720000 · requestWatchdogMs 2× · replayRetryMax 3 · replayRetryBaseMs 1500 · keepAliveTimeoutMs 5000 · clientErrorBackstopMs 30000 · exposureLogIntervalMs 3600000 · streamKeepAliveMs 15000 · preflightHoldMs 30000 · preflightDeadEndCooldownMs 300000 · proxyKeepAliveMaxMs 55000</span>."
site_zh: "<code>network</code> —— 传输超时与重放:<span class='mech'>upstreamTimeoutMs 720000 · requestWatchdogMs 2× · replayRetryMax 3 · replayRetryBaseMs 1500 · keepAliveTimeoutMs 5000 · clientErrorBackstopMs 30000 · exposureLogIntervalMs 3600000 · streamKeepAliveMs 15000 · preflightHoldMs 30000 · preflightDeadEndCooldownMs 300000 · proxyKeepAliveMaxMs 55000</span>。"
- key: network.upstreamTimeoutMs
type: number
default: "720000"
env: BILI_UPSTREAM_TIMEOUT_MS
group: process
desc_en: "Hard ceiling on a single upstream call (12 min covers slow deep-thinking models)."
desc_zh: "单次上游调用的硬上限(12 分钟覆盖慢速深度思考模型)。"
- key: network.requestWatchdogMs
type: number
default: "2× upstreamTimeoutMs"
env: BILI_REQUEST_WATCHDOG_MS
group: process
desc_en: "Absolute watchdog that force-aborts a stuck upstream socket even when the per-call timer was never armed."
desc_zh: "绝对看门狗:即使按调用计时器从未挂上,也强制中止卡死的上游套接字。"
- key: network.keepAliveTimeoutMs
type: number
default: "5000"
env: BILI_KEEP_ALIVE_TIMEOUT_MS
group: process
desc_en: "Idle keep-alive timeout for pooled upstream sockets."
desc_zh: "连接池内上游套接字的空闲保活超时。"
- key: network.clientErrorBackstopMs
type: number
default: "30000"
env: BILI_CLIENT_ERROR_BACKSTOP_MS
group: process
desc_en: "Backstop that aborts a client connection that stops reading a committed response."
desc_zh: "中止停止读取已提交响应的客户端连接的兜底超时。"
- key: network.exposureLogIntervalMs
type: number
default: "3600000 (0 disables the log)"
env: BILI_EXPOSURE_LOG_INTERVAL_MS
group: process
desc_en: "How often bound-address exposure warnings repeat in the log; 0 disables them entirely."
desc_zh: "绑定地址暴露警告在日志中的重复间隔;0 完全禁用。"
- key: network.streamKeepAliveMs
type: number
default: "15000 (0 disables)"
env: BILI_STREAM_KEEPALIVE_MS
group: process
desc_en: "Downstream stream keep-alive ping interval between model chunks; 0 disables pinging."
desc_zh: "模型块之间的下游流保活心跳间隔;0 禁用心跳。"
- key: network.preflightHoldMs
type: number
default: "30000"
env: BILI_PREFLIGHT_HOLD_MS
group: process
desc_en: "How long a failed preflight holds before the request is allowed through unreconciled."
desc_zh: "preflight 失败后,允许请求未校准放行的持有时长。"
- key: network.preflightDeadEndCooldownMs
type: number
default: "300000"
env: BILI_PREFLIGHT_DEAD_END_COOLDOWN_MS
group: process
desc_en: "Cooldown after a dead-end preflight before retrying reconciliation for the same session."
desc_zh: "死胡同 preflight 后,对同一会话重试校准的冷却时长。"
- key: network.replayRetryMax
type: number
default: "3 (1 disables replays)"
env: BILI_REPLAY_RETRY_MAX
group: process
desc_en: "Maximum transport-failure replays of an identical request before surfacing the error."
desc_zh: "同一请求在向上游暴露错误前的最大传输失败重放次数。"
- key: network.replayRetryBaseMs
type: number
default: "1500 (0 disables the delay)"
env: BILI_REPLAY_RETRY_BASE_MS
group: process
desc_en: "Base backoff delay between replays (exponential)."
desc_zh: "重放之间的基础退避延迟(指数增长)。"
- key: network.maxShrinkPerCompress
type: number
default: "unset"
env: BILI_MAX_SHRINK_PER_COMPRESS
group: process
desc_en: "Cap on how much one compression may shrink history (anti-collapse guard)."
desc_zh: "单次压缩允许收缩历史的上限(防塌缩护栏)。"
- key: network.proxyKeepAliveMaxMs
type: number
default: "55000 (0 = one-shot connections)"
env: BILI_PROXY_KEEPALIVE_MAX_MS
group: process
desc_en: "Max lifetime of a connection through an outbound egress proxy before forcing reconnection (avoids stale NAT mappings)."
desc_zh: "经出站代理的连接最大存活时长,到期强制重建(规避陈旧 NAT 映射)。"
- key: network.postResponseLingerMs
type: number
default: "5000"
env: BILI_POST_RESPONSE_LINGER_MS
group: process
desc_en: "Graceful-close budget for proxy-initiated closes after the response completed: the socket is held waiting for the peer's FIN/TLS close_notify and destroyed at the deadline (reason=linger-backstop)."
desc_zh: "代理主动发起的响应后关闭的优雅关闭预算:socket 挂起等待对端 FIN/TLS close_notify,到点销毁(reason=linger-backstop)。"
- key: network.allowPrivateHttpProviders
type: boolean
default: "false"
env: BILI_ALLOW_PRIVATE_HTTP_PROVIDERS
group: process
desc_en: "Opt-in (#2984): admit plain-HTTP providers on private networks (RFC1918, 127/8, link-local, ULA, *.local/.lan/.internal) into the agent-registry intake and summary-endpoint guards. Off by default — plaintext stays loopback-only; public IPs/domains and CGNAT (100.64/10) stay refused regardless. 1/true enables."
desc_zh: "可选开关(#2984):允许私网(RFC1918、127/8、link-local、ULA、*.local/.lan/.internal)明文 HTTP provider 进入 agent-registry 接收与摘要端点守卫。默认关——明文仅回环受信;公网 IP/域名与 CGNAT(100.64/10)无论如何都拒。1/true 启用。"
- key: persist
type: object
default: "{} (all defaults)"
group: process
id: tt.persist
site_group: proc
desc_en: "Session persistence to disk under the XDG state dir."
desc_zh: "会话落盘持久化(XDG state 目录之下)。"
site_en: "<code>persist</code> — session persistence to disk: <span class='mech'>enabled true · zstd false · debounceMs 500 · tailTokens 16384 · epermAlertThreshold 5 · epermAlertRepeatMs 0</span>."
site_zh: "<code>persist</code> —— 会话落盘持久化:<span class='mech'>enabled true · zstd false · debounceMs 500 · tailTokens 16384 · epermAlertThreshold 5 · epermAlertRepeatMs 0</span>。"
- key: persist.enabled
type: boolean
default: "true"
env: BILI_PERSIST
group: process
desc_en: "Master switch for writing session records to disk (0/false turns it off)."
desc_zh: "会话记录落盘总开关(0/false 关闭)。"
- key: persist.zstd
type: boolean
default: "false"
env: BILI_PERSIST_ZSTD
group: process
desc_en: "Zstd-compress persisted session files (1/true enables)."
desc_zh: "zstd 压缩持久化会话文件(1/true 启用)。"
- key: persist.debounceMs
type: number
default: "500"
env: BILI_PERSIST_DEBOUNCE_MS
group: process
desc_en: "Write debounce window for session files."
desc_zh: "会话文件写入的去抖窗口。"
- key: persist.tailTokens
type: number
default: "16384 (0 disables message persistence)"
env: BILI_PERSIST_TAIL_TOKENS
group: process
desc_en: "Token-size tail of recent messages kept as raw text for export fidelity."
desc_zh: "为导出保真保留的最近消息原文 token 尾部大小。"
- key: persist.epermAlertThreshold
type: number
default: "5"
env: BILI_PERSIST_EPERM_ALERT_THRESHOLD
group: process
desc_en: "Consecutive EPERM write failures before alerting in the log."
desc_zh: "连续 EPERM 写失败达到该次数后在日志中告警。"
- key: persist.epermAlertRepeatMs
type: number
default: "0 (no repeats)"
env: BILI_PERSIST_EPERM_ALERT_REPEAT_MS
group: process
desc_en: "Repeat interval for the EPERM alert; 0 logs it once."
desc_zh: "EPERM 告警的重复间隔;0 只记录一次。"
- key: storage
type: object
default: "{} (all defaults)"
group: process
id: tt.storage
site_group: proc
desc_en: "Unified SQLite storage sidecar settings (#2671)."
desc_zh: "统一 SQLite 存储边车设置(#2671)。"
site_en: "<code>storage</code> — unified storage sidecar: <span class='mech'>unified legacy</span> — file tier selects the lane-wide storage mode; env BILI_STORAGE_UNIFIED wins when set."
site_zh: "<code>storage</code> —— 统一存储边车:<span class='mech'>unified legacy</span> —— 文件层选定全 lane 存储模式;设置了 BILI_STORAGE_UNIFIED 时环境变量优先。"
- key: storage.unified
type: "legacy|shadow|full"
default: "unset (shadow)"
env: BILI_STORAGE_UNIFIED
group: process
desc_en: "Tiered storage-migration switch (#2671): shadow = unified SQLite double-write dry-run with digest reconciliation; full = drop-in read path (unified-first loads with organic import, legacy fallback). Absent everywhere now defaults to shadow (JSON stays the sole source of truth; the index is digest-reconciled telemetry - set legacy to opt out). File tier is strict legacy/shadow/full; the env tier also accepts 1/true (=shadow) and unified (=full) and wins over the file. Resolved once per lane boot - hot edits need a restart. Encryption (BILI_ENCRYPTION_KEY) hard-blocks the sidecar."
desc_zh: "分层存储迁移开关(#2671):shadow = 统一 SQLite 双写干跑 + digest 对账;full = 平替读路径(unified-first 加载 + 有机导入 + legacy 兜底)。两处均未设置时默认 shadow(JSON 仍是唯一事实源,索引只做对账遥测 —— 设 legacy 可退出)。文件层只接受 legacy/shadow/full;环境变量层还接受 1/true(=shadow)与 unified(=full)并优先于文件。每个 lane 启动时解析一次 —— 热改动需重启生效。加密(BILI_ENCRYPTION_KEY)会硬阻断边车。"
- key: storage.sqliteAutoDownload
type: boolean
default: "true"
env: BILI_SQLITE_AUTO_DOWNLOAD
group: process
desc_en: "Gate for the one-time SQLite engine self-download (#2833): when no engine is available in-process (no built-in node:sqlite, no host-installed better-sqlite3) and the unified sidecar is wanted on this platform, bili downloads the pinned better-sqlite3 prebuilt tarball from the npm registry once (~11 MB, sha512-verified) into the cache dir and reuses it on every later start. Engine resolution order: built-in node:sqlite (Node >= 22.5) -> host-provided better-sqlite3 -> cached self-download -> self-download (gated by this switch) -> none (legacy-only, the #2825 degrade contract). The switch gates only the network fetch - a cached copy is used even when it is false; unsupported platforms never download."
desc_zh: "SQLite 引擎一次性自下载的闸门(#2833):进程内没有可用引擎(无内置 node:sqlite、宿主未装 better-sqlite3)且本平台希望启用统一边车时,bili 从 npm registry 一次性下载钉死的 better-sqlite3 预编译 tarball(约 11 MB,sha512 校验)到缓存目录,之后每次启动复用。引擎解析顺序:内置 node:sqlite(Node >= 22.5)-> 宿主机已装的 better-sqlite3 -> 缓存的自下载副本 -> 自下载(本开关控制)-> 无引擎(仅 legacy,即 #2825 降级契约)。开关只控制网络下载 —— 为 false 时缓存副本仍会使用;不支持的平台永不下载。"
- key: storage.jsonWriter
type: "on|off"
default: "on"
env: BILI_STORAGE_JSON_WRITER
group: process
desc_en: "Phase 3 envelope switch (#2960): off stops writing the legacy JSON session envelope while storage.unified is full - the SQLite index becomes the only persistent copy (reads are already unified-first; boot enumerates the index union, so index-only sessions load normally). Only honored in effective-full mode: under shadow/legacy (or with encryption active) the request is ignored with a one-time warning because the JSON file remains the sole source of truth. Env tier 0/false/off = off and 1/true/on = on wins over the strict file spellings. Fail-safe: if the sidecar disables itself mid-run, envelope writes resume on the next save. Rollback: unset the knob - writing resumes, index-only sessions keep loading via the boot union, and replicas/restore re-materialize portable JSON envelopes. Downgrading the binary (or losing the SQLite engine) makes index-only sessions invisible to v0.1.196 and older until a >=v0.1.197 binary runs again - the data stays intact in index.db, it is just not read by the older code. The per-session content-store sidecar keeps being written either way. A jsonWriter=off lane must be the SOLE writer of its sessions directory: an off lane reads unified-first and never falls back to the file, so any peer instance running legacy/shadow against the same directory diverges silently (its JSON copy stops receiving updates, and the off lane never sees the peer's writes)."
desc_zh: "Phase 3 信封开关(#2960):off 时若 storage.unified 为 full 则不再写 legacy JSON 会话信封 —— SQLite 索引成为唯一持久化副本(读路径本就 unified-first;boot 枚举索引并集,纯索引会话可正常加载)。仅在有效 full 模式下生效:shadow/legacy(或加密激活)下请求会被忽略并警告一次,因为 JSON 文件仍是唯一事实源。环境变量层 0/false/off = off、1/true/on = on,优先于严格拼写的文件层。失败安全:若边车运行中自禁用,下次保存即恢复信封写入。回滚:去掉该开关 —— 写入恢复,纯索引会话经 boot 并集继续可加载,replicas/restore 可重新物化可移植的 JSON 信封。降级二进制(或丢失 SQLite 引擎)会让纯索引会话在 v0.1.196 及更早版本上不可见,直到重新运行 >=v0.1.197 —— 数据在 index.db 中完好无损,只是旧代码不读它。每会话的 content-store 边车无论开关如何都照写。jsonWriter=off 的 lane 必须是其会话目录的唯一写者:off lane 读路径 unified-first、永不回退到文件,因此同一目录上跑 legacy/shadow 的对等实例会静默分叉(它的 JSON 副本收不到更新,off lane 也看不到对等实例的写入)。"
- key: storage.walJournalSizeLimitBytes
type: number
default: "8388608"
env: BILI_STORAGE_WAL_JOURNAL_SIZE_LIMIT_BYTES
group: process
desc_en: "WAL reclamation cap for index.db-wal (#3250), in bytes: every completed checkpoint truncates the WAL file back to this size, bounding disk use and crash-recovery replay in long-lived processes. NOT a per-session data quota - data lands in index.db as it is written and the WAL only stages frames between checkpoints, so session count/size does not scale this; a large burst can overshoot temporarily until the next completed checkpoint truncates back. Higher = rarer truncate IO but more steady disk use and a longer crash-replay tail. Env tier (positive integer) wins over the file tier; a garbage or non-positive env value falls through to the file/default tier instead of failing boot. Applied when the store opens at lane boot - hot edits need a restart. The effective value appears on the unified-enable log line and in the storage diagnostics blob."
desc_zh: "index.db-wal 的 WAL 回收上限(#3250),单位字节:每次完成的 checkpoint 把 WAL 文件截回该大小,约束长驻进程的磁盘占用与崩溃恢复重放。不是每会话数据配额 —— 数据写入时就已落进 index.db,WAL 只是两次 checkpoint 之间的帧暂存区,会话数量/大小不会放大它;大 burst 可能暂时超出,直到下一次完成的 checkpoint 截回。调大 = truncate IO 更稀疏,但稳态磁盘占用更多、崩溃恢复重放尾更长。环境变量层(正整数)优先于配置文件层;env 值非法或非正数时静默落到文件/默认层,boot 不崩。lane 启动、store open 时生效 —— 热改动需重启。实际取值会出现在 unified-enable 日志行与 storage 诊断块中。"
- key: sessions
type: object
default: "{} (all defaults)"
group: process
id: tt.sessions
site_group: proc
desc_en: "Session-table size cap and opt-in garbage collection."
desc_zh: "会话表容量上限与可选垃圾回收。"
site_en: "<code>sessions</code> — <span class='mech'>max 256 (LRU) · gc { enabled false, maxAgeDays 7, maxTokens 1000000, intervalMs 3600000 }</span> — GC is opt-in; user data is never pruned silently."
site_zh: "<code>sessions</code> —— <span class='mech'>max 256 (LRU) · gc { enabled false, maxAgeDays 7, maxTokens 1000000, intervalMs 3600000 }</span> —— GC 为可选:用户数据不会被悄悄清理。"
- key: sessions.max
type: number
default: "256"
env: BILI_MAX_SESSIONS
group: process
desc_en: "In-memory session table cap (LRU eviction of idle sessions)."
desc_zh: "内存会话表上限(空闲会话 LRU 逐出)。"
- key: sessions.warmMax
type: number
default: "0"
env: BILI_SESSION_WARM_MAX
group: process
desc_en: "Bounded startup (#2803/#3050): max most-recently-saved sessions hydrated at boot before listening; older state reloads on demand. Default 0 (no eager warm set — first touch pays one on-demand load; set 8 to restore the eager behavior). Capped by sessions.max."
desc_zh: "有界启动(#2803/#3050):启动监听前预热加载的最近保存会话数上限,更早的状态按需重新加载。默认 0(不预热——首次访问按需加载一次;设 8 恢复预热行为)。受 sessions.max 封顶。"
- key: sessions.warmMaxBytes
type: number
default: "67108864"
env: BILI_SESSION_WARM_MAX_BYTES
group: process
desc_en: "Decoded-byte budget for the boot warm set (#2803). Counts decoded size, not compressed on-disk bytes, so zstd archives cannot sneak past the RAM bound. A single file over the budget is never warmed."
desc_zh: "启动预热集的解码字节预算(#2803)。按解码后大小计而非磁盘压缩字节,zstd 归档无法绕过内存上限;单文件超预算则永不预热。"
- key: sessions.residentMaxBytes
type: number
default: "536870912"
env: BILI_SESSION_RESIDENT_MAX_BYTES
group: process
desc_en: "Soft target for estimated resident session bytes (#2803). Active/in-flight state stays pinned above it; when over target, idle state discharges back to disk as requests complete."
desc_zh: "驻留会话估算字节的软目标(#2803)。活跃/在途状态始终固定保留;超过目标时,空闲状态随请求完成回写磁盘释放。"
- key: sessions.gc.enabled
type: boolean
default: "false"
env: BILI_SESSION_GC
group: process
desc_en: "Opt-in garbage collection of stale persisted sessions (user data is never pruned silently without this flag)."
desc_zh: "过期持久化会话的可选垃圾回收(未开启时用户数据绝不被悄悄清理)。"
- key: sessions.gc.maxAgeDays
type: number
default: "7"
env: BILI_SESSION_GC_MAX_AGE_DAYS
group: process
desc_en: "GC age threshold in days."
desc_zh: "GC 年龄阈值(天)。"
- key: sessions.gc.maxTokens
type: number
default: "1000000"
env: BILI_SESSION_GC_MAX_TOKENS
group: process
desc_en: "GC token-size threshold per session record."
desc_zh: "GC 单会话记录的 token 大小阈值。"
- key: sessions.gc.intervalMs
type: number
default: "3600000"
env: BILI_SESSION_GC_INTERVAL_MS
group: process
desc_en: "GC sweep interval."
desc_zh: "GC 清扫间隔。"
- key: plugin.snapshotCapBytes
type: number
default: "104857600 (0 disables snapshots)"
env: BILI_PUBLIC_SNAPSHOT_CAP_BYTES
group: process
id: tt.snap
site_group: proc
desc_en: "Size cap for fork-API public snapshots served to native plugins."
desc_zh: "提供给原生插件的 fork API 公共快照大小上限。"
site_en: "<code>plugin.snapshotCapBytes</code> — fork API snapshot cap (default 100 MiB; 0 disables snapshots)."
site_zh: "<code>plugin.snapshotCapBytes</code> —— fork API 快照上限(默认 100 MiB;0 禁用快照)。"