diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d2fd01e2a2..0be531fb25 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -119,3 +119,30 @@ jobs: exit 1 fi echo "✓ kernel version discipline OK" + + # #2107 drift guard A: the config docs are generated from + # website/config-reference/*.yaml (single source). Regenerate and fail when + # the committed artifacts differ — a schema edit without re-running the + # generator goes red here. Zero-dep script: no npm install needed. + docs-sync: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: 22 + - run: node tools/gen-config-docs.mjs generate + - name: Fail on artifact drift + run: git diff --exit-code -- CONFIGURATION.md CONFIGURATION.zh-CN.md website/main.js website/docs/index.html + + # #2107 drift guard B: every BILI_*/ACP_* env var read in src/ and every + # FileConfig top-level key must have a seed entry — an undocumented param + # added to src goes red here with the missing names listed. + docs-coverage: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: 22 + - run: node tools/gen-config-docs.mjs check-coverage diff --git a/CONFIGURATION.md b/CONFIGURATION.md index c5d765fc7d..32ce8cde1c 100644 --- a/CONFIGURATION.md +++ b/CONFIGURATION.md @@ -59,6 +59,286 @@ The config file is a pure override layer — every field is optional. Anything u Status legend: **ACTIVE** = currently used | **DEPRECATED** = accepted but no effect | **EXPERIMENTAL** = may change + +This index is generated from `website/config-reference/*.yaml` — edit the seed, then run `node tools/gen-config-docs.mjs generate`; do not hand-edit this block. + +**Server & core** + +| Key | Type | Default | Env | Description | +|-----|------|---------|-----|-------------| +| `port` | number | 8787 | ACP_PORT, PORT | TCP port the proxy listens on (user zone; lane-spawned proxies use BILI_ZONE_PORT instead). | +| `host` | string | 127.0.0.1 | ACP_HOST | Bind address. 127.0.0.1 = loopback only; :: = dual-stack; 0.0.0.0 exposes outward (no auth — trusted networks only). | +| `sessionHeader` | string | x-acp-session | ACP_SESSION_HEADER | HTTP header carrying the conversation id; same value shares compression state. | +| `log` | boolean | true | ACP_LOG | Per-request logging master switch. | +| `logFile` | string | XDG state path (off disables the file, keeps stderr) | ACP_LOG_FILE | Explicit path for bili.log; auto-rotates at 10 MB. | +| `debug` | boolean | false | ACP_DEBUG | Verbose per-request logging. | +| `dumpSse` | string | unset (directory) | ACP_DUMP_SSE | Directory to dump raw SSE frames for debugging, including loop-originated responses. | +| `passthrough` | boolean | false | ACP_PASSTHROUGH | Global raw-relay switch: forward every request without compression, tool injection, or nudging. | + +**Upstream & billing** + +| Key | Type | Default | Env | Description | +|-----|------|---------|-----|-------------| +| `upstream` | string | https://api.anthropic.com | ACP_UPSTREAM | Fallback upstream base URL when a request matches no provider route. | +| `proxy` | string | unset (direct) | BILI_UPSTREAM_PROXY | Global outbound proxy for the proxy's own egress. Resolution: per-route → BILI_UPSTREAM_PROXY → Web UI → this value → HTTP(S)_PROXY → Windows system proxy → direct. Empty string = explicitly direct; SOCKS5 rejected. | +| `upstreamProxy` | string | unset | — | Web-UI manual proxy tier (written by the dashboard's proxy editor); sits below BILI_UPSTREAM_PROXY in resolution order. | +| `upstreamProxyMode` | "auto" \| "manual" \| "direct" | auto (unset behaves as direct) | BILI_UPSTREAM_PROXY_MODE | How the global proxy is sourced: auto (env/system discovery), manual (Web-UI value only), direct (never use a proxy). | +| `providers` | record url-prefix → route entry | {} | — | Route table: URL-prefix keys to per-provider entries (models, compress, compat, …). See the Providers section. | +| `modelContextLimit` | number | 200000 | ACP_MODEL_CONTEXT_LIMIT | Legacy global window ceiling (highest-priority window source and usage denominator); prefer compress.modelContextLimit. | +| `imageBilling` | "auto" \| "pixels" \| "bytes" | auto (resolves to pixels) | BILI_IMAGE_BILLING | Global image-token estimation basis; live-read per request, beats every per-provider setting. | +| `imageTokenCap` | number | unset (uncapped) | BILI_IMAGE_TOKEN_CAP | Global per-image token ceiling applied on top of the resolved billing mode; live-read per request. | + +**Behavior toggles** + +| Key | Type | Default | Env | Description | +|-----|------|---------|-----|-------------| +| `maskHosts` | boolean | true | BILI_LOG_MASK_HOSTS | Mask non-public target hosts in logs as ; credential headers are always masked regardless. | +| `subagentSplit` | boolean | true | BILI_SUBAGENT_SPLIT | Claude Code subagents get their own session namespace (\|sub:) instead of queueing behind the main session. | +| `forkAdoption` | boolean | false | BILI_FORK_ADOPTION | Anonymous forks inherit the parent's compression blocks whose source content is fully present in the forked request. | +| `resumeInheritance` | boolean | true | BILI_RESUME_INHERITANCE | Identified clients resuming under a new session id inherit the parent's ref assignments and fully-present compression blocks. | +| `chainContentDetection` | boolean | false | BILI_CHAIN_CONTENT | Body-content detection of bili→bili chains (off: body scanning can false-positive on CCR/model-echoed text); by default only x-bili-hop drives chain recognition. | +| `chainEgressStamp` | boolean | false | BILI_CHAIN_STAMP | Emit the model-visible checkpoint carrier on egress (off: models treat it as phantom input and burn tokens). | +| `stableSystemAnchor` | boolean | false | BILI_STABLE_SYSTEM_ANCHOR | Best-effort wire-layer prefix-cache anchor: re-sends the first-seen head system bytes even when the client changes them (plain-proxy lanes only). | +| `compat` | { roles?, dropFields?, streamErrorShape?, noCacheControl?, keepResponseId? } | {} (disabled) | — | Global wire-compat block: role remaps, strict-schema field drops, stream error shape, cache-control handling. | +| `compat.roles` | record role → role | {} | — | Map message roles to the names your upstream accepts (e.g. developer→system); exact-match roles only, per-provider entries win per key. | +| `compat.dropFields` | string[] (dot paths) | [] | — | Dot-path fields stripped from every forwarded body for strict-schema gateways that 400 on unknown fields; global + per-provider lists union additively. | +| `compat.streamErrorShape` | "protocol" \| "completion" | protocol | BILI_STREAM_ERROR_SHAPE | How upstream stream failures are presented after the 200 is committed: protocol-native error frames (default) or the legacy synthesized-completion shape. | +| `compat.noCacheControl` | boolean | false | BILI_NO_CACHE_CONTROL | Stop stamping Anthropic-lane cache_control breakpoints entirely (escape hatch for upstreams/relays with their own breakpoint policy). | +| `compat.keepResponseId` | boolean | false | ACP_KEEP_RESPONSE_ID | Preserve previous_response_id on kernel-rebuilt Responses requests (default strips it so rebuilt bodies never reference ids the upstream never issued). | +| `resign` | scheme → { enabled?, passthrough?, credentialRef? } | {} (armed; built-in scheme sdk-hmac-sha256) | BILI_RESIGN, BILI_RESIGN_PASSTHROUGH, BILI_CODEARTS_REF, BILI_RESIGN_BENEFIT | Re-sign arm keyed by Authorization scheme: signed model requests tunnel with every egress body re-signed; unresignable requests are refused locally 403 unless passthrough opts that scheme into verbatim forwarding. | +| `promptCache.routing` | "auto" \| "enabled" \| "disabled" | auto | ACP_PROMPT_CACHE_ROUTING | Prompt-cache routing posture for cache-aware lane selection. | +| `native.attachExternal` | boolean | false | BILI_NATIVE_ATTACH_EXTERNAL | Let launcher-less native plugins attach to an external (lane'd, unarmed) daemon instead of spawning their own. | +| `claude.nativePort` | number | unset (lane sticky zone port) | BILI_CLAUDE_NATIVE_PORT | Exact port pin for the claude native lane's hook-spawned proxy (strict-port: squatters are refused loudly). | + +**MITM lane** + +| Key | Type | Default | Env | Description | +|-----|------|---------|-----|-------------| +| `providersPath` | string | unset | ACP_PROVIDERS | Path to an external providers.json (legacy/shared routes file); beats both inline providers and the config-file location. | +| `mitm.enabled` | boolean | true | BILI_MITM | HTTPS interception switch for login clients that hard-code their upstream; domains are whitelisted on first sight. | +| `mitm.domains` | string[] | [] | BILI_MITM_DOMAINS | Explicit MITM whitelist domains (unioned with first-sight auto-whitelisting). | +| `mitm.handshakeTimeoutMs` | number | 10000 | BILI_MITM_HANDSHAKE_TIMEOUT_MS | TLS handshake timeout for intercepted connections. | + +**Process & persistence** + +| Key | Type | Default | Env | Description | +|-----|------|---------|-----|-------------| +| `network` | object | {} (all defaults) | — | Transport timeouts, watchdogs and replay policy for upstream calls. | +| `network.upstreamTimeoutMs` | number | 720000 | BILI_UPSTREAM_TIMEOUT_MS | Hard ceiling on a single upstream call (12 min covers slow deep-thinking models). | +| `network.requestWatchdogMs` | number | 2× upstreamTimeoutMs | BILI_REQUEST_WATCHDOG_MS | Absolute watchdog that force-aborts a stuck upstream socket even when the per-call timer was never armed. | +| `network.keepAliveTimeoutMs` | number | 5000 | BILI_KEEP_ALIVE_TIMEOUT_MS | Idle keep-alive timeout for pooled upstream sockets. | +| `network.clientErrorBackstopMs` | number | 30000 | BILI_CLIENT_ERROR_BACKSTOP_MS | Backstop that aborts a client connection that stops reading a committed response. | +| `network.exposureLogIntervalMs` | number | 3600000 (0 disables the log) | BILI_EXPOSURE_LOG_INTERVAL_MS | How often bound-address exposure warnings repeat in the log; 0 disables them entirely. | +| `network.streamKeepAliveMs` | number | 15000 (0 disables) | BILI_STREAM_KEEPALIVE_MS | Downstream stream keep-alive ping interval between model chunks; 0 disables pinging. | +| `network.preflightHoldMs` | number | 30000 | BILI_PREFLIGHT_HOLD_MS | How long a failed preflight holds before the request is allowed through unreconciled. | +| `network.preflightDeadEndCooldownMs` | number | 300000 | BILI_PREFLIGHT_DEAD_END_COOLDOWN_MS | Cooldown after a dead-end preflight before retrying reconciliation for the same session. | +| `network.replayRetryMax` | number | 3 (1 disables replays) | BILI_REPLAY_RETRY_MAX | Maximum transport-failure replays of an identical request before surfacing the error. | +| `network.replayRetryBaseMs` | number | 1500 (0 disables the delay) | BILI_REPLAY_RETRY_BASE_MS | Base backoff delay between replays (exponential). | +| `network.maxShrinkPerCompress` | number | unset | BILI_MAX_SHRINK_PER_COMPRESS | Cap on how much one compression may shrink history (anti-collapse guard). | +| `network.proxyKeepAliveMaxMs` | number | 55000 (0 = one-shot connections) | BILI_PROXY_KEEPALIVE_MAX_MS | Max lifetime of a connection through an outbound egress proxy before forcing reconnection (avoids stale NAT mappings). | +| `network.postResponseLingerMs` | number | 5000 | BILI_POST_RESPONSE_LINGER_MS | 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). | +| `persist` | object | {} (all defaults) | — | Session persistence to disk under the XDG state dir. | +| `persist.enabled` | boolean | true | BILI_PERSIST | Master switch for writing session records to disk (0/false turns it off). | +| `persist.zstd` | boolean | false | BILI_PERSIST_ZSTD | Zstd-compress persisted session files (1/true enables). | +| `persist.debounceMs` | number | 500 | BILI_PERSIST_DEBOUNCE_MS | Write debounce window for session files. | +| `persist.tailTokens` | number | 16384 (0 disables message persistence) | BILI_PERSIST_TAIL_TOKENS | Token-size tail of recent messages kept as raw text for export fidelity. | +| `persist.epermAlertThreshold` | number | 5 | BILI_PERSIST_EPERM_ALERT_THRESHOLD | Consecutive EPERM write failures before alerting in the log. | +| `persist.epermAlertRepeatMs` | number | 0 (no repeats) | BILI_PERSIST_EPERM_ALERT_REPEAT_MS | Repeat interval for the EPERM alert; 0 logs it once. | +| `sessions` | object | {} (all defaults) | — | Session-table size cap and opt-in garbage collection. | +| `sessions.max` | number | 256 | BILI_MAX_SESSIONS | In-memory session table cap (LRU eviction of idle sessions). | +| `sessions.gc.enabled` | boolean | false | BILI_SESSION_GC | Opt-in garbage collection of stale persisted sessions (user data is never pruned silently without this flag). | +| `sessions.gc.maxAgeDays` | number | 7 | BILI_SESSION_GC_MAX_AGE_DAYS | GC age threshold in days. | +| `sessions.gc.maxTokens` | number | 1000000 | BILI_SESSION_GC_MAX_TOKENS | GC token-size threshold per session record. | +| `sessions.gc.intervalMs` | number | 3600000 | BILI_SESSION_GC_INTERVAL_MS | GC sweep interval. | +| `plugin.snapshotCapBytes` | number | 16777216 (0 disables snapshots) | BILI_PUBLIC_SNAPSHOT_CAP_BYTES | Size cap for fork-API public snapshots served to native plugins. | + +**Updates & advisories** + +| Key | Type | Default | Env | Description | +|-----|------|---------|-----|-------------| +| `autoUpdate` | boolean | true | ACP_AUTO_UPDATE | Automatic npm version checks (every ~3 min); disable via ACP_AUTO_UPDATE=0 or --no-auto-update. | +| `autoRestartOnUpdate` | boolean | false | ACP_AUTO_RESTART_ON_UPDATE | Restart the daemon automatically once a newer version has been installed. | +| `updateTag` | string | latest | ACP_UPDATE_TAG | npm dist-tag channel for self-updates: latest (default), dev, or pr. | +| `update` | object | {} (all defaults) | — | Self-update channel settings. | +| `update.registry` | string | "npmjs" (registry.npmjs.org) | BILI_UPDATE_REGISTRY | Custom npm registry base URL for self-updates (private mirrors). | +| `update.checkIntervalMs` | number | 180000 | BILI_UPDATE_CHECK_INTERVAL_MS | Interval between npm registry version checks. | +| `advisoryCheck` | boolean | true | BILI_ADVISORY_CHECK | Critical-defect advisory watcher; force-installs the recommended fix when the running version is affected. | +| `advisoryUrl` | string | unset (built-in feed) | BILI_ADVISORY_URL | Override URL for the advisory feed. | +| `releaseNotesCheck` | boolean | true | BILI_RELEASE_NOTES_CHECK | Release-notes feed for the web panel (fetch + cache only; never installs anything). | +| `releaseNotesUrl` | string | unset (built-in feed) | BILI_RELEASE_NOTES_URL | Override URL for the release-notes feed. | + +**Diagnostics & tuning** + +| Key | Type | Default | Env | Description | +|-----|------|---------|-----|-------------| +| `diagnostics` | object | {} (all defaults) | — | Local troubleshooting knobs (dumps, render/injection toggles, count-tokens passthrough). | +| `diagnostics.dumpBody` | boolean | false | ACP_DUMP_BODY | Dump full request/response bodies to the log for troubleshooting. | +| `diagnostics.dumpReq` | boolean | true | ACP_DUMP_REQ | Log outgoing upstream request metadata per call. | +| `diagnostics.rawDumpDir` | string | /raw | ACP_RAW_DUMP_DIR | Directory for raw wire dumps. | +| `diagnostics.dump4xx` | boolean | false | BILI_DUMP_4XX | Persist upstream 4xx responses to disk for post-mortem inspection. | +| `diagnostics.dump4xxMaxBytes` | number | 2097152 (floor 1024) | BILI_DUMP_4XX_MAX_BYTES | Size cap for a single 4xx dump file. | +| `diagnostics.renderNone` | boolean | false | ACP_RENDER_NONE | Disable all ACP tag rendering (raw wire study mode). | +| `diagnostics.noInjectTool` | boolean | false | ACP_NO_INJECT_TOOL | Stop injecting the acp_compress tool definition into requests. | +| `diagnostics.noCompressPrompt` | boolean | false | ACP_NO_COMPRESS_PROMPT | Stop appending the compression doctrine to system prompts. | +| `diagnostics.countTokensPassthrough` | boolean | false | ACP_COUNT_TOKENS_PASSTHROUGH | Forward /v1/messages/count_tokens to the upstream instead of answering locally. | +| `diagnostics.compressProtocol` | "tools" \| "marker" | "tools" | ACP_COMPRESS_PROTOCOL | ACP injection surface for compression: native tools (default) or legacy prompt markers. | +| `fakeCompletion` | object | {} (all defaults) | — | Retry loop that re-requests when a final chunk arrives truncated. | +| `fakeCompletion.retries` | number | 0 (opt-in) | BILI_FAKE_COMPLETION_RETRIES | How many times a truncated final completion may be re-requested; 0 disables the loop. | +| `fakeCompletion.bufCapBytes` | number | 16777216 | BILI_FAKE_BUF_CAP | Buffer size cap for the retry loop's accumulated stream. | +| `codexCompact` | "intercept" \| "pass" | "intercept" | BILI_CODEX_COMPACT | Handle Codex /responses/compact inside bili (intercept, default) or forward it upstream (pass). | +| `ccrRetrievalTtlMs` | number | 600000 (0 disables retrieval) | BILI_CCR_RETRIEVAL_TTL_MS | Lifetime of CCR retrieval pointers before originals stop being fetchable via acp_retrieve. | +| `decompressTmpCap` | number | 50 | BILI_DECOMPRESS_TMP_CAP | Size cap (blocks) for temporary decompressed content held in-session. | + +**Compression (global level)** + +| Key | Type | Default | Env | Description | +|-----|------|---------|-----|-------------| +| `compress.modelContextLimit` | number \| "N%" | native window (model-declared) | — | Effective context window (tokens or N%): denominator of the usage ratio and a hard preflight wall; highest-priority window source. | +| `compress.maxContextLimit` | number \| "N%" | "75%" | — | Forced-compression nudge threshold: once history passes this share of the window the nudge fires immediately, bypassing growth gates. Not a hard cap. | +| `compress.emergencyThresholdPercent` | number \| % | "95%" | — | Emergency truncation of oversized tool outputs when history passes this share of the window (must be >= maxContextLimit). | +| `compress.outputHeadroomMaxPct` | number \| % | 0.25 | — | Cap on the share of the window reserved for output via max_tokens. | +| `compress.nudgeGrowthTokens` | number | 50000 (kernel flat cadence) | — | Growth gate: nudges fire only when a foldable range exceeds baseline growth by this many tokens (flat by design, independent of window size). | +| `compress.preserveRecentMessages` | number | kernel ≈5 | — | The most recent messages stay soft-protected from folds. | +| `compress.preserveRecentTokens` | number | kernel ≈5000 | — | The most recent tokens stay soft-protected from folds. | +| `compress.minCompressRangeChars` | number (deprecated alias: minCompressRange) | kernel ≈5000 | — | Smallest foldable range, in characters; shorter ranges never fold. | +| `compress.reconcile` | "off" \| "warn" \| "repair" | "repair" | BILI_FOLD_RECONCILE | Reconcile folded state when the client rewinds or rewrites history between turns. | +| `compress.promptPack` | string (builtin: "default", "lean") | builtin "default" | — | Compression prompt pack, resolved project pack → user pack → builtin; not gated by acknowledgePromptsRisk. | +| `compress.stripImagesKeepRecent` | number | 5 | — | With stripImages on, images inside the N newest messages are kept. | +| `compress.tiers` | boolean | true | — | Tiered T1→T3 distillation spreads folding cost across generations. | +| `compress.protectedTools` | string[] | none | — | Hard exclusion across all history: results of listed tools never fold. | +| `compress.protectedLatestTools` | string[] | none | — | Protects only the LATEST instance of cumulative-snapshot tools whose newest result supersedes older ones (e.g. todo lists). | +| `compress.neverPreserveRecentTools` | string[] ([] valid) | ["decompress", "search_context", "read", "bash"] (kernel) | — | Excluded from the recent protection zone (immediately compressible); an empty array excludes nothing (maximum protection). | +| `compress.preserveRecentTools` | string[] | n/a (subtraction form) | — | Subtraction form: recent-zone tools minus this list get full protection; an empty array here is rejected as a typo. | +| `compress.stripImages` | boolean | false | — | Strip image payloads from foldable history. | +| `compress.visibilityMarkers` | boolean | true | — | Append visibility markers after compress/decompress/search_context/acp_status results; off stops imitated narration. | +| `compress.rules` | boolean | false | — | Persistent model reminders delivered through an injected acp_rule tool, hard-protected from folds; pi/omp expose an /acp-rule command. | +| `compress.injectTool` | boolean | true | ACP_COMPRESS_TOOL | Register the acp_compress tool for clients (global level only). | +| `compress.injectNudge` | boolean | true | ACP_COMPRESS_NUDGE | Send growth nudges as the window fills (global level only). | +| `compress.reasoning` | { drop?, threshold? } | drop true · threshold 2048 | — | Drop finished-round reasoning runs longer than 2048 chars (drop: true by default); strict-reasoning upstreams need drop:false. | +| `compress.absorb` | object | opt-in (disabled) | — | Opt-in instant distillation of large tool results into short abstracts; originals go to the content store. | +| `compress.ccr` | object | enabled in proxy mode since v2 | — | Content cache & retrieve: large outputs stored losslessly beside the session, replaced by head excerpt + pointer fetched back via acp_retrieve; no cap or eviction. | +| `compress.search.planAware` | boolean | false | — | When on, search_context candidates are re-ranked against current plan state; off keeps byte-identical lexical results. | +| `compress.imageCompression` | object | opt-in (disabled) | — | Opt-in lossy downscale via optional sharp before sending; image_full restores originals; proxy mode only. | +| `compress.prompts` | Partial | unset (kernel doctrine) | — | Override the kernel doctrine texts; load-bearing for quality — gated behind acknowledgePromptsRisk. | +| `compress.reasoningGuard` | object | off | — | Auto-repair of reasoning-lattice truncation on gpt-5.x/6.x (up to 3 continue-nudge rounds). | +| `compress.outputSteering` | object { enabled?, verbosityLevel?, effortRouting? } | enabled false · verbosityLevel 2 | — | Appends a conciseness directive to the system-prompt tail; clamps mechanical continuation requests. | +| `compress.priceProfile` | { w?, r?, q? } | unset (registry, kernel fallback {1, 0.1, 4}) | — | w/r/q ratios normalized to the input price (write/cache-read/output); report-only — never affects triggers or the wire. | +| `compress.acknowledgePromptsRisk` | boolean | false | — | Must be true before custom prompts take effect. | +| `compress.absorb.enabled` | boolean | false | — | Enable the absorb distillation block. | +| `compress.absorb.minToolTokens` | number | 1000 | — | Minimum estimated token size of a tool result eligible for absorption. | +| `compress.absorb.contextThresholdPct` | number \| % | unset | — | Only absorb when context usage passes this share of the window. | +| `compress.absorb.excludeTools` | string[] | [] | — | Tool names excluded from absorption. | +| `compress.absorb.toolName` | string | "absorb" | — | Registered name of the absorb tool. | +| `compress.ccr.enabled` | boolean | true (proxy mode) | — | Enable the content-cache-and-retrieve block. | +| `compress.ccr.minToolTokens` | number | ≈4000 | — | Minimum estimated token size of a tool result eligible for CCR storage. | +| `compress.ccr.excludeTools` | string[] | [] | — | Tool names excluded from CCR storage. | +| `compress.ccr.toolName` | string | "acp_retrieve" | — | Registered name of the retrieval tool. | +| `compress.ccr.maxHeadChars` | number | 96 | — | Maximum head-excerpt length left inline at the storage pointer. | +| `compress.imageCompression.enabled` | boolean | false | — | Enable lossy image downscaling (requires the optional sharp dependency). | +| `compress.imageCompression.minTokens` | number | 512 | — | Only downscale images whose counted tokens exceed this. | +| `compress.imageCompression.maxDimension` | number | 1280 | — | Largest output dimension after downscaling. | +| `compress.imageCompression.quality` | number | 80 | — | Encoder quality (1–100). | +| `compress.imageCompression.format` | string | "webp" | — | Output image format. | +| `compress.prompts.compressPhilosophy` | string | unset (kernel text) | — | Override of the compression philosophy doctrine paragraph. | +| `compress.prompts.howToCompressRules` | string | unset (kernel text) | — | Override of the compression how-to rules. | +| `compress.prompts.tier2DistillRules` | string | unset (kernel text) | — | Override of the tier-2 distillation rules. | +| `compress.prompts.tier3CondenseRules` | string | unset (kernel text) | — | Override of the tier-3 condensation rules. | +| `compress.reasoningGuard.enabled` | boolean | false | — | Enable reasoning-lattice auto-repair. | +| `compress.reasoningGuard.maxContinue` | number | 3 | — | Maximum continue-nudge rounds per truncation. | +| `compress.reasoningGuard.maxTierN` | number | (built-in) | — | Upper bound on the repaired lattice tier index. | +| `compress.reasoningGuard.markerText` | string | "Continue thinking..." | — | Marker text that signals a truncated reasoning lattice. | +| `compress.reasoningGuard.base` | number | (built-in) | — | Base offset parameter of the repair lattice. | +| `compress.reasoningGuard.offset` | number | (built-in) | — | Offset step parameter of the repair lattice. | +| `compress.reasoningGuard.debugLog` | boolean | false | — | Verbose logging for the repair loop. | +| `compress.outputSteering.enabled` | boolean | false | — | Enable the conciseness directive appended to the system-prompt tail. | +| `compress.outputSteering.verbosityLevel` | number (0–4) | 2 | — | Target verbosity level for the directive. | +| `compress.outputSteering.effortRouting` | boolean | (built-in) | — | Route effort hints alongside the directive. | +| `compress.priceProfile.w` | number | unset (registry) | — | Write-price ratio relative to the input price. | +| `compress.priceProfile.r` | number | unset (registry) | — | Cache-read price ratio relative to the input price. | +| `compress.priceProfile.q` | number | unset (registry) | — | Output price ratio relative to the input price. | +| `compress.reasoning.drop` | boolean | true | — | Drop finished-round reasoning runs longer than the threshold. | +| `compress.reasoning.threshold` | number | 2048 | — | Character threshold above which finished reasoning runs are dropped. | +| `compress.minCompressRange` | number | same as minCompressRangeChars | — | Deprecated alias of minCompressRangeChars (accepted, mapped onto it). _(deprecated)_ | + +**Provider route fields** + +| Key | Type | Default | Env | Description | +|-----|------|---------|-----|-------------| +| `models` | record name → { context?, output?, compress?, benefit? } | {} | — | Per-model declarations: context window, output ceiling, per-model compression overrides; not a traffic filter. | +| `models.context` | number | unset (model registry) | — | Context window tokens declared for this model name. | +| `models.output` | number | unset | — | Output token ceiling declared for this model name. | +| `models.compress` | object | unset | — | Level-3 compression overrides for this model (deepest in the global→provider→model merge). | +| `models.benefit` | boolean | false | — | Marks free-quota billing for this model in the economics ledger. | +| `proxy` | string ("" = explicit direct) | unset | — | Per-route outbound proxy URL. | +| `compressProtocol` | "tools" (default) \| "marker" | "tools" | — | Which ACP injection surface this lane speaks. | +| `protocol` | "anthropic" \| "openai" \| "responses" \| "google" | inferred from the URL marker | — | Declare this lane's wire protocol; a client-side /bili// URL marker outranks the declaration. | +| `compress` | object (level 2) | unset | — | Any compress field can be overridden here — level 2 of the global→provider→model merge. | +| `compat` | { roles?, dropFields? } | {} | — | Per-route wire-compat overrides; provider entries beat the global block per key; dropFields union additively. | +| `direct` | boolean | false | — | Client-side exemption: traffic for this upstream is never pointed at bili at all. | +| `passthrough` | boolean | false | — | Route-scoped byte-for-byte relay with no session state — for anti-fraud upstreams. | +| `imageBilling` | "auto" \| "pixels" \| "bytes" | auto (→ pixels) | — | Image-token counting basis for this route; bytes is an explicit opt-in for byte relays. | +| `imageTokenCap` | number | unset (uncapped) | — | Per-image token cost cap for this route. | +| `resign` | scheme → { enabled?, passthrough?, credentialRef? } | {} (global map applies) | — | Per-route overrides of the global resign map (level 2, deepest wins). | +| `bind` | string (named entries only) | unset | — | Deep-merge a named (non-URL) entry onto the bound URL lane as an alias; without bind a named entry stays routing-inert. | +| `compactionOptIn` | boolean | false | BILI_NON_HTTP_PROVIDERS | Named entries only: opt a non-http(s)-baseUrl provider into compaction ownership (pi/omp lanes); unions with env BILI_NON_HTTP_PROVIDERS. | + +**Environment-only variables** + +| Key | Type | Default | Env | Description | +|-----|------|---------|-----|-------------| +| `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). | +| `BILI_TUNNEL_ALLOWED_HOSTS` | string[] (csv) | unset | — | Host allowlist for the MITM tunnel lane. | +| `BILI_RECLAIM_FETCH_PATCH` | boolean-ish | on | — | Toggle for reclaiming the global fetch patch on shutdown. | +| `BILI_CONFLICT_SCAN` | boolean-ish | off | — | Enable the install-lane conflict scanner probe. | +| `BILI_CHAIN_MAX_FUTURE_SKEW_MS` | number | (built-in) | — | Tolerance for future-skewed chain checkpoint timestamps. | +| `BILI_CHAIN_RECENT_WINDOW_MS` | number | (built-in) | — | Recent-window size for chain checkpoint validation. | +| `BILI_ZONE_PORT` | number | 18787 base (derived per lane) | — | Base port for lane-spawned proxy zones (port relocation). | +| `BILI_ZCODE_ROUTE` | string | unset | — | Route selection for the zcode lane. | +| `BILI_ZCODE_PORT` | number | unset | — | Port pin for the zcode lane. | +| `BILI_ZCODE_SIGNING_FIXED` | boolean-ish | off | — | Fixed-signing mode for the zcode credential lane. | +| `BILI_CLAUDE_UPSTREAM` | string | unset | — | Upstream pin for the claude lane. | +| `BILI_ATTACH_HEALTH_DEADLINE_MS` | number | (built-in) | — | Deadline for attach health checks when joining an external daemon. | +| `BILI_ATTACH_EVIDENCE_GRACE_MS` | number | (built-in) | — | Grace period for attach ownership evidence. | +| `BILI_PROVIDER_REWRITES` | string | unset | — | Provider URL rewrite rules applied before routing. | +| `BILI_MCP_PROXY` | string | unset | — | Spawn channel: MCP proxy target for plugin-hosted tools. | +| `BILI_PARENT_PID` | number | unset | — | Spawn channel: parent process id for lifecycle supervision. | +| `BILI_STRICT_PORT` | number | unset | — | Spawn channel: exact-port requirement (squatters refused loudly instead of hopping). | +| `BILI_OPENCODE_ACP_SPEC` | string | unset | — | Spawn channel: ACP spec marker for opencode-native lanes. | +| `BILI_LAUNCHER_MODEL_WINDOWS` | string | unset | — | Launcher channel: model-window overrides passed into spawned clients. | +| `BILI_LAUNCHER_LANE` | string | unset | — | Launcher channel: lane identity of the spawning bili process. | +| `BILI_LAUNCHER_PLUGIN` | string | unset | — | Launcher channel: plugin-mode handoff marker. | +| `BILI_LAUNCHER_DIRECT` | boolean-ish | off | — | Launcher channel: bypass the injected proxy for this launch. | +| `BILI_INHERITED_HTTP_PROXY` | string | unset | — | Launcher channel: inherited http_proxy value preserved across the spawn boundary. | +| `BILI_INHERITED_HTTPS_PROXY` | string | unset | — | Launcher channel: inherited https_proxy value preserved across the spawn boundary. | +| `BILI_INHERITED_ALL_PROXY` | string | unset | — | Launcher channel: inherited all_proxy value preserved across the spawn boundary. | +| `BILI_INHERITED_NO_PROXY` | string | unset | — | Launcher channel: inherited no_proxy value preserved across the spawn boundary. | +| `BILI_NATIVE_CLAUDE` | boolean-ish | off | — | Host posture: marks a claude-native plugin process. | +| `BILI_NATIVE_DSH` | boolean-ish | off | — | Host posture: marks a dsh-native plugin process. | +| `BILI_NATIVE_KIMI` | boolean-ish | off | — | Host posture: marks a kimi-native plugin process. | +| `BILI_NATIVE_OMP` | boolean-ish | off | — | Host posture: marks an omp-native plugin process. | +| `BILI_NATIVE_OPENCODE` | boolean-ish | off | — | Host posture: marks an opencode-native plugin process. | +| `BILI_NATIVE_PI` | boolean-ish | off | — | Host posture: marks a pi-native plugin process. | +| `BILI_NATIVE_ZCODE` | boolean-ish | off | — | Host posture: marks a zcode-native plugin process. | +| `BILI_PI_BIN` | string | pi (PATH lookup) | — | Host posture: explicit binary path for the pi client binary. | +| `BILI_DSH_BIN` | string | dsh (PATH lookup) | — | Host posture: explicit binary path for the dsh client binary. | +| `BILI_MODEL_INFO_RETRY_MS` | number | (built-in) | — | Test hook: retry interval for model-info lookups. | +| `BILI_DSH_RETRY_INTERVAL_MS` | number | (built-in) | — | Test hook: retry interval for dsh lane operations. | +| `BILI_DSH_RECOVERY_INTERVAL_MS` | number | (built-in) | — | Test hook: recovery sweep interval for the dsh lane. | +| `ACP_DUMP_DIR` | string | unset | — | Base directory override for wire dump output (path relocation). | +| `BILI_STREAM_STALL_MS` | number | (built-in) | — | Stall-detection timeout for committed upstream streams (no-byte silence before abort). | +| `BILI_CLIENT_BIN` | string | unset (PATH lookup) | — | Explicit binary override for the launched client (resolved on PATH). | +| `BILI_CONVERSATION_ID` | string | unset (per-spawn UUID written by bili) | — | Per-spawn conversation UUID handed to MCP children whose host passes no session id (headless self-registration). | +| `BILI_LAUNCHER_MODEL_MAX_OUTPUTS` | string (JSON id→maxOutput map) | unset | — | Launcher channel: per-model max-output map handed to the spawned proxy for output-headroom reservation. | +| `BILI_LAUNCH_TOKEN` | string | unset (generated per launch) | — | Launch token authenticating lane-internal endpoints between a launcher and its spawned proxy (secret). | +| `BILI_MCP_DEFAULT_ORIGIN` | string | http://127.0.0.1:8787 | — | Fallback proxy origin candidate for MCP entry points. | +| `BILI_MCP_NO_ORPHAN_ADOPT` | boolean-ish | off (=1 disables orphan adoption) | — | Opt out of resumed-session orphan adoption when several host sessions share one proxy. | +| `BILI_MITM_HOSTS` | string[] (csv) | unset | — | Launcher channel: MITM whitelist hosts handed to the spawned proxy (distinct from the config-file twin BILI_MITM_DOMAINS). | +| `BILI_PLUGIN_AGENT` | boolean-ish | off | — | Spawn channel: marks a plugin-agent process. | + + + --- ## Server Settings @@ -1099,53 +1379,99 @@ Environment variables take precedence over the config file. They are useful for File keys resolve only when the matching env var is unset. Defaults in parentheses are the built-ins. + | Env var | Config key | Default | -|---------|------------|---------| -| `BILI_UPSTREAM_TIMEOUT_MS` | `network.upstreamTimeoutMs` | `720000` | -| `BILI_REQUEST_WATCHDOG_MS` | `network.requestWatchdogMs` | `2×` upstream timeout | -| `BILI_REPLAY_RETRY_MAX` | `network.replayRetryMax` | `3` | -| `BILI_REPLAY_RETRY_BASE_MS` | `network.replayRetryBaseMs` | `1500` | -| `BILI_MAX_SHRINK_PER_COMPRESS` | `network.maxShrinkPerCompress` | unset (no steering) | -| `BILI_KEEP_ALIVE_TIMEOUT_MS` | `network.keepAliveTimeoutMs` | `5000` | -| `BILI_CLIENT_ERROR_BACKSTOP_MS` | `network.clientErrorBackstopMs` | `30000` | -| `BILI_EXPOSURE_LOG_INTERVAL_MS` | `network.exposureLogIntervalMs` | `3600000` | -| `BILI_STREAM_KEEPALIVE_MS` | `network.streamKeepAliveMs` | `15000` | -| `BILI_PREFLIGHT_HOLD_MS` | `network.preflightHoldMs` | `30000` | -| `BILI_PREFLIGHT_DEAD_END_COOLDOWN_MS` | `network.preflightDeadEndCooldownMs` | `300000` | -| `BILI_PROXY_KEEPALIVE_MAX_MS` | `network.proxyKeepAliveMaxMs` | `55000` | -| `BILI_POST_RESPONSE_LINGER_MS` | `network.postResponseLingerMs` | `5000` | -| `BILI_MITM_HANDSHAKE_TIMEOUT_MS` | `mitm.handshakeTimeoutMs` | `10000` | -| `BILI_PERSIST` | `persist.enabled` | `true` | -| `BILI_PERSIST_ZSTD` | `persist.zstd` | `false` | -| `BILI_PERSIST_DEBOUNCE_MS` | `persist.debounceMs` | `500` | -| `BILI_PERSIST_TAIL_TOKENS` | `persist.tailTokens` | `16384` | -| `BILI_PERSIST_EPERM_ALERT_THRESHOLD` | `persist.epermAlertThreshold` | `5` | -| `BILI_PERSIST_EPERM_ALERT_REPEAT_MS` | `persist.epermAlertRepeatMs` | `0` | -| `BILI_MAX_SESSIONS` | `sessions.max` | `256` | -| `BILI_SESSION_GC` | `sessions.gc.enabled` | `false` | -| `BILI_SESSION_GC_MAX_AGE_DAYS` | `sessions.gc.maxAgeDays` | `7` | -| `BILI_SESSION_GC_MAX_TOKENS` | `sessions.gc.maxTokens` | `1000000` | -| `BILI_SESSION_GC_INTERVAL_MS` | `sessions.gc.intervalMs` | `3600000` | -| `BILI_PUBLIC_SNAPSHOT_CAP_BYTES` | `plugin.snapshotCapBytes` | `16777216` | -| `BILI_UPDATE_REGISTRY` | `update.registry` | npm public registry | -| `BILI_UPDATE_CHECK_INTERVAL_MS` | `update.checkIntervalMs` | `180000` | -| `BILI_CCR_RETRIEVAL_TTL_MS` | `ccrRetrievalTtlMs` | `600000` | -| `BILI_CODEX_COMPACT` | `codexCompact` | `"intercept"` | -| `BILI_DECOMPRESS_TMP_CAP` | `decompressTmpCap` | `50` | -| `ACP_DUMP_BODY` | `diagnostics.dumpBody` | `false` | -| `ACP_DUMP_REQ` | `diagnostics.dumpReq` | `true` | -| `ACP_RAW_DUMP_DIR` | `diagnostics.rawDumpDir` | `/raw` | -| `BILI_DUMP_4XX` | `diagnostics.dump4xx` | `false` | -| `BILI_DUMP_4XX_MAX_BYTES` | `diagnostics.dump4xxMaxBytes` | `2097152` | -| `ACP_RENDER_NONE` | `diagnostics.renderNone` | `false` | -| `ACP_NO_INJECT_TOOL` | `diagnostics.noInjectTool` | `false` | -| `ACP_NO_COMPRESS_PROMPT` | `diagnostics.noCompressPrompt` | `false` | -| `ACP_COUNT_TOKENS_PASSTHROUGH` | `diagnostics.countTokensPassthrough` | `false` | -| `ACP_COMPRESS_PROTOCOL` | `diagnostics.compressProtocol` | `"tools"` | -| `ACP_KEEP_RESPONSE_ID` | `compat.keepResponseId` | `false` | -| `BILI_NO_CACHE_CONTROL` | `compat.noCacheControl` | `false` | -| `BILI_FAKE_COMPLETION_RETRIES` | `fakeCompletion.retries` | `0` | -| `BILI_FAKE_BUF_CAP` | `fakeCompletion.bufCapBytes` | `16777216` | +|---------|------------|--------| +| `ACP_AUTO_RESTART_ON_UPDATE` | `autoRestartOnUpdate` | false | +| `ACP_AUTO_UPDATE` | `autoUpdate` | true | +| `ACP_COMPRESS_NUDGE` | `compress.injectNudge` | true | +| `ACP_COMPRESS_PROTOCOL` | `diagnostics.compressProtocol` | "tools" | +| `ACP_COMPRESS_TOOL` | `compress.injectTool` | true | +| `ACP_COUNT_TOKENS_PASSTHROUGH` | `diagnostics.countTokensPassthrough` | false | +| `ACP_DEBUG` | `debug` | false | +| `ACP_DUMP_BODY` | `diagnostics.dumpBody` | false | +| `ACP_DUMP_REQ` | `diagnostics.dumpReq` | true | +| `ACP_DUMP_SSE` | `dumpSse` | unset (directory) | +| `ACP_HOST` | `host` | 127.0.0.1 | +| `ACP_KEEP_RESPONSE_ID` | `compat.keepResponseId` | false | +| `ACP_LOG` | `log` | true | +| `ACP_LOG_FILE` | `logFile` | XDG state path (off disables the file, keeps stderr) | +| `ACP_MODEL_CONTEXT_LIMIT` | `modelContextLimit` | 200000 | +| `ACP_NO_COMPRESS_PROMPT` | `diagnostics.noCompressPrompt` | false | +| `ACP_NO_INJECT_TOOL` | `diagnostics.noInjectTool` | false | +| `ACP_PASSTHROUGH` | `passthrough` | false | +| `ACP_PORT` | `port` | 8787 | +| `ACP_PROMPT_CACHE_ROUTING` | `promptCache.routing` | auto | +| `ACP_PROVIDERS` | `providersPath` | unset | +| `ACP_RAW_DUMP_DIR` | `diagnostics.rawDumpDir` | /raw | +| `ACP_RENDER_NONE` | `diagnostics.renderNone` | false | +| `ACP_SESSION_HEADER` | `sessionHeader` | x-acp-session | +| `ACP_UPDATE_TAG` | `updateTag` | latest | +| `ACP_UPSTREAM` | `upstream` | https://api.anthropic.com | +| `BILI_ADVISORY_CHECK` | `advisoryCheck` | true | +| `BILI_ADVISORY_URL` | `advisoryUrl` | unset (built-in feed) | +| `BILI_CCR_RETRIEVAL_TTL_MS` | `ccrRetrievalTtlMs` | 600000 (0 disables retrieval) | +| `BILI_CHAIN_CONTENT` | `chainContentDetection` | false | +| `BILI_CHAIN_STAMP` | `chainEgressStamp` | false | +| `BILI_CLAUDE_NATIVE_PORT` | `claude.nativePort` | unset (lane sticky zone port) | +| `BILI_CLIENT_ERROR_BACKSTOP_MS` | `network.clientErrorBackstopMs` | 30000 | +| `BILI_CODEARTS_REF` | `resign` | {} (armed; built-in scheme sdk-hmac-sha256) | +| `BILI_CODEX_COMPACT` | `codexCompact` | "intercept" | +| `BILI_DECOMPRESS_TMP_CAP` | `decompressTmpCap` | 50 | +| `BILI_DUMP_4XX` | `diagnostics.dump4xx` | false | +| `BILI_DUMP_4XX_MAX_BYTES` | `diagnostics.dump4xxMaxBytes` | 2097152 (floor 1024) | +| `BILI_EXPOSURE_LOG_INTERVAL_MS` | `network.exposureLogIntervalMs` | 3600000 (0 disables the log) | +| `BILI_FAKE_BUF_CAP` | `fakeCompletion.bufCapBytes` | 16777216 | +| `BILI_FAKE_COMPLETION_RETRIES` | `fakeCompletion.retries` | 0 (opt-in) | +| `BILI_FOLD_RECONCILE` | `compress.reconcile` | "repair" | +| `BILI_FORK_ADOPTION` | `forkAdoption` | false | +| `BILI_IMAGE_BILLING` | `imageBilling` | auto (resolves to pixels) | +| `BILI_IMAGE_TOKEN_CAP` | `imageTokenCap` | unset (uncapped) | +| `BILI_KEEP_ALIVE_TIMEOUT_MS` | `network.keepAliveTimeoutMs` | 5000 | +| `BILI_LOG_MASK_HOSTS` | `maskHosts` | true | +| `BILI_MAX_SESSIONS` | `sessions.max` | 256 | +| `BILI_MAX_SHRINK_PER_COMPRESS` | `network.maxShrinkPerCompress` | unset | +| `BILI_MITM` | `mitm.enabled` | true | +| `BILI_MITM_DOMAINS` | `mitm.domains` | [] | +| `BILI_MITM_HANDSHAKE_TIMEOUT_MS` | `mitm.handshakeTimeoutMs` | 10000 | +| `BILI_NATIVE_ATTACH_EXTERNAL` | `native.attachExternal` | false | +| `BILI_NON_HTTP_PROVIDERS` | `compactionOptIn` | false | +| `BILI_NO_CACHE_CONTROL` | `compat.noCacheControl` | false | +| `BILI_PERSIST` | `persist.enabled` | true | +| `BILI_PERSIST_DEBOUNCE_MS` | `persist.debounceMs` | 500 | +| `BILI_PERSIST_EPERM_ALERT_REPEAT_MS` | `persist.epermAlertRepeatMs` | 0 (no repeats) | +| `BILI_PERSIST_EPERM_ALERT_THRESHOLD` | `persist.epermAlertThreshold` | 5 | +| `BILI_PERSIST_TAIL_TOKENS` | `persist.tailTokens` | 16384 (0 disables message persistence) | +| `BILI_PERSIST_ZSTD` | `persist.zstd` | false | +| `BILI_POST_RESPONSE_LINGER_MS` | `network.postResponseLingerMs` | 5000 | +| `BILI_PREFLIGHT_DEAD_END_COOLDOWN_MS` | `network.preflightDeadEndCooldownMs` | 300000 | +| `BILI_PREFLIGHT_HOLD_MS` | `network.preflightHoldMs` | 30000 | +| `BILI_PROXY_KEEPALIVE_MAX_MS` | `network.proxyKeepAliveMaxMs` | 55000 (0 = one-shot connections) | +| `BILI_PUBLIC_SNAPSHOT_CAP_BYTES` | `plugin.snapshotCapBytes` | 16777216 (0 disables snapshots) | +| `BILI_RELEASE_NOTES_CHECK` | `releaseNotesCheck` | true | +| `BILI_RELEASE_NOTES_URL` | `releaseNotesUrl` | unset (built-in feed) | +| `BILI_REPLAY_RETRY_BASE_MS` | `network.replayRetryBaseMs` | 1500 (0 disables the delay) | +| `BILI_REPLAY_RETRY_MAX` | `network.replayRetryMax` | 3 (1 disables replays) | +| `BILI_REQUEST_WATCHDOG_MS` | `network.requestWatchdogMs` | 2× upstreamTimeoutMs | +| `BILI_RESIGN` | `resign` | {} (armed; built-in scheme sdk-hmac-sha256) | +| `BILI_RESIGN_BENEFIT` | `resign` | {} (armed; built-in scheme sdk-hmac-sha256) | +| `BILI_RESIGN_PASSTHROUGH` | `resign` | {} (armed; built-in scheme sdk-hmac-sha256) | +| `BILI_RESUME_INHERITANCE` | `resumeInheritance` | true | +| `BILI_SESSION_GC` | `sessions.gc.enabled` | false | +| `BILI_SESSION_GC_INTERVAL_MS` | `sessions.gc.intervalMs` | 3600000 | +| `BILI_SESSION_GC_MAX_AGE_DAYS` | `sessions.gc.maxAgeDays` | 7 | +| `BILI_SESSION_GC_MAX_TOKENS` | `sessions.gc.maxTokens` | 1000000 | +| `BILI_STABLE_SYSTEM_ANCHOR` | `stableSystemAnchor` | false | +| `BILI_STREAM_ERROR_SHAPE` | `compat.streamErrorShape` | protocol | +| `BILI_STREAM_KEEPALIVE_MS` | `network.streamKeepAliveMs` | 15000 (0 disables) | +| `BILI_SUBAGENT_SPLIT` | `subagentSplit` | true | +| `BILI_UPDATE_CHECK_INTERVAL_MS` | `update.checkIntervalMs` | 180000 | +| `BILI_UPDATE_REGISTRY` | `update.registry` | "npmjs" (registry.npmjs.org) | +| `BILI_UPSTREAM_PROXY` | `proxy` | unset (direct) | +| `BILI_UPSTREAM_PROXY_MODE` | `upstreamProxyMode` | auto (unset behaves as direct) | +| `BILI_UPSTREAM_TIMEOUT_MS` | `network.upstreamTimeoutMs` | 720000 | +| `PORT` | `port` | 8787 | + | Variable | Effect | |----------|--------| diff --git a/CONFIGURATION.zh-CN.md b/CONFIGURATION.zh-CN.md index a562628a3f..ca81160819 100644 --- a/CONFIGURATION.zh-CN.md +++ b/CONFIGURATION.zh-CN.md @@ -59,6 +59,286 @@ 状态说明:**ACTIVE(启用)** = 当前生效 | **DEPRECATED(已弃用)** = 接受但无效果 | **EXPERIMENTAL(实验性)** = 可能变更 + +以下索引由 `website/config-reference/*.yaml` 生成——改种子后运行 `node tools/gen-config-docs.mjs generate`,不要手改本区块。 + +**服务与核心** + +| Key | Type | Default | Env | Description | +|-----|------|---------|-----|-------------| +| `port` | number | 8787 | ACP_PORT, PORT | 代理监听端口(用户区;车道派生代理使用 BILI_ZONE_PORT,互不干扰)。 | +| `host` | string | 127.0.0.1 | ACP_HOST | 绑定地址。127.0.0.1 仅本机回环;:: 双栈;0.0.0.0 对外暴露(无鉴权,仅限可信网络)。 | +| `sessionHeader` | string | x-acp-session | ACP_SESSION_HEADER | 携带会话 id 的请求头;相同取值的请求共享压缩状态。 | +| `log` | boolean | true | ACP_LOG | 逐请求日志总开关。 | +| `logFile` | string | XDG state path (off disables the file, keeps stderr) | ACP_LOG_FILE | bili.log 的显式路径;10 MB 自动轮转。 | +| `debug` | boolean | false | ACP_DEBUG | 逐请求详细日志。 | +| `dumpSse` | string | unset (directory) | ACP_DUMP_SSE | 原始 SSE 帧转储目录(排障用),含循环内发起的上游响应。 | +| `passthrough` | boolean | false | ACP_PASSTHROUGH | 全局裸转发开关:所有请求不做压缩、工具注入或提醒直接转发。 | + +**上游与计费** + +| Key | Type | Default | Env | Description | +|-----|------|---------|-----|-------------| +| `upstream` | string | https://api.anthropic.com | ACP_UPSTREAM | 请求未命中任何路由时的兜底上游基础地址。 | +| `proxy` | string | unset (direct) | BILI_UPSTREAM_PROXY | 代理自身出站的全局代理。解析顺序:按路由 → BILI_UPSTREAM_PROXY → Web UI → 本值 → HTTP(S)_PROXY 环境变量 → Windows 系统代理 → 直连。空字符串 = 显式直连;不支持 SOCKS5。 | +| `upstreamProxy` | string | unset | — | Web 面板手动设置的代理层级(由仪表盘代理编辑器写入);解析顺序中位于 BILI_UPSTREAM_PROXY 之下。 | +| `upstreamProxyMode` | "auto" \| "manual" \| "direct" | auto (unset behaves as direct) | BILI_UPSTREAM_PROXY_MODE | 全局代理来源策略:auto(环境变量/系统发现)、manual(仅 Web 面板值)、direct(从不使用代理)。 | +| `providers` | record url-prefix → route entry | {} | — | 路由表:URL 前缀键到逐 provider 条目(models、compress、compat…)的映射。详见 Providers 章节。 | +| `modelContextLimit` | number | 200000 | ACP_MODEL_CONTEXT_LIMIT | 旧版全局窗口上限(窗口来源中优先级最高,兼作使用率分母);建议改用 compress.modelContextLimit。 | +| `imageBilling` | "auto" \| "pixels" \| "bytes" | auto (resolves to pixels) | BILI_IMAGE_BILLING | 全局图片 token 估算口径;逐请求实时读取,优先于所有逐 provider 设置。 | +| `imageTokenCap` | number | unset (uncapped) | BILI_IMAGE_TOKEN_CAP | 全局单图 token 上限,叠加在计费口径之上生效;逐请求实时读取。 | + +**行为开关** + +| Key | Type | Default | Env | Description | +|-----|------|---------|-----|-------------| +| `maskHosts` | boolean | true | BILI_LOG_MASK_HOSTS | 日志中把非公开目标主机遮成 ;凭据头无论此开关如何总是遮盖。 | +| `subagentSplit` | boolean | true | BILI_SUBAGENT_SPLIT | Claude 子代理拥有独立会话命名空间(\|sub:),不再排队在主会话锁后。 | +| `forkAdoption` | boolean | false | BILI_FORK_ADOPTION | 匿名 fork 会话继承父会话中源内容完整存在于本次请求里的压缩块。 | +| `resumeInheritance` | boolean | true | BILI_RESUME_INHERITANCE | 以新会话 id 恢复的已识别客户端继承父会话的引用编号与完整存在的压缩块。 | +| `chainContentDetection` | boolean | false | BILI_CHAIN_CONTENT | 按请求体内容识别 bili→bili 链(默认关:正文扫描会对 CCR/模型回声文本误报);默认仅 x-bili-hop 驱动链识别。 | +| `chainEgressStamp` | boolean | false | BILI_CHAIN_STAMP | 在出口消息上打模型可见的 链完整性标记(默认关:模型会把它当幽灵输入而消耗 token)。 | +| `stableSystemAnchor` | boolean | false | BILI_STABLE_SYSTEM_ANCHOR | 线路层尽力而为的前缀缓存锚点:客户端改动头部 system 时仍重发首次见到的字节(仅纯代理通道)。 | +| `compat` | { roles?, dropFields?, streamErrorShape?, noCacheControl?, keepResponseId? } | {} (disabled) | — | 全局线上兼容块:角色映射、严格 schema 字段剔除、流式错误形态、缓存控制处理。 | +| `compat.roles` | record role → role | {} | — | 把消息角色映射为上游接受的名字(如 developer→system);仅精确匹配角色,逐 provider 条目按键级胜出。 | +| `compat.dropFields` | string[] (dot paths) | [] | — | 从每个转发请求体中剔除的点路径字段,面向对未知字段返回 400 的严格 schema 网关;全局与逐 provider 列表加法并集。 | +| `compat.streamErrorShape` | "protocol" \| "completion" | protocol | BILI_STREAM_ERROR_SHAPE | 200 已提交后上游流失败的呈现方式:协议原生错误帧(默认)或旧版合成完成形态。 | +| `compat.noCacheControl` | boolean | false | BILI_NO_CACHE_CONTROL | 完全停止 Anthropic 通道的 cache_control 断点打标(面向拒收该字段或有自有断点策略的上游/中继的逃生门)。 | +| `compat.keepResponseId` | boolean | false | ACP_KEEP_RESPONSE_ID | 在内核重建的 Responses 请求上保留 previous_response_id(默认剔除,使重建请求体永不引用上游从未签发过的响应 id)。 | +| `resign` | scheme → { enabled?, passthrough?, credentialRef? } | {} (armed; built-in scheme sdk-hmac-sha256) | BILI_RESIGN, BILI_RESIGN_PASSTHROUGH, BILI_CODEARTS_REF, BILI_RESIGN_BENEFIT | 按 Authorization 方案键控的重签名臂:可重签名的模型请求全程重签转发;无法重签的请求本地 403 拒绝,除非该方案经 passthrough 选择原文透传。 | +| `promptCache.routing` | "auto" \| "enabled" \| "disabled" | auto | ACP_PROMPT_CACHE_ROUTING | 面向缓存感知路由选择的提示词缓存路由姿态。 | +| `native.attachExternal` | boolean | false | BILI_NATIVE_ATTACH_EXTERNAL | 允许无启动器的原生插件挂到外部(车道化、未武装看门狗)守护进程,而不是自行派生。 | +| `claude.nativePort` | number | unset (lane sticky zone port) | BILI_CLAUDE_NATIVE_PORT | claude 原生车道钩子派生代理的精确端口钉死(严格端口:被占用时响亮拒绝而非跳端口)。 | + +**MITM 通道** + +| Key | Type | Default | Env | Description | +|-----|------|---------|-----|-------------| +| `providersPath` | string | unset | ACP_PROVIDERS | 外部 providers.json 路径(遗留/共享路由文件);优先于内联 providers 与配置文件位置。 | +| `mitm.enabled` | boolean | true | BILI_MITM | 面向写死 HTTPS 上游的登录客户端的拦截开关;域名首次发现即加入白名单。 | +| `mitm.domains` | string[] | [] | BILI_MITM_DOMAINS | 显式 MITM 白名单域名(与首次发现的自动白名单取并集)。 | +| `mitm.handshakeTimeoutMs` | number | 10000 | BILI_MITM_HANDSHAKE_TIMEOUT_MS | 被拦截连接的 TLS 握手超时。 | + +**进程级配置块** + +| Key | Type | Default | Env | Description | +|-----|------|---------|-----|-------------| +| `network` | object | {} (all defaults) | — | 上游调用的传输超时、看门狗与重放策略。 | +| `network.upstreamTimeoutMs` | number | 720000 | BILI_UPSTREAM_TIMEOUT_MS | 单次上游调用的硬上限(12 分钟覆盖慢速深度思考模型)。 | +| `network.requestWatchdogMs` | number | 2× upstreamTimeoutMs | BILI_REQUEST_WATCHDOG_MS | 绝对看门狗:即使按调用计时器从未挂上,也强制中止卡死的上游套接字。 | +| `network.keepAliveTimeoutMs` | number | 5000 | BILI_KEEP_ALIVE_TIMEOUT_MS | 连接池内上游套接字的空闲保活超时。 | +| `network.clientErrorBackstopMs` | number | 30000 | BILI_CLIENT_ERROR_BACKSTOP_MS | 中止停止读取已提交响应的客户端连接的兜底超时。 | +| `network.exposureLogIntervalMs` | number | 3600000 (0 disables the log) | BILI_EXPOSURE_LOG_INTERVAL_MS | 绑定地址暴露警告在日志中的重复间隔;0 完全禁用。 | +| `network.streamKeepAliveMs` | number | 15000 (0 disables) | BILI_STREAM_KEEPALIVE_MS | 模型块之间的下游流保活心跳间隔;0 禁用心跳。 | +| `network.preflightHoldMs` | number | 30000 | BILI_PREFLIGHT_HOLD_MS | preflight 失败后,允许请求未校准放行的持有时长。 | +| `network.preflightDeadEndCooldownMs` | number | 300000 | BILI_PREFLIGHT_DEAD_END_COOLDOWN_MS | 死胡同 preflight 后,对同一会话重试校准的冷却时长。 | +| `network.replayRetryMax` | number | 3 (1 disables replays) | BILI_REPLAY_RETRY_MAX | 同一请求在向上游暴露错误前的最大传输失败重放次数。 | +| `network.replayRetryBaseMs` | number | 1500 (0 disables the delay) | BILI_REPLAY_RETRY_BASE_MS | 重放之间的基础退避延迟(指数增长)。 | +| `network.maxShrinkPerCompress` | number | unset | BILI_MAX_SHRINK_PER_COMPRESS | 单次压缩允许收缩历史的上限(防塌缩护栏)。 | +| `network.proxyKeepAliveMaxMs` | number | 55000 (0 = one-shot connections) | BILI_PROXY_KEEPALIVE_MAX_MS | 经出站代理的连接最大存活时长,到期强制重建(规避陈旧 NAT 映射)。 | +| `network.postResponseLingerMs` | number | 5000 | BILI_POST_RESPONSE_LINGER_MS | 代理主动发起的响应后关闭的优雅关闭预算:socket 挂起等待对端 FIN/TLS close_notify,到点销毁(reason=linger-backstop)。 | +| `persist` | object | {} (all defaults) | — | 会话落盘持久化(XDG state 目录之下)。 | +| `persist.enabled` | boolean | true | BILI_PERSIST | 会话记录落盘总开关(0/false 关闭)。 | +| `persist.zstd` | boolean | false | BILI_PERSIST_ZSTD | zstd 压缩持久化会话文件(1/true 启用)。 | +| `persist.debounceMs` | number | 500 | BILI_PERSIST_DEBOUNCE_MS | 会话文件写入的去抖窗口。 | +| `persist.tailTokens` | number | 16384 (0 disables message persistence) | BILI_PERSIST_TAIL_TOKENS | 为导出保真保留的最近消息原文 token 尾部大小。 | +| `persist.epermAlertThreshold` | number | 5 | BILI_PERSIST_EPERM_ALERT_THRESHOLD | 连续 EPERM 写失败达到该次数后在日志中告警。 | +| `persist.epermAlertRepeatMs` | number | 0 (no repeats) | BILI_PERSIST_EPERM_ALERT_REPEAT_MS | EPERM 告警的重复间隔;0 只记录一次。 | +| `sessions` | object | {} (all defaults) | — | 会话表容量上限与可选垃圾回收。 | +| `sessions.max` | number | 256 | BILI_MAX_SESSIONS | 内存会话表上限(空闲会话 LRU 逐出)。 | +| `sessions.gc.enabled` | boolean | false | BILI_SESSION_GC | 过期持久化会话的可选垃圾回收(未开启时用户数据绝不被悄悄清理)。 | +| `sessions.gc.maxAgeDays` | number | 7 | BILI_SESSION_GC_MAX_AGE_DAYS | GC 年龄阈值(天)。 | +| `sessions.gc.maxTokens` | number | 1000000 | BILI_SESSION_GC_MAX_TOKENS | GC 单会话记录的 token 大小阈值。 | +| `sessions.gc.intervalMs` | number | 3600000 | BILI_SESSION_GC_INTERVAL_MS | GC 清扫间隔。 | +| `plugin.snapshotCapBytes` | number | 16777216 (0 disables snapshots) | BILI_PUBLIC_SNAPSHOT_CAP_BYTES | 提供给原生插件的 fork API 公共快照大小上限。 | + +**更新与公告** + +| Key | Type | Default | Env | Description | +|-----|------|---------|-----|-------------| +| `autoUpdate` | boolean | true | ACP_AUTO_UPDATE | 自动 npm 版本检查(约每 3 分钟);ACP_AUTO_UPDATE=0 或 --no-auto-update 关闭。 | +| `autoRestartOnUpdate` | boolean | false | ACP_AUTO_RESTART_ON_UPDATE | 新版本装好后自动重启守护进程。 | +| `updateTag` | string | latest | ACP_UPDATE_TAG | 自更新的 npm dist-tag 通道:latest(默认)、dev 或 pr。 | +| `update` | object | {} (all defaults) | — | 自更新通道设置。 | +| `update.registry` | string | "npmjs" (registry.npmjs.org) | BILI_UPDATE_REGISTRY | 自更新用的自定义 npm registry 基础地址(私有镜像)。 | +| `update.checkIntervalMs` | number | 180000 | BILI_UPDATE_CHECK_INTERVAL_MS | npm registry 版本检查间隔。 | +| `advisoryCheck` | boolean | true | BILI_ADVISORY_CHECK | 关键缺陷公告监视器;本机版本命中受影响范围时装填推荐修复版本。 | +| `advisoryUrl` | string | unset (built-in feed) | BILI_ADVISORY_URL | 公告源覆盖地址。 | +| `releaseNotesCheck` | boolean | true | BILI_RELEASE_NOTES_CHECK | Web 面板里的发布说明源(只抓取缓存、从不安装任何东西)。 | +| `releaseNotesUrl` | string | unset (built-in feed) | BILI_RELEASE_NOTES_URL | 发布说明源覆盖地址。 | + +**诊断与调优** + +| Key | Type | Default | Env | Description | +|-----|------|---------|-----|-------------| +| `diagnostics` | object | {} (all defaults) | — | 本地排障旋钮(转储、渲染/注入开关、count-tokens 透传)。 | +| `diagnostics.dumpBody` | boolean | false | ACP_DUMP_BODY | 把完整请求/响应体转储到日志用于排障。 | +| `diagnostics.dumpReq` | boolean | true | ACP_DUMP_REQ | 逐次调用记录发往上游的请求元数据。 | +| `diagnostics.rawDumpDir` | string | /raw | ACP_RAW_DUMP_DIR | 原始线路转储目录。 | +| `diagnostics.dump4xx` | boolean | false | BILI_DUMP_4XX | 把上游 4xx 响应落盘以便事后检查。 | +| `diagnostics.dump4xxMaxBytes` | number | 2097152 (floor 1024) | BILI_DUMP_4XX_MAX_BYTES | 单个 4xx 转储文件的大小上限。 | +| `diagnostics.renderNone` | boolean | false | ACP_RENDER_NONE | 禁用所有 ACP 标签渲染(原始线路研究模式)。 | +| `diagnostics.noInjectTool` | boolean | false | ACP_NO_INJECT_TOOL | 停止向请求注入 acp_compress 工具定义。 | +| `diagnostics.noCompressPrompt` | boolean | false | ACP_NO_COMPRESS_PROMPT | 停止向系统提示词附加压缩教条文本。 | +| `diagnostics.countTokensPassthrough` | boolean | false | ACP_COUNT_TOKENS_PASSTHROUGH | 把 /v1/messages/count_tokens 转发给上游,而不是本地应答。 | +| `diagnostics.compressProtocol` | "tools" \| "marker" | "tools" | ACP_COMPRESS_PROTOCOL | 压缩的 ACP 注入面:原生工具(默认)或旧版提示词标记。 | +| `fakeCompletion` | object | {} (all defaults) | — | 末块被截断时重新发起请求的重试环。 | +| `fakeCompletion.retries` | number | 0 (opt-in) | BILI_FAKE_COMPLETION_RETRIES | 被截断的末块完成可被重新请求的次数;0 禁用该重试环。 | +| `fakeCompletion.bufCapBytes` | number | 16777216 | BILI_FAKE_BUF_CAP | 重试环累积流缓冲的大小上限。 | +| `codexCompact` | "intercept" \| "pass" | "intercept" | BILI_CODEX_COMPACT | 在 bili 内处理 Codex /responses/compact(intercept,默认)还是转给上游(pass)。 | +| `ccrRetrievalTtlMs` | number | 600000 (0 disables retrieval) | BILI_CCR_RETRIEVAL_TTL_MS | CCR 回取指针的有效期,过期后原文不再可通过 acp_retrieve 取回。 | +| `decompressTmpCap` | number | 50 | BILI_DECOMPRESS_TMP_CAP | 会话内临时展开内容的大小上限(按块计)。 | + +**压缩(全局层级)** + +| Key | Type | Default | Env | Description | +|-----|------|---------|-----|-------------| +| `compress.modelContextLimit` | number \| "N%" | native window (model-declared) | — | 有效上下文窗口(token 数或 N%):使用率的分母,也是硬性 preflight 墙;窗口来源中优先级最高。 | +| `compress.maxContextLimit` | number \| "N%" | "75%" | — | 强制压缩提醒阈值:历史超过窗口该占比时提醒立即触发,绕过增长门槛。不是硬上限。 | +| `compress.emergencyThresholdPercent` | number \| % | "95%" | — | 历史超过窗口该占比时对超大工具输出做紧急截断(必须 >= maxContextLimit)。 | +| `compress.outputHeadroomMaxPct` | number \| % | 0.25 | — | max_tokens 输出预留占窗口的最大比例。 | +| `compress.nudgeGrowthTokens` | number | 50000 (kernel flat cadence) | — | 增长门槛:可折叠片段超出基线增长达到该 token 数才发提醒(按设计恒定,与窗口大小无关)。 | +| `compress.preserveRecentMessages` | number | kernel ≈5 | — | 最近的消息软保护、免于折叠。 | +| `compress.preserveRecentTokens` | number | kernel ≈5000 | — | 最近的 token 软保护、免于折叠。 | +| `compress.minCompressRangeChars` | number (deprecated alias: minCompressRange) | kernel ≈5000 | — | 可折叠片段的最小字符数;更短的永不折叠。 | +| `compress.reconcile` | "off" \| "warn" \| "repair" | "repair" | BILI_FOLD_RECONCILE | 客户端在轮次之间回退或改写历史时校准已折叠状态。 | +| `compress.promptPack` | string (builtin: "default", "lean") | builtin "default" | — | 压缩提示词包,按 项目包 → 用户包 → 内置 解析;不受 acknowledgePromptsRisk 门控。 | +| `compress.stripImagesKeepRecent` | number | 5 | — | 开启剥离图片时,最新 N 条消息内的图片保留。 | +| `compress.tiers` | boolean | true | — | T1→T3 分级蒸馏把折叠成本摊到多代。 | +| `compress.protectedTools` | string[] | none | — | 全历史硬排除:列出工具的结果永不折叠。 | +| `compress.protectedLatestTools` | string[] | none | — | 只保护累积快照类工具「最新一次」实例(新结果覆盖旧结果的工具,如 todo 列表)。 | +| `compress.neverPreserveRecentTools` | string[] ([] valid) | ["decompress", "search_context", "read", "bash"] (kernel) | — | 从近期保护区排除(立即可压);空数组合法=不排除任何工具(最大保护)。 | +| `compress.preserveRecentTools` | string[] | n/a (subtraction form) | — | 减法形式:近期区工具减去本列表得到完全保护;此处空数组按笔误拒绝。 | +| `compress.stripImages` | boolean | false | — | 从可折叠历史中剥离图片载荷。 | +| `compress.visibilityMarkers` | boolean | true | — | 在 compress/decompress/search_context/acp_status 结果后追加可见性标记;关闭可抑制模型模仿叙述。 | +| `compress.rules` | boolean | false | — | 通过注入的 acp_rule 工具提供持久模型提醒——对折叠硬保护;pi/omp 提供 /acp-rule 命令。 | +| `compress.injectTool` | boolean | true | ACP_COMPRESS_TOOL | 向客户端注册 acp_compress 工具(仅全局层级生效)。 | +| `compress.injectNudge` | boolean | true | ACP_COMPRESS_NUDGE | 窗口填满过程中发送增长提醒(仅全局层级生效)。 | +| `compress.reasoning` | { drop?, threshold? } | drop true · threshold 2048 | — | 丢弃超过 2048 字符的已结束轮次推理块(drop 默认 true);严格推理上游需设 drop:false。 | +| `compress.absorb` | object | opt-in (disabled) | — | 可选即时蒸馏:把大段工具结果蒸馏成短摘要,原文进内容库。 | +| `compress.ccr` | object | enabled in proxy mode since v2 | — | 内容缓存与回取:大输出无损存到会话旁、替换为首段摘录+指针,模型用 acp_retrieve 取回原文;无上限、永不清除。 | +| `compress.search.planAware` | boolean | false | — | 开启后 search_context 候选按当前计划状态重排;关闭时结果逐字节不变。 | +| `compress.imageCompression` | object | opt-in (disabled) | — | 可选有损缩放(依赖可选 sharp)后再发送;image_full 取回原图;仅限代理模式。 | +| `compress.prompts` | Partial | unset (kernel doctrine) | — | 覆盖内核教条文本;对压缩质量承重要——受 acknowledgePromptsRisk 门控。 | +| `compress.reasoningGuard` | object | off | — | gpt-5.x/6.x 推理格截断自动修复(最多 3 轮继续提示)。 | +| `compress.outputSteering` | object { enabled?, verbosityLevel?, effortRouting? } | enabled false · verbosityLevel 2 | — | 向系统提示词尾部附加简洁度指令;只收紧机械延续请求。 | +| `compress.priceProfile` | { w?, r?, q? } | unset (registry, kernel fallback {1, 0.1, 4}) | — | w/r/q 相对输入价的比率(写入/缓存读/输出);仅供报告,不影响触发条件或线上行为。 | +| `compress.acknowledgePromptsRisk` | boolean | false | — | 必须先置 true,自定义 prompts 才会生效。 | +| `compress.absorb.enabled` | boolean | false | — | 启用 absorb 蒸馏块。 | +| `compress.absorb.minToolTokens` | number | 1000 | — | 可被吸收的工具结果的最小估算 token 大小。 | +| `compress.absorb.contextThresholdPct` | number \| % | unset | — | 仅当上下文使用率超过窗口该占比时才吸收。 | +| `compress.absorb.excludeTools` | string[] | [] | — | 排除出吸收范围的工具名。 | +| `compress.absorb.toolName` | string | "absorb" | — | absorb 工具的注册名。 | +| `compress.ccr.enabled` | boolean | true (proxy mode) | — | 启用内容缓存与回取块。 | +| `compress.ccr.minToolTokens` | number | ≈4000 | — | 可进入 CCR 存储的工具结果的最小估算 token 大小。 | +| `compress.ccr.excludeTools` | string[] | [] | — | 排除出 CCR 存储的工具名。 | +| `compress.ccr.toolName` | string | "acp_retrieve" | — | 回取工具的注册名。 | +| `compress.ccr.maxHeadChars` | number | 96 | — | 存储指针处内联首段摘录的最大长度。 | +| `compress.imageCompression.enabled` | boolean | false | — | 启用有损图片缩放(需要可选依赖 sharp)。 | +| `compress.imageCompression.minTokens` | number | 512 | — | 只对计得 token 超过该值的图片做缩放。 | +| `compress.imageCompression.maxDimension` | number | 1280 | — | 缩放后的最大输出边长。 | +| `compress.imageCompression.quality` | number | 80 | — | 编码质量(1–100)。 | +| `compress.imageCompression.format` | string | "webp" | — | 输出图片格式。 | +| `compress.prompts.compressPhilosophy` | string | unset (kernel text) | — | 覆盖压缩哲学教条文段。 | +| `compress.prompts.howToCompressRules` | string | unset (kernel text) | — | 覆盖压缩操作规则。 | +| `compress.prompts.tier2DistillRules` | string | unset (kernel text) | — | 覆盖二级蒸馏规则。 | +| `compress.prompts.tier3CondenseRules` | string | unset (kernel text) | — | 覆盖三级浓缩规则。 | +| `compress.reasoningGuard.enabled` | boolean | false | — | 启用推理格自动修复。 | +| `compress.reasoningGuard.maxContinue` | number | 3 | — | 单次截断的最多继续提示轮数。 | +| `compress.reasoningGuard.maxTierN` | number | (built-in) | — | 修复后格层索引的上限。 | +| `compress.reasoningGuard.markerText` | string | "Continue thinking..." | — | 标识被截断推理格的标记文本。 | +| `compress.reasoningGuard.base` | number | (built-in) | — | 修复格的基础偏移参数。 | +| `compress.reasoningGuard.offset` | number | (built-in) | — | 修复格的偏移步长参数。 | +| `compress.reasoningGuard.debugLog` | boolean | false | — | 修复环的详细日志。 | +| `compress.outputSteering.enabled` | boolean | false | — | 启用附加在系统提示词尾部的简洁度指令。 | +| `compress.outputSteering.verbosityLevel` | number (0–4) | 2 | — | 指令的目标详细程度级别。 | +| `compress.outputSteering.effortRouting` | boolean | (built-in) | — | 随指令一起路由 effort 提示。 | +| `compress.priceProfile.w` | number | unset (registry) | — | 写入价相对输入价的比率。 | +| `compress.priceProfile.r` | number | unset (registry) | — | 缓存读价相对输入价的比率。 | +| `compress.priceProfile.q` | number | unset (registry) | — | 输出价相对输入价的比率。 | +| `compress.reasoning.drop` | boolean | true | — | 丢弃超过阈值的已结束轮次推理块。 | +| `compress.reasoning.threshold` | number | 2048 | — | 已结束推理块被丢弃的字符阈值。 | +| `compress.minCompressRange` | number | same as minCompressRangeChars | — | minCompressRangeChars 的弃用别名(接受,映射到后者)。 _(已弃用)_ | + +**路由表字段** + +| Key | Type | Default | Env | Description | +|-----|------|---------|-----|-------------| +| `models` | record name → { context?, output?, compress?, benefit? } | {} | — | 逐模型声明:上下文窗口、输出上限、逐模型压缩覆盖;不是流量过滤器。 | +| `models.context` | number | unset (model registry) | — | 为该模型名声明的上下文窗口 token 数。 | +| `models.output` | number | unset | — | 为该模型名声明的输出 token 上限。 | +| `models.compress` | object | unset | — | 该模型的第 3 级压缩覆盖(全局→provider→模型合并中最深)。 | +| `models.benefit` | boolean | false | — | 在经济学账本中标记该模型为免费额度计费。 | +| `proxy` | string ("" = explicit direct) | unset | — | 本路由出站代理地址。 | +| `compressProtocol` | "tools" (default) \| "marker" | "tools" | — | 本通道的 ACP 注入面。 | +| `protocol` | "anthropic" \| "openai" \| "responses" \| "google" | inferred from the URL marker | — | 声明本通道的线上协议;客户端侧 /bili// URL 标记优先级更高。 | +| `compress` | object (level 2) | unset | — | 任意 compress 字段可在此覆盖——全局→provider→模型三级合并的第 2 级。 | +| `compat` | { roles?, dropFields? } | {} | — | 逐路由线上兼容覆盖;provider 条目按键级覆盖全局;dropFields 加法并集。 | +| `direct` | boolean | false | — | 客户端侧豁免:该上游流量完全不指向 bili。 | +| `passthrough` | boolean | false | — | 路由级逐字节透传、无会话状态——面向反作弊上游。 | +| `imageBilling` | "auto" \| "pixels" \| "bytes" | auto (→ pixels) | — | 本路由图片 token 计费口径;bytes 为字节中继的显式指定。 | +| `imageTokenCap` | number | unset (uncapped) | — | 本路由单张图片 token 成本上限。 | +| `resign` | scheme → { enabled?, passthrough?, credentialRef? } | {} (global map applies) | — | 按路由覆盖全局 resign 映射(第 2 级,最深层胜出)。 | +| `bind` | string (named entries only) | unset | — | 把具名(非 URL)条目深合并到所绑定的 URL 通道作为别名;无 bind 的具名条目不参与路由。 | +| `compactionOptIn` | boolean | false | BILI_NON_HTTP_PROVIDERS | 仅命名条目:把非 http(s) baseUrl 供应商纳入压缩所有权(pi/omp 车道);与 env BILI_NON_HTTP_PROVIDERS 取并集。 | + +**仅环境变量(无配置文件键)** + +| Key | Type | Default | Env | Description | +|-----|------|---------|-----|-------------| +| `BILI_CONFIG_FILE` | string | unset (XDG config path) | — | 覆盖配置文件路径(路径重定位)。 | +| `BILI_SESSIONS_DIR` | string | unset (XDG state path) | — | 会话记录的存放目录(路径重定位)。 | +| `BILI_ENCRYPTION_KEY` | string | unset | — | 加密持久化载荷的密钥材料(机密)。 | +| `BILI_TUNNEL_ALLOWED_HOSTS` | string[] (csv) | unset | — | MITM 隧道车道的主机白名单。 | +| `BILI_RECLAIM_FETCH_PATCH` | boolean-ish | on | — | 进程退出时回收全局 fetch 补丁的开关。 | +| `BILI_CONFLICT_SCAN` | boolean-ish | off | — | 启用安装车道冲突扫描探针。 | +| `BILI_CHAIN_MAX_FUTURE_SKEW_MS` | number | (built-in) | — | 链检查点时间戳未来偏移的容忍度。 | +| `BILI_CHAIN_RECENT_WINDOW_MS` | number | (built-in) | — | 链检查点校验的近期窗口大小。 | +| `BILI_ZONE_PORT` | number | 18787 base (derived per lane) | — | 车道派生代理端口区的基础端口(端口重定位)。 | +| `BILI_ZCODE_ROUTE` | string | unset | — | zcode 车道的路由选择。 | +| `BILI_ZCODE_PORT` | number | unset | — | zcode 车道的端口钉死。 | +| `BILI_ZCODE_SIGNING_FIXED` | boolean-ish | off | — | zcode 凭据车道的固定签名模式。 | +| `BILI_CLAUDE_UPSTREAM` | string | unset | — | claude 车道的上游钉死。 | +| `BILI_ATTACH_HEALTH_DEADLINE_MS` | number | (built-in) | — | 挂接外部守护进程时健康检查的截止时间。 | +| `BILI_ATTACH_EVIDENCE_GRACE_MS` | number | (built-in) | — | 挂接归属证据的宽限期。 | +| `BILI_PROVIDER_REWRITES` | string | unset | — | 路由前应用的 provider URL 重写规则。 | +| `BILI_MCP_PROXY` | string | unset | — | 派生通道:插件宿主工具的 MCP 代理目标。 | +| `BILI_PARENT_PID` | number | unset | — | 派生通道:父进程 id,用于生命周期监管。 | +| `BILI_STRICT_PORT` | number | unset | — | 派生通道:精确端口要求(被占用时响亮拒绝而非跳端口)。 | +| `BILI_OPENCODE_ACP_SPEC` | string | unset | — | 派生通道:opencode 原生车道的 ACP 规格标记。 | +| `BILI_LAUNCHER_MODEL_WINDOWS` | string | unset | — | 启动器通道:传入被派生客户端的模型窗口覆盖。 | +| `BILI_LAUNCHER_LANE` | string | unset | — | 启动器通道:派生方 bili 进程的车道身份。 | +| `BILI_LAUNCHER_PLUGIN` | string | unset | — | 启动器通道:插件模式交接标记。 | +| `BILI_LAUNCHER_DIRECT` | boolean-ish | off | — | 启动器通道:本次启动绕过注入的代理。 | +| `BILI_INHERITED_HTTP_PROXY` | string | unset | — | 启动器通道:跨派生边界保留的 http_proxy 继承值。 | +| `BILI_INHERITED_HTTPS_PROXY` | string | unset | — | 启动器通道:跨派生边界保留的 https_proxy 继承值。 | +| `BILI_INHERITED_ALL_PROXY` | string | unset | — | 启动器通道:跨派生边界保留的 all_proxy 继承值。 | +| `BILI_INHERITED_NO_PROXY` | string | unset | — | 启动器通道:跨派生边界保留的 no_proxy 继承值。 | +| `BILI_NATIVE_CLAUDE` | boolean-ish | off | — | 宿主姿态:标记 claude 原生插件进程。 | +| `BILI_NATIVE_DSH` | boolean-ish | off | — | 宿主姿态:标记 dsh 原生插件进程。 | +| `BILI_NATIVE_KIMI` | boolean-ish | off | — | 宿主姿态:标记 kimi 原生插件进程。 | +| `BILI_NATIVE_OMP` | boolean-ish | off | — | 宿主姿态:标记 omp 原生插件进程。 | +| `BILI_NATIVE_OPENCODE` | boolean-ish | off | — | 宿主姿态:标记 opencode 原生插件进程。 | +| `BILI_NATIVE_PI` | boolean-ish | off | — | 宿主姿态:标记 pi 原生插件进程。 | +| `BILI_NATIVE_ZCODE` | boolean-ish | off | — | 宿主姿态:标记 zcode 原生插件进程。 | +| `BILI_PI_BIN` | string | pi (PATH lookup) | — | 宿主姿态:pi 客户端二进制的显式路径。 | +| `BILI_DSH_BIN` | string | dsh (PATH lookup) | — | 宿主姿态:dsh 客户端二进制的显式路径。 | +| `BILI_MODEL_INFO_RETRY_MS` | number | (built-in) | — | 测试钩子:模型信息查询的重试间隔。 | +| `BILI_DSH_RETRY_INTERVAL_MS` | number | (built-in) | — | 测试钩子:dsh 车道操作的重试间隔。 | +| `BILI_DSH_RECOVERY_INTERVAL_MS` | number | (built-in) | — | 测试钩子:dsh 车道恢复清扫间隔。 | +| `ACP_DUMP_DIR` | string | unset | — | 线路转储输出基础目录覆盖(路径重定位)。 | +| `BILI_STREAM_STALL_MS` | number | (built-in) | — | 已提交上游流的停滞检测超时(无字节静默多久后中止)。 | +| `BILI_CLIENT_BIN` | string | unset (PATH lookup) | — | 被启动客户端二进制的显式覆盖(在 PATH 上解析)。 | +| `BILI_CONVERSATION_ID` | string | unset (per-spawn UUID written by bili) | — | 传给 MCP 子进程的逐派生会话 UUID(宿主不传会话 id 时用于无头自注册)。 | +| `BILI_LAUNCHER_MODEL_MAX_OUTPUTS` | string (JSON id→maxOutput map) | unset | — | 启动器通道:传给被派生代理的逐模型最大输出映射,用于输出预留。 | +| `BILI_LAUNCH_TOKEN` | string | unset (generated per launch) | — | 启动令牌,鉴权启动器与其派生代理之间的车道内部端点(机密)。 | +| `BILI_MCP_DEFAULT_ORIGIN` | string | http://127.0.0.1:8787 | — | MCP 入口的兜底代理 origin 候选。 | +| `BILI_MCP_NO_ORPHAN_ADOPT` | boolean-ish | off (=1 disables orphan adoption) | — | 多个宿主会话共享一个代理时,退出恢复会话的孤儿收养。 | +| `BILI_MITM_HOSTS` | string[] (csv) | unset | — | 启动器通道:传给被派生代理的 MITM 白名单主机(区别于配置文件对应项 BILI_MITM_DOMAINS)。 | +| `BILI_PLUGIN_AGENT` | boolean-ish | off | — | 派生通道:标记插件 agent 进程。 | + + + --- ## 服务端设置 @@ -1104,53 +1384,99 @@ 文件键仅在对应环境变量未设置时生效。括号内为内置默认值。 -| 环境变量 | 配置键 | 默认值 | -|---------|--------|--------| -| `BILI_UPSTREAM_TIMEOUT_MS` | `network.upstreamTimeoutMs` | `720000` | -| `BILI_REQUEST_WATCHDOG_MS` | `network.requestWatchdogMs` | 上游超时 ×2 | -| `BILI_REPLAY_RETRY_MAX` | `network.replayRetryMax` | `3` | -| `BILI_REPLAY_RETRY_BASE_MS` | `network.replayRetryBaseMs` | `1500` | -| `BILI_MAX_SHRINK_PER_COMPRESS` | `network.maxShrinkPerCompress` | 未设置(不引导) | -| `BILI_KEEP_ALIVE_TIMEOUT_MS` | `network.keepAliveTimeoutMs` | `5000` | -| `BILI_CLIENT_ERROR_BACKSTOP_MS` | `network.clientErrorBackstopMs` | `30000` | -| `BILI_EXPOSURE_LOG_INTERVAL_MS` | `network.exposureLogIntervalMs` | `3600000` | -| `BILI_STREAM_KEEPALIVE_MS` | `network.streamKeepAliveMs` | `15000` | -| `BILI_PREFLIGHT_HOLD_MS` | `network.preflightHoldMs` | `30000` | -| `BILI_PREFLIGHT_DEAD_END_COOLDOWN_MS` | `network.preflightDeadEndCooldownMs` | `300000` | -| `BILI_PROXY_KEEPALIVE_MAX_MS` | `network.proxyKeepAliveMaxMs` | `55000` | -| `BILI_POST_RESPONSE_LINGER_MS` | `network.postResponseLingerMs` | `5000` | -| `BILI_MITM_HANDSHAKE_TIMEOUT_MS` | `mitm.handshakeTimeoutMs` | `10000` | -| `BILI_PERSIST` | `persist.enabled` | `true` | -| `BILI_PERSIST_ZSTD` | `persist.zstd` | `false` | -| `BILI_PERSIST_DEBOUNCE_MS` | `persist.debounceMs` | `500` | -| `BILI_PERSIST_TAIL_TOKENS` | `persist.tailTokens` | `16384` | -| `BILI_PERSIST_EPERM_ALERT_THRESHOLD` | `persist.epermAlertThreshold` | `5` | -| `BILI_PERSIST_EPERM_ALERT_REPEAT_MS` | `persist.epermAlertRepeatMs` | `0` | -| `BILI_MAX_SESSIONS` | `sessions.max` | `256` | -| `BILI_SESSION_GC` | `sessions.gc.enabled` | `false` | -| `BILI_SESSION_GC_MAX_AGE_DAYS` | `sessions.gc.maxAgeDays` | `7` | -| `BILI_SESSION_GC_MAX_TOKENS` | `sessions.gc.maxTokens` | `1000000` | -| `BILI_SESSION_GC_INTERVAL_MS` | `sessions.gc.intervalMs` | `3600000` | -| `BILI_PUBLIC_SNAPSHOT_CAP_BYTES` | `plugin.snapshotCapBytes` | `16777216` | -| `BILI_UPDATE_REGISTRY` | `update.registry` | npm 公共 registry | -| `BILI_UPDATE_CHECK_INTERVAL_MS` | `update.checkIntervalMs` | `180000` | -| `BILI_CCR_RETRIEVAL_TTL_MS` | `ccrRetrievalTtlMs` | `600000` | -| `BILI_CODEX_COMPACT` | `codexCompact` | `"intercept"` | -| `BILI_DECOMPRESS_TMP_CAP` | `decompressTmpCap` | `50` | -| `ACP_DUMP_BODY` | `diagnostics.dumpBody` | `false` | -| `ACP_DUMP_REQ` | `diagnostics.dumpReq` | `true` | -| `ACP_RAW_DUMP_DIR` | `diagnostics.rawDumpDir` | `/raw` | -| `BILI_DUMP_4XX` | `diagnostics.dump4xx` | `false` | -| `BILI_DUMP_4XX_MAX_BYTES` | `diagnostics.dump4xxMaxBytes` | `2097152` | -| `ACP_RENDER_NONE` | `diagnostics.renderNone` | `false` | -| `ACP_NO_INJECT_TOOL` | `diagnostics.noInjectTool` | `false` | -| `ACP_NO_COMPRESS_PROMPT` | `diagnostics.noCompressPrompt` | `false` | -| `ACP_COUNT_TOKENS_PASSTHROUGH` | `diagnostics.countTokensPassthrough` | `false` | -| `ACP_COMPRESS_PROTOCOL` | `diagnostics.compressProtocol` | `"tools"` | -| `ACP_KEEP_RESPONSE_ID` | `compat.keepResponseId` | `false` | -| `BILI_NO_CACHE_CONTROL` | `compat.noCacheControl` | `false` | -| `BILI_FAKE_COMPLETION_RETRIES` | `fakeCompletion.retries` | `0` | -| `BILI_FAKE_BUF_CAP` | `fakeCompletion.bufCapBytes` | `16777216` | + +| 环境变量 | 配置文件键 | 默认值 | +|---------|------------|--------| +| `ACP_AUTO_RESTART_ON_UPDATE` | `autoRestartOnUpdate` | false | +| `ACP_AUTO_UPDATE` | `autoUpdate` | true | +| `ACP_COMPRESS_NUDGE` | `compress.injectNudge` | true | +| `ACP_COMPRESS_PROTOCOL` | `diagnostics.compressProtocol` | "tools" | +| `ACP_COMPRESS_TOOL` | `compress.injectTool` | true | +| `ACP_COUNT_TOKENS_PASSTHROUGH` | `diagnostics.countTokensPassthrough` | false | +| `ACP_DEBUG` | `debug` | false | +| `ACP_DUMP_BODY` | `diagnostics.dumpBody` | false | +| `ACP_DUMP_REQ` | `diagnostics.dumpReq` | true | +| `ACP_DUMP_SSE` | `dumpSse` | unset (directory) | +| `ACP_HOST` | `host` | 127.0.0.1 | +| `ACP_KEEP_RESPONSE_ID` | `compat.keepResponseId` | false | +| `ACP_LOG` | `log` | true | +| `ACP_LOG_FILE` | `logFile` | XDG state path (off disables the file, keeps stderr) | +| `ACP_MODEL_CONTEXT_LIMIT` | `modelContextLimit` | 200000 | +| `ACP_NO_COMPRESS_PROMPT` | `diagnostics.noCompressPrompt` | false | +| `ACP_NO_INJECT_TOOL` | `diagnostics.noInjectTool` | false | +| `ACP_PASSTHROUGH` | `passthrough` | false | +| `ACP_PORT` | `port` | 8787 | +| `ACP_PROMPT_CACHE_ROUTING` | `promptCache.routing` | auto | +| `ACP_PROVIDERS` | `providersPath` | unset | +| `ACP_RAW_DUMP_DIR` | `diagnostics.rawDumpDir` | /raw | +| `ACP_RENDER_NONE` | `diagnostics.renderNone` | false | +| `ACP_SESSION_HEADER` | `sessionHeader` | x-acp-session | +| `ACP_UPDATE_TAG` | `updateTag` | latest | +| `ACP_UPSTREAM` | `upstream` | https://api.anthropic.com | +| `BILI_ADVISORY_CHECK` | `advisoryCheck` | true | +| `BILI_ADVISORY_URL` | `advisoryUrl` | unset (built-in feed) | +| `BILI_CCR_RETRIEVAL_TTL_MS` | `ccrRetrievalTtlMs` | 600000 (0 disables retrieval) | +| `BILI_CHAIN_CONTENT` | `chainContentDetection` | false | +| `BILI_CHAIN_STAMP` | `chainEgressStamp` | false | +| `BILI_CLAUDE_NATIVE_PORT` | `claude.nativePort` | unset (lane sticky zone port) | +| `BILI_CLIENT_ERROR_BACKSTOP_MS` | `network.clientErrorBackstopMs` | 30000 | +| `BILI_CODEARTS_REF` | `resign` | {} (armed; built-in scheme sdk-hmac-sha256) | +| `BILI_CODEX_COMPACT` | `codexCompact` | "intercept" | +| `BILI_DECOMPRESS_TMP_CAP` | `decompressTmpCap` | 50 | +| `BILI_DUMP_4XX` | `diagnostics.dump4xx` | false | +| `BILI_DUMP_4XX_MAX_BYTES` | `diagnostics.dump4xxMaxBytes` | 2097152 (floor 1024) | +| `BILI_EXPOSURE_LOG_INTERVAL_MS` | `network.exposureLogIntervalMs` | 3600000 (0 disables the log) | +| `BILI_FAKE_BUF_CAP` | `fakeCompletion.bufCapBytes` | 16777216 | +| `BILI_FAKE_COMPLETION_RETRIES` | `fakeCompletion.retries` | 0 (opt-in) | +| `BILI_FOLD_RECONCILE` | `compress.reconcile` | "repair" | +| `BILI_FORK_ADOPTION` | `forkAdoption` | false | +| `BILI_IMAGE_BILLING` | `imageBilling` | auto (resolves to pixels) | +| `BILI_IMAGE_TOKEN_CAP` | `imageTokenCap` | unset (uncapped) | +| `BILI_KEEP_ALIVE_TIMEOUT_MS` | `network.keepAliveTimeoutMs` | 5000 | +| `BILI_LOG_MASK_HOSTS` | `maskHosts` | true | +| `BILI_MAX_SESSIONS` | `sessions.max` | 256 | +| `BILI_MAX_SHRINK_PER_COMPRESS` | `network.maxShrinkPerCompress` | unset | +| `BILI_MITM` | `mitm.enabled` | true | +| `BILI_MITM_DOMAINS` | `mitm.domains` | [] | +| `BILI_MITM_HANDSHAKE_TIMEOUT_MS` | `mitm.handshakeTimeoutMs` | 10000 | +| `BILI_NATIVE_ATTACH_EXTERNAL` | `native.attachExternal` | false | +| `BILI_NON_HTTP_PROVIDERS` | `compactionOptIn` | false | +| `BILI_NO_CACHE_CONTROL` | `compat.noCacheControl` | false | +| `BILI_PERSIST` | `persist.enabled` | true | +| `BILI_PERSIST_DEBOUNCE_MS` | `persist.debounceMs` | 500 | +| `BILI_PERSIST_EPERM_ALERT_REPEAT_MS` | `persist.epermAlertRepeatMs` | 0 (no repeats) | +| `BILI_PERSIST_EPERM_ALERT_THRESHOLD` | `persist.epermAlertThreshold` | 5 | +| `BILI_PERSIST_TAIL_TOKENS` | `persist.tailTokens` | 16384 (0 disables message persistence) | +| `BILI_PERSIST_ZSTD` | `persist.zstd` | false | +| `BILI_POST_RESPONSE_LINGER_MS` | `network.postResponseLingerMs` | 5000 | +| `BILI_PREFLIGHT_DEAD_END_COOLDOWN_MS` | `network.preflightDeadEndCooldownMs` | 300000 | +| `BILI_PREFLIGHT_HOLD_MS` | `network.preflightHoldMs` | 30000 | +| `BILI_PROXY_KEEPALIVE_MAX_MS` | `network.proxyKeepAliveMaxMs` | 55000 (0 = one-shot connections) | +| `BILI_PUBLIC_SNAPSHOT_CAP_BYTES` | `plugin.snapshotCapBytes` | 16777216 (0 disables snapshots) | +| `BILI_RELEASE_NOTES_CHECK` | `releaseNotesCheck` | true | +| `BILI_RELEASE_NOTES_URL` | `releaseNotesUrl` | unset (built-in feed) | +| `BILI_REPLAY_RETRY_BASE_MS` | `network.replayRetryBaseMs` | 1500 (0 disables the delay) | +| `BILI_REPLAY_RETRY_MAX` | `network.replayRetryMax` | 3 (1 disables replays) | +| `BILI_REQUEST_WATCHDOG_MS` | `network.requestWatchdogMs` | 2× upstreamTimeoutMs | +| `BILI_RESIGN` | `resign` | {} (armed; built-in scheme sdk-hmac-sha256) | +| `BILI_RESIGN_BENEFIT` | `resign` | {} (armed; built-in scheme sdk-hmac-sha256) | +| `BILI_RESIGN_PASSTHROUGH` | `resign` | {} (armed; built-in scheme sdk-hmac-sha256) | +| `BILI_RESUME_INHERITANCE` | `resumeInheritance` | true | +| `BILI_SESSION_GC` | `sessions.gc.enabled` | false | +| `BILI_SESSION_GC_INTERVAL_MS` | `sessions.gc.intervalMs` | 3600000 | +| `BILI_SESSION_GC_MAX_AGE_DAYS` | `sessions.gc.maxAgeDays` | 7 | +| `BILI_SESSION_GC_MAX_TOKENS` | `sessions.gc.maxTokens` | 1000000 | +| `BILI_STABLE_SYSTEM_ANCHOR` | `stableSystemAnchor` | false | +| `BILI_STREAM_ERROR_SHAPE` | `compat.streamErrorShape` | protocol | +| `BILI_STREAM_KEEPALIVE_MS` | `network.streamKeepAliveMs` | 15000 (0 disables) | +| `BILI_SUBAGENT_SPLIT` | `subagentSplit` | true | +| `BILI_UPDATE_CHECK_INTERVAL_MS` | `update.checkIntervalMs` | 180000 | +| `BILI_UPDATE_REGISTRY` | `update.registry` | "npmjs" (registry.npmjs.org) | +| `BILI_UPSTREAM_PROXY` | `proxy` | unset (direct) | +| `BILI_UPSTREAM_PROXY_MODE` | `upstreamProxyMode` | auto (unset behaves as direct) | +| `BILI_UPSTREAM_TIMEOUT_MS` | `network.upstreamTimeoutMs` | 720000 | +| `PORT` | `port` | 8787 | + | 变量 | 效果 | |------|------| diff --git a/tools/gen-config-docs.mjs b/tools/gen-config-docs.mjs new file mode 100644 index 0000000000..3100f7d7ed --- /dev/null +++ b/tools/gen-config-docs.mjs @@ -0,0 +1,401 @@ +#!/usr/bin/env node +// Usage: +// node tools/gen-config-docs.mjs generate (default) — rewrite all marked blocks +// node tools/gen-config-docs.mjs check-coverage — fail on src params missing from the YAML seed +// Pure Node, zero dependencies: runs locally and in CI without npm install. + +import { readFileSync, writeFileSync, readdirSync, statSync } from "node:fs"; +import { join, dirname, relative } from "node:path"; +import { fileURLToPath } from "node:url"; + +const ROOT = join(dirname(fileURLToPath(import.meta.url)), ".."); +const SEED_DIR = join(ROOT, "website", "config-reference"); +const MD_EN = join(ROOT, "CONFIGURATION.md"); +const MD_ZH = join(ROOT, "CONFIGURATION.zh-CN.md"); +const MAIN_JS = join(ROOT, "website", "main.js"); +const DOCS_HTML = join(ROOT, "website", "docs", "index.html"); +const HOME_HTML = join(ROOT, "website", "index.html"); +const CONFIG_TS = join(ROOT, "src", "config.ts"); + +const OPEN = (id) => "\x3c!-- bili:gen " + id + " --\x3e"; +const CLOSE = "\x3c!-- /bili:gen --\x3e"; +const JOPEN = (id) => "/* bili:gen " + id + " */"; +const JCLOSE = "/* /bili:gen */"; + +const GROUPS = [ + ["core", "Server & core", "服务与核心"], + ["upstream", "Upstream & billing", "上游与计费"], + ["behavior", "Behavior toggles", "行为开关"], + ["mitm", "MITM lane", "MITM 通道"], + ["process", "Process & persistence", "进程级配置块"], + ["updates", "Updates & advisories", "更新与公告"], + ["diagnostics", "Diagnostics & tuning", "诊断与调优"], + ["compress", "Compression (global level)", "压缩(全局层级)"], + ["providers", "Provider route fields", "路由表字段"], + ["envonly", "Environment-only variables", "仅环境变量(无配置文件键)"], +]; + +const SITE_GROUPS = [ + ["core", "Server & core", "服务与核心"], + ["up", "Upstream & billing", "上游与计费"], + ["beh", "Behavior toggles", "行为开关"], + ["mitm", "MITM lane", "MITM 通道"], + ["proc", "Process blocks", "进程级块"], + ["diag", "Diagnostics & updates", "诊断与更新"], + ["adv", "Advanced scalars", "高级标量"], +]; + +function fail(msg) { + console.error("[gen-config-docs] " + msg); + process.exit(1); +} + +function escHtml(s) { + return String(s).replace(/&/g, "&").replace(//g, ">"); +} + +function mdCell(s) { + return String(s).replace(/\|/g, "\\|"); +} + +function parseScalar(raw, ctx) { + const v = raw.trim(); + if (v === "") return ""; + if (v.startsWith('"')) { + try { + return JSON.parse(v); + } catch { + fail(ctx + ": quoted value is not valid JSON: " + v.slice(0, 60)); + } + } + if (v.startsWith("[") && v.endsWith("]")) { + const inner = v.slice(1, -1).trim(); + if (!inner) return []; + return inner.split(",").map((p) => parseScalar(p, ctx)); + } + return v; +} + +function parseSeed(text, file) { + const entries = []; + let cur = null; + let inEntries = false; + const lines = text.split("\n"); + for (let i = 0; i < lines.length; i++) { + const line = lines[i]; + if (/^\s*$/.test(line) || /^\s*#/.test(line)) continue; + let m; + if (/^domain:\s*\S+$/.test(line)) continue; + if (/^entries:\s*$/.test(line)) { + inEntries = true; + continue; + } + if (!inEntries) fail(file + ":" + (i + 1) + ": unexpected line: " + line); + if ((m = line.match(/^ - ([A-Za-z_][\w.]*):\s*(.*)$/))) { + cur = { key: parseScalar(m[2], file + ":" + (i + 1)) }; + entries.push(cur); + continue; + } + if ((m = line.match(/^ ([A-Za-z_][\w]*):\s*(.*)$/))) { + if (!cur) fail(file + ":" + (i + 1) + ": field before first entry"); + if (m[1] === "key") fail(file + ":" + (i + 1) + ": duplicate key field"); + cur[m[1]] = parseScalar(m[2], file + ":" + (i + 1)); + continue; + } + fail(file + ":" + (i + 1) + ": unparsed line: " + line); + } + return entries; +} + +function validate(entries, file, idMap) { + for (const e of entries) { + const ctx = file + ":" + e.key; + for (const f of ["type", "default", "group", "desc_en", "desc_zh"]) { + if (typeof e[f] !== "string" || e[f] === "") fail(ctx + ": missing or empty field " + f); + } + if (!GROUPS.some((g) => g[0] === e.group)) fail(ctx + ': unknown group "' + e.group + '"'); + for (const f of ["desc_en", "desc_zh"]) { + if (e[f].includes("`")) fail(ctx + ": backtick forbidden in " + f); + } + const hasId = typeof e.id === "string" && e.id !== ""; + const hasRender = typeof e.render === "string"; + const hasSiteGroup = typeof e.site_group === "string"; + if (hasId !== (hasRender || hasSiteGroup)) fail(ctx + ": id requires exactly one of render|site_group"); + if (hasId && !/^[a-z][a-zA-Z0-9]*\.[A-Za-z0-9_]+$/.test(e.id)) fail(ctx + ": bad id format " + e.id); + if (hasId && (typeof e.site_en !== "string" || typeof e.site_zh !== "string")) fail(ctx + ": id requires site_en and site_zh"); + if (hasRender && !["compress-row", "obj-item", "route-row", "top-item"].includes(e.render)) fail(ctx + ": bad render " + e.render); + if (hasSiteGroup && !SITE_GROUPS.some((g) => g[0] === e.site_group)) fail(ctx + ": bad site_group " + e.site_group); + if (e.kind === "env-only" && !["user", "internal", "test"].includes(e.audience)) fail(ctx + ": env-only entry needs audience user|internal|test"); + if (e.deprecated === "true") e.deprecated = true; + if (e.deprecated !== undefined && e.deprecated !== true) fail(ctx + ": deprecated must be true"); + if (typeof e.env === "string") e.env = [e.env]; + if (e.env !== undefined && !Array.isArray(e.env)) fail(ctx + ": env must be a name or [names]"); + if (hasId) { + if (idMap.has(e.id)) fail("duplicate id " + e.id + " (" + idMap.get(e.id) + " vs " + ctx + ")"); + idMap.set(e.id, ctx); + } + } +} + +function loadSeeds() { + const files = readdirSync(SEED_DIR).filter((f) => f.endsWith(".yaml")).sort(); + if (!files.length) fail("no .yaml seeds in " + relative(ROOT, SEED_DIR)); + const all = []; + const idMap = new Map(); + for (const f of files) { + const es = parseSeed(readFileSync(join(SEED_DIR, f), "utf8"), f); + if (!es.length) fail(f + ": no entries"); + validate(es, f, idMap); + for (const e of es) all.push(e); + } + return all; +} + +function replaceBlock(text, id, body, open, close) { + const oi = text.indexOf(open); + if (oi < 0) fail("open marker not found: " + open + " — wire it into the target file first"); + const ci = text.indexOf(close, oi + open.length); + if (ci < 0) fail("close marker not found for " + id); + return text.slice(0, oi) + open + "\n" + body + "\n" + close + text.slice(ci + close.length); +} + +function genParamRef(entries, lang) { + const out = []; + out.push( + lang === "zh" + ? "以下索引由 `website/config-reference/*.yaml` 生成——改种子后运行 `node tools/gen-config-docs.mjs generate`,不要手改本区块。" + : "This index is generated from `website/config-reference/*.yaml` — edit the seed, then run `node tools/gen-config-docs.mjs generate`; do not hand-edit this block." + ); + out.push(""); + for (const [gid, enL, zhL] of GROUPS) { + const rows = entries.filter((e) => e.group === gid); + if (!rows.length) continue; + out.push("**" + (lang === "zh" ? zhL : enL) + "**"); + out.push(""); + out.push("| Key | Type | Default | Env | Description |"); + out.push("|-----|------|---------|-----|-------------|"); + for (const e of rows) { + const dep = e.deprecated === true ? (lang === "zh" ? " _(已弃用)_" : " _(deprecated)_") : ""; + const envCol = e.kind === "env-only" ? "—" : e.env && e.env.length ? e.env.join(", ") : "—"; + const desc = lang === "zh" ? e.desc_zh : e.desc_en; + out.push("| `" + e.key + "` | " + mdCell(e.type) + " | " + mdCell(e.default) + " | " + mdCell(envCol) + " | " + mdCell(desc) + dep + " |"); + } + out.push(""); + } + return out.join("\n"); +} + +function genEnvMap(entries, lang) { + const rows = []; + for (const e of entries) { + if (e.kind === "env-only" || !e.env) continue; + for (const name of e.env) rows.push([name, e.key, e.default]); + } + rows.sort((a, b) => (a[0] < b[0] ? -1 : a[0] > b[0] ? 1 : a[1] < b[1] ? -1 : 1)); + const out = []; + out.push(lang === "zh" ? "| 环境变量 | 配置文件键 | 默认值 |" : "| Env var | Config key | Default |"); + out.push("|---------|------------|--------|"); + for (const [n, k, d] of rows) out.push("| `" + n + "` | `" + k + "` | " + mdCell(d) + " |"); + return out.join("\n"); +} + +function siteVal(e, lang) { + return lang === "zh" ? e.site_zh : e.site_en; +} + +function genSiteDict(entries, lang) { + const kv = []; + for (const r of ["compress-row", "obj-item", "route-row"]) { + for (const e of entries.filter((x) => x.render === r)) kv.push([e.id, siteVal(e, lang)]); + } + for (const [gid, enL, zhL] of SITE_GROUPS) kv.push(["tg." + gid, "" + escHtml(lang === "zh" ? zhL : enL) + ""]); + for (const e of entries.filter((x) => x.site_group)) kv.push([e.id, siteVal(e, lang)]); + // The block sits mid-object, so every line — including the last — needs its comma. + return kv.map(([k, v]) => " " + JSON.stringify(k) + ": " + JSON.stringify(v) + ",").join("\n"); +} + +function attrFor(v) { + return v.includes("<") ? "data-i18n-html" : "data-i18n"; +} + +function leaf(key) { + return key.split(".").pop(); +} + +function genParamTable(entries, render, lang) { + return entries + .filter((e) => e.render === render) + .map((e) => { + const v = siteVal(e, lang); + return ' ' + leaf(e.key) + '' + e.type + '' + v + ""; + }) + .join("\n"); +} + +function genObjList(entries, lang) { + return entries + .filter((e) => e.render === "obj-item") + .map((e) => '
  • ' + siteVal(e, lang) + "
  • ") + .join("\n"); +} + +function genTopList(entries, lang) { + const out = []; + for (const [gid, enL, zhL] of SITE_GROUPS) { + out.push('
  • ' + escHtml(lang === "zh" ? zhL : enL) + "
  • "); + for (const e of entries.filter((x) => x.site_group === gid)) { + out.push('
  • ' + siteVal(e, lang) + "
  • "); + } + } + return out.join("\n"); +} + +function writeBlocks(entries) { + let md = readFileSync(MD_EN, "utf8"); + md = replaceBlock(md, "param-ref", genParamRef(entries, "en"), OPEN("param-ref"), CLOSE); + md = replaceBlock(md, "env-map", genEnvMap(entries, "en"), OPEN("env-map"), CLOSE); + writeFileSync(MD_EN, md); + + let mdZh = readFileSync(MD_ZH, "utf8"); + mdZh = replaceBlock(mdZh, "param-ref", genParamRef(entries, "zh"), OPEN("param-ref"), CLOSE); + mdZh = replaceBlock(mdZh, "env-map", genEnvMap(entries, "zh"), OPEN("env-map"), CLOSE); + writeFileSync(MD_ZH, mdZh); + + let js = readFileSync(MAIN_JS, "utf8"); + js = replaceBlock(js, "site-dict-en", genSiteDict(entries, "en"), JOPEN("site-dict-en"), JCLOSE); + js = replaceBlock(js, "site-dict-zh", genSiteDict(entries, "zh"), JOPEN("site-dict-zh"), JCLOSE); + writeFileSync(MAIN_JS, js); + + let h = readFileSync(DOCS_HTML, "utf8"); + h = replaceBlock(h, "compress-table", genParamTable(entries, "compress-row", "en"), OPEN("compress-table"), CLOSE); + h = replaceBlock(h, "compress-objlist", genObjList(entries, "en"), OPEN("compress-objlist"), CLOSE); + h = replaceBlock(h, "routes-table", genParamTable(entries, "route-row", "en"), OPEN("routes-table"), CLOSE); + h = replaceBlock(h, "top-list", genTopList(entries, "en"), OPEN("top-list"), CLOSE); + writeFileSync(DOCS_HTML, h); + + console.log("[gen-config-docs] wrote 10 blocks from " + entries.length + " seed entries"); +} + +function dictKeys(slice) { + const ks = new Set(); + const re = /"([A-Za-z0-9_.]+)"\s*:/g; + let m; + while ((m = re.exec(slice))) ks.add(m[1]); + return ks; +} + +function checkI18n() { + const js = readFileSync(MAIN_JS, "utf8"); + const enStart = js.indexOf("en: {"); + const zhStart = js.indexOf("zh: {"); + const endAt = js.indexOf("};", zhStart); + if (enStart < 0 || zhStart < 0 || endAt < 0) fail("I18N object structure not recognized in website/main.js"); + const en = dictKeys(js.slice(enStart, zhStart)); + const zh = dictKeys(js.slice(zhStart, endAt)); + const problems = []; + for (const k of en) if (!zh.has(k)) problems.push("en-only key: " + k); + for (const k of zh) if (!en.has(k)) problems.push("zh-only key: " + k); + for (const f of [DOCS_HTML, HOME_HTML]) { + const html = readFileSync(f, "utf8"); + const re = /data-i18n(?:-html)?="([^"]+)"/g; + let m; + while ((m = re.exec(html))) { + if (!en.has(m[1]) || !zh.has(m[1])) problems.push(relative(ROOT, f) + ": unresolved i18n ref " + m[1]); + } + } + if (problems.length) { + for (const p of problems) console.error("[gen-config-docs] " + p); + process.exit(1); + } + console.log("[gen-config-docs] i18n ok: " + en.size + " keys, EN/ZH sets equal, all refs resolve"); +} + +function walkTs(dir, acc) { + for (const name of readdirSync(dir).sort()) { + const p = join(dir, name); + const st = statSync(p); + if (st.isDirectory()) walkTs(p, acc); + else if (name.endsWith(".ts")) acc.push(p); + } + return acc; +} + +function extractEnvNames() { + const names = new Set(); + const patterns = [ + /process\.env\.([A-Z][A-Z0-9_]*)/g, + /process\.env\[\s*["']([A-Z][A-Z0-9_]*)["']\s*\]/g, + /\benv\.([A-Z][A-Z0-9_]*)/g, + /\w+\(\s*["']((?:BILI|ACP)_[A-Z0-9_]+)["']/g, + ]; + const quotedName = /["']((?:BILI|ACP)_[A-Z0-9_]+)["']/g; + for (const f of walkTs(join(ROOT, "src"), [])) { + const t = readFileSync(f, "utf8"); + for (const rx of patterns) { + rx.lastIndex = 0; + let m; + while ((m = rx.exec(t))) names.add(m[1]); + } + // helper calls that pass the name as a LATER argument (envMillis(env, "NAME", d)): + // quoted BILI_/ACP_ literals on lines that reference the env object. + for (const ln of t.split("\n")) { + if (/^\s*(\/|\*|#)/.test(ln)) continue; + if (!/process\.env|\benv\b/.test(ln)) continue; + quotedName.lastIndex = 0; + let m; + while ((m = quotedName.exec(ln))) names.add(m[1]); + } + } + return [...names].filter((n) => /^(?:BILI|ACP)_/.test(n)).sort(); +} + +function knownTopLevelKeys() { + const t = readFileSync(CONFIG_TS, "utf8"); + const m = t.match(/const KNOWN_TOP_LEVEL_KEYS\s*=\s*new Set\(\[([\s\S]*?)\]\)/); + if (!m) fail("KNOWN_TOP_LEVEL_KEYS literal not found in src/config.ts"); + const keys = [...m[1].matchAll(/["']([A-Za-z_$][\w$]*)["']/g)].map((x) => x[1]); + if (!keys.length) fail("parsed empty KNOWN_TOP_LEVEL_KEYS"); + return keys.sort(); +} + +function checkCoverage(entries) { + const found = extractEnvNames(); + const docEnv = new Set(); + for (const e of entries) { + if (e.kind === "env-only") docEnv.add(e.key); + if (e.env) for (const n of e.env) docEnv.add(n); + } + const missingEnv = found.filter((n) => !docEnv.has(n)); + const staleEnv = [...docEnv].filter((n) => /^(?:BILI|ACP)_/.test(n) && !found.includes(n)).sort(); + const tops = knownTopLevelKeys(); + const knobKeys = entries.filter((e) => e.kind !== "env-only").map((e) => e.key); + const missingTop = tops.filter((K) => !knobKeys.some((k) => k === K || k.startsWith(K + "."))); + let bad = false; + if (missingEnv.length) { + bad = true; + console.error("[gen-config-docs] UNDOCUMENTED env vars read in src/:"); + for (const n of missingEnv) console.error(" " + n); + } + if (missingTop.length) { + bad = true; + console.error("[gen-config-docs] UNDOCUMENTED FileConfig top-level keys:"); + for (const n of missingTop) console.error(" " + n); + } + if (staleEnv.length) { + console.log("[gen-config-docs] notice: documented but not detected in src reads (expected for dynamic names):"); + for (const n of staleEnv) console.log(" " + n); + } + if (bad) process.exit(1); + console.log("[gen-config-docs] coverage ok: " + found.length + " env names + " + tops.length + " top-level keys all documented"); +} + +const cmd = process.argv[2] || "generate"; +if (cmd === "generate") { + const entries = loadSeeds(); + writeBlocks(entries); + checkI18n(); +} else if (cmd === "check-coverage") { + checkCoverage(loadSeeds()); +} else { + fail("unknown command: " + cmd + " (use generate | check-coverage)"); +} diff --git a/website/config-reference/compress.yaml b/website/config-reference/compress.yaml new file mode 100644 index 0000000000..650e2becf1 --- /dev/null +++ b/website/config-reference/compress.yaml @@ -0,0 +1,528 @@ +# Config reference seed — compress block (#2107 single source of truth). +# Edit HERE, then run: node tools/gen-config-docs.mjs generate +domain: compress +entries: + - key: compress.modelContextLimit + type: "number | \"N%\"" + default: "native window (model-declared)" + group: compress + id: cw.mcl + render: compress-row + desc_en: "Effective context window (tokens or N%): denominator of the usage ratio and a hard preflight wall; highest-priority window source." + desc_zh: "有效上下文窗口(token 数或 N%):使用率的分母,也是硬性 preflight 墙;窗口来源中优先级最高。" + site_en: "Effective context window (tokens or \"N%\"): denominator of the usage ratio and a hard preflight wall. Highest-priority window source — overrides per-route / per-model declarations plus the top-level default." + site_zh: "有效上下文窗口(token 数或 \"N%\"):使用率的分母,也是硬性 preflight 墙。窗口来源中优先级最高——覆盖路由/模型声明与顶层默认值。" + - key: compress.maxContextLimit + type: "number | \"N%\"" + default: "\"75%\"" + group: compress + id: cw.mxcl + render: compress-row + desc_en: "Forced-compression nudge threshold: once history passes this share of the window the nudge fires immediately, bypassing growth gates. Not a hard cap." + desc_zh: "强制压缩提醒阈值:历史超过窗口该占比时提醒立即触发,绕过增长门槛。不是硬上限。" + site_en: "Forced-compression nudge threshold (default \"75%\"): once history passes this share of the window the nudge fires immediately, bypassing the growth gates. Not a hard cap." + site_zh: "强制压缩提醒阈值(默认 \"75%\"):历史超过窗口的该占比时提醒立即触发,绕过增长门槛。不是硬上限。" + - key: compress.emergencyThresholdPercent + type: "number | %" + default: "\"95%\"" + group: compress + id: cw.etc + render: compress-row + desc_en: "Emergency truncation of oversized tool outputs when history passes this share of the window (must be >= maxContextLimit)." + desc_zh: "历史超过窗口该占比时对超大工具输出做紧急截断(必须 >= maxContextLimit)。" + site_en: "Default \"95%\": emergency truncation of oversized tool outputs when history passes this share of the window (must be ≥ maxContextLimit)." + site_zh: "默认 \"95%\":历史超过窗口该占比时,对超大工具输出做紧急截断(必须 ≥ maxContextLimit)。" + - key: compress.outputHeadroomMaxPct + type: "number | %" + default: "0.25" + group: compress + id: cw.ohmp + render: compress-row + desc_en: "Cap on the share of the window reserved for output via max_tokens." + desc_zh: "max_tokens 输出预留占窗口的最大比例。" + site_en: "Cap (0–1, default 0.25) on the share of the window reserved for output via max_tokens." + site_zh: "max_tokens 输出预留占窗口的最大比例(0–1,默认 0.25)。" + - key: compress.nudgeGrowthTokens + type: number + default: "50000 (kernel flat cadence)" + group: compress + id: cw.ngt + render: compress-row + desc_en: "Growth gate: nudges fire only when a foldable range exceeds baseline growth by this many tokens (flat by design, independent of window size)." + desc_zh: "增长门槛:可折叠片段超出基线增长达到该 token 数才发提醒(按设计恒定,与窗口大小无关)。" + site_en: "Growth gate (default 50000): nudges fire only when a foldable range exceeds baseline growth by this many tokens." + site_zh: "增长门槛(默认 50000):可折叠片段超出基线增长达到该 token 数才发提醒。" + - key: compress.preserveRecentMessages + type: number + default: "kernel ≈5" + group: compress + id: cw.prm + render: compress-row + desc_en: "The most recent messages stay soft-protected from folds." + desc_zh: "最近的消息软保护、免于折叠。" + site_en: "Kernel default ≈5: the most recent messages stay soft-protected from folds." + site_zh: "内核默认约 5:最近消息软保护、免于折叠。" + - key: compress.preserveRecentTokens + type: number + default: "kernel ≈5000" + group: compress + id: cw.prt + render: compress-row + desc_en: "The most recent tokens stay soft-protected from folds." + desc_zh: "最近的 token 软保护、免于折叠。" + site_en: "Kernel default ≈5000: the most recent tokens stay soft-protected from folds." + site_zh: "内核默认约 5000:最近的 token 软保护、免于折叠。" + - key: compress.minCompressRangeChars + type: "number (deprecated alias: minCompressRange)" + default: "kernel ≈5000" + group: compress + id: cw.mrc + render: compress-row + desc_en: "Smallest foldable range, in characters; shorter ranges never fold." + desc_zh: "可折叠片段的最小字符数;更短的永不折叠。" + site_en: "Smallest foldable range, in characters (kernel default ≈5000) — shorter ranges never fold." + site_zh: "可折叠片段的最小字符数(内核默认约 5000),更短的永不折叠。" + - key: compress.reconcile + type: "\"off\" | \"warn\" | \"repair\"" + default: "\"repair\"" + env: BILI_FOLD_RECONCILE + group: compress + id: cw.rec + render: compress-row + desc_en: "Reconcile folded state when the client rewinds or rewrites history between turns." + desc_zh: "客户端在轮次之间回退或改写历史时校准已折叠状态。" + site_en: "\"off\" | \"warn\" | \"repair\" (default repair): reconcile folded state when the client rewinds or rewrites history between turns." + site_zh: "\"off\" | \"warn\" | \"repair\"(默认 repair):客户端在轮次之间回退或改写历史时校准已折叠状态。" + - key: compress.promptPack + type: "string (builtin: \"default\", \"lean\")" + default: "builtin \"default\"" + group: compress + id: cw.ppk + render: compress-row + desc_en: "Compression prompt pack, resolved project pack → user pack → builtin; not gated by acknowledgePromptsRisk." + desc_zh: "压缩提示词包,按 项目包 → 用户包 → 内置 解析;不受 acknowledgePromptsRisk 门控。" + site_en: "Compression prompt pack, resolved project pack → user pack → builtin. Builtins: \"default\" and \"lean\" (one-line tool descriptions). Not gated by acknowledgePromptsRisk." + site_zh: "压缩提示词包,按 项目包 → 用户包 → 内置 解析。内置:\"default\" 与 \"lean\"(单行工具描述)。不受 acknowledgePromptsRisk 门控。" + - key: compress.stripImagesKeepRecent + type: number + default: "5" + group: compress + id: cw.sikr + render: compress-row + desc_en: "With stripImages on, images inside the N newest messages are kept." + desc_zh: "开启剥离图片时,最新 N 条消息内的图片保留。" + site_en: "With stripImages on, images inside the N newest messages (default 5) are kept." + site_zh: "开启剥离图片时,最新 N 条消息(默认 5)内的图片保留。" + - key: compress.tiers + type: boolean + default: "true" + group: compress + id: cw.tiers + render: compress-row + desc_en: "Tiered T1→T3 distillation spreads folding cost across generations." + desc_zh: "T1→T3 分级蒸馏把折叠成本摊到多代。" + site_en: "On by default: tiered T1→T3 distillation spreads folding cost across generations." + site_zh: "默认开:T1→T3 分级蒸馏,把折叠成本摊到多代。" + - key: compress.protectedTools + type: "string[]" + default: "none" + group: compress + id: ct.pt + render: compress-row + desc_en: "Hard exclusion across all history: results of listed tools never fold." + desc_zh: "全历史硬排除:列出工具的结果永不折叠。" + site_en: "Hard exclusion across all history: results of listed tools never fold (use with care)." + site_zh: "全历史硬排除:列出工具的结果永不折叠(慎用)。" + - key: compress.protectedLatestTools + type: "string[]" + default: "none" + group: compress + id: ct.plt + render: compress-row + desc_en: "Protects only the LATEST instance of cumulative-snapshot tools whose newest result supersedes older ones (e.g. todo lists)." + desc_zh: "只保护累积快照类工具「最新一次」实例(新结果覆盖旧结果的工具,如 todo 列表)。" + site_en: "Protects only the LATEST instance of cumulative-snapshot tools whose newest result supersedes older ones (e.g. todo lists)." + site_zh: "只保护累积快照类工具的「最新一次」实例(新结果覆盖旧结果的工具,如 todo 列表)。" + - key: compress.neverPreserveRecentTools + type: "string[] ([] valid)" + default: "[\"decompress\", \"search_context\", \"read\", \"bash\"] (kernel)" + group: compress + id: ct.nprt + render: compress-row + desc_en: "Excluded from the recent protection zone (immediately compressible); an empty array excludes nothing (maximum protection)." + desc_zh: "从近期保护区排除(立即可压);空数组合法=不排除任何工具(最大保护)。" + site_en: "Excluded from the recent protection zone (immediately compressible); default [\"decompress\", \"search_context\", \"read\", \"bash\"]. An empty array is valid — it excludes nothing (maximum protection)." + site_zh: "从近期保护区排除(立即可压);默认 [\"decompress\", \"search_context\", \"read\", \"bash\"]。空数组合法=不排除任何工具(最大保护)。" + - key: compress.preserveRecentTools + type: "string[]" + default: "n/a (subtraction form)" + group: compress + id: ct.prt2 + render: compress-row + desc_en: "Subtraction form: recent-zone tools minus this list get full protection; an empty array here is rejected as a typo." + desc_zh: "减法形式:近期区工具减去本列表得到完全保护;此处空数组按笔误拒绝。" + site_en: "Subtraction form: recent-zone tools minus this list get full protection. An empty array here is rejected as a typo." + site_zh: "减法形式:近期区工具减去本列表得到完全保护;此处空数组按笔误拒绝。" + - key: compress.stripImages + type: boolean + default: "false" + group: compress + id: ct.si + render: compress-row + desc_en: "Strip image payloads from foldable history." + desc_zh: "从可折叠历史中剥离图片载荷。" + site_en: "Strip image payloads from foldable history (off by default)." + site_zh: "从可折叠历史中剥离图片载荷(默认关)。" + - key: compress.visibilityMarkers + type: boolean + default: "true" + group: compress + id: ct.vm + render: compress-row + desc_en: "Append visibility markers after compress/decompress/search_context/acp_status results; off stops imitated narration." + desc_zh: "在 compress/decompress/search_context/acp_status 结果后追加可见性标记;关闭可抑制模型模仿叙述。" + site_en: "Append 📦/❌ visibility markers after compress/decompress/search_context/acp_status results (on by default; off stops imitated narration)." + site_zh: "在 compress/decompress/search_context/acp_status 结果后追加 📦/❌ 可见性标记(默认开;关闭可抑制模型模仿叙述)。" + - key: compress.rules + type: boolean + default: "false" + group: compress + id: ct.rules + render: compress-row + desc_en: "Persistent model reminders delivered through an injected acp_rule tool, hard-protected from folds; pi/omp expose an /acp-rule command." + desc_zh: "通过注入的 acp_rule 工具提供持久模型提醒——对折叠硬保护;pi/omp 提供 /acp-rule 命令。" + site_en: "Off by default: persistent model reminders delivered through an injected acp_rule tool, hard-protected from folds. pi/omp expose an /acp-rule command." + site_zh: "默认关:通过注入的 acp_rule 工具提供持久模型提醒——对折叠硬保护。pi/omp 提供 /acp-rule 命令。" + - key: compress.injectTool + type: boolean + default: "true" + env: ACP_COMPRESS_TOOL + group: compress + id: ct.it + render: compress-row + desc_en: "Register the acp_compress tool for clients (global level only)." + desc_zh: "向客户端注册 acp_compress 工具(仅全局层级生效)。" + site_en: "Register the acp_compress tool for clients (on by default; global level only)." + site_zh: "向客户端注册 acp_compress 工具(默认开;仅全局层级生效)。" + - key: compress.injectNudge + type: boolean + default: "true" + env: ACP_COMPRESS_NUDGE + group: compress + id: ct.in + render: compress-row + desc_en: "Send growth nudges as the window fills (global level only)." + desc_zh: "窗口填满过程中发送增长提醒(仅全局层级生效)。" + site_en: "Send growth nudges as the window fills (on by default; global level only)." + site_zh: "窗口填满过程中发送增长提醒(默认开;仅全局层级生效)。" + - key: compress.reasoning + type: "{ drop?, threshold? }" + default: "drop true · threshold 2048" + group: compress + id: ct.rz + render: compress-row + desc_en: "Drop finished-round reasoning runs longer than 2048 chars (drop: true by default); strict-reasoning upstreams need drop:false." + desc_zh: "丢弃超过 2048 字符的已结束轮次推理块(drop 默认 true);严格推理上游需设 drop:false。" + site_en: "{ drop?, threshold? } — drop finished-round reasoning runs longer than 2048 chars (drop: true by default); strict-reasoning upstreams need drop:false." + site_zh: "{ drop?, threshold? }——丢弃超过 2048 字符的已结束轮次推理块(drop 默认 true);严格推理上游需设 drop:false。" + - key: compress.absorb + type: object + default: "opt-in (disabled)" + group: compress + id: co.absorb + render: obj-item + desc_en: "Opt-in instant distillation of large tool results into short abstracts; originals go to the content store." + desc_zh: "可选即时蒸馏:把大段工具结果蒸馏成短摘要,原文进内容库。" + site_en: "absorb — opt-in instant distillation of large tool results into short abstracts; originals go to the content store (enabled, minToolTokens (default 1000), contextThresholdPct, excludeTools, toolName \"absorb\")." + site_zh: "absorb —— 可选即时蒸馏:把大段工具结果蒸馏成短摘要,原文进内容库(enabled, minToolTokens(默认 1000), contextThresholdPct, excludeTools, toolName \"absorb\")。" + - key: compress.ccr + type: object + default: "enabled in proxy mode since v2" + group: compress + id: co.ccr + render: obj-item + desc_en: "Content cache & retrieve: large outputs stored losslessly beside the session, replaced by head excerpt + pointer fetched back via acp_retrieve; no cap or eviction." + desc_zh: "内容缓存与回取:大输出无损存到会话旁、替换为首段摘录+指针,模型用 acp_retrieve 取回原文;无上限、永不清除。" + site_en: "ccr — content cache & retrieve: large outputs are stored losslessly beside the session and replaced by a head excerpt plus pointer; the model fetches originals back via acp_retrieve. No cap or eviction; on by default in proxy mode since v2 (enabled, minToolTokens (~4000), excludeTools, toolName \"acp_retrieve\", maxHeadChars)." + site_zh: "ccr —— 内容缓存与回取:大输出无损存到会话旁、替换为首段摘录+指针,模型用 acp_retrieve 取回原文;无上限、永不清除;自 v2 起代理模式默认开(enabled, minToolTokens(~4000), excludeTools, toolName \"acp_retrieve\", maxHeadChars)。" + - key: compress.search.planAware + type: boolean + default: "false" + group: compress + id: co.search + render: obj-item + desc_en: "When on, search_context candidates are re-ranked against current plan state; off keeps byte-identical lexical results." + desc_zh: "开启后 search_context 候选按当前计划状态重排;关闭时结果逐字节不变。" + site_en: "search.planAware — off by default: when on, search_context candidates are re-ranked against current plan state (latest-wins todos + last user turn); off keeps byte-identical lexical results." + site_zh: "search.planAware —— 默认关:开启后 search_context 候选按当前计划状态重排(todo 最新优先 + 上一轮用户消息);关闭时结果逐字节不变。" + - key: compress.imageCompression + type: object + default: "opt-in (disabled)" + group: compress + id: co.img + render: obj-item + desc_en: "Opt-in lossy downscale via optional sharp before sending; image_full restores originals; proxy mode only." + desc_zh: "可选有损缩放(依赖可选 sharp)后再发送;image_full 取回原图;仅限代理模式。" + site_en: "imageCompression — opt-in lossy downscale via optional sharp before sending (enabled, minTokens 512, maxDimension 1280, quality 80, format \"webp\"); image_full restores originals; proxy mode only." + site_zh: "imageCompression —— 可选有损缩放(依赖可选 sharp)后再发送(enabled, minTokens 512, maxDimension 1280, quality 80, format \"webp\");image_full 取回原图;仅限代理模式。" + - key: compress.prompts + type: "Partial" + default: "unset (kernel doctrine)" + group: compress + id: co.prompts + render: obj-item + desc_en: "Override the kernel doctrine texts; load-bearing for quality — gated behind acknowledgePromptsRisk." + desc_zh: "覆盖内核教条文本;对压缩质量承重要——受 acknowledgePromptsRisk 门控。" + site_en: "prompts — override the kernel doctrine texts (compressPhilosophy, howToCompressRules, tier2DistillRules, tier3CondenseRules); load-bearing for quality — gated behind acknowledgePromptsRisk." + site_zh: "prompts —— 覆盖内核教条文本(compressPhilosophy, howToCompressRules, tier2DistillRules, tier3CondenseRules);对压缩质量承重要——受 acknowledgePromptsRisk 门控。" + - key: compress.reasoningGuard + type: object + default: "off" + group: compress + id: co.rg + render: obj-item + desc_en: "Auto-repair of reasoning-lattice truncation on gpt-5.x/6.x (up to 3 continue-nudge rounds)." + desc_zh: "gpt-5.x/6.x 推理格截断自动修复(最多 3 轮继续提示)。" + site_en: "reasoningGuard — auto-repair of reasoning-lattice truncation on gpt-5.x/6.x (≤3 continue-nudge rounds, marker \"Continue thinking...\") (enabled, maxContinue, maxTierN, markerText, base, offset, debugLog)." + site_zh: "reasoningGuard —— gpt-5.x/6.x 推理格截断自动修复(≤3 轮继续提示,标记 \"Continue thinking...\")(enabled, maxContinue, maxTierN, markerText, base, offset, debugLog)。" + - key: compress.outputSteering + type: "object { enabled?, verbosityLevel?, effortRouting? }" + default: "enabled false · verbosityLevel 2" + group: compress + id: co.os + render: obj-item + desc_en: "Appends a conciseness directive to the system-prompt tail; clamps mechanical continuation requests." + desc_zh: "向系统提示词尾部附加简洁度指令;只收紧机械延续请求。" + site_en: "outputSteering — { enabled? false, verbosityLevel? 2 (0–4), effortRouting? }: appends a conciseness directive to the system-prompt tail; clamps mechanical continuation requests." + site_zh: "outputSteering —— { enabled? false, verbosityLevel? 2 (0–4), effortRouting? }:向系统提示词尾部附加简洁度指令;只收紧机械延续请求。" + - key: compress.priceProfile + type: "{ w?, r?, q? }" + default: "unset (registry, kernel fallback {1, 0.1, 4})" + group: compress + id: co.pp + render: obj-item + desc_en: "w/r/q ratios normalized to the input price (write/cache-read/output); report-only — never affects triggers or the wire." + desc_zh: "w/r/q 相对输入价的比率(写入/缓存读/输出);仅供报告,不影响触发条件或线上行为。" + site_en: "priceProfile — w / r / q ratios normalized to the input price (write / cache-read / output); unset ⇒ models.dev $/Mtok registry rows, kernel fallback {1, 0.1, 4}. Report-only — never affects triggers or the wire." + site_zh: "priceProfile —— w / r / q 相对输入价的比率(写入/缓存读/输出);未设置 ⇒ 取 models.dev $/Mtok 注册表行,内核兜底 {1, 0.1, 4}。仅供报告,不影响触发条件或线上行为。" + - key: compress.acknowledgePromptsRisk + type: boolean + default: "false" + group: compress + id: co.apr + render: obj-item + desc_en: "Must be true before custom prompts take effect." + desc_zh: "必须先置 true,自定义 prompts 才会生效。" + site_en: "acknowledgePromptsRisk — must be true before custom prompts take effect." + site_zh: "acknowledgePromptsRisk —— 必须先置 true,自定义 prompts 才会生效。" + - key: compress.absorb.enabled + type: boolean + default: "false" + group: compress + desc_en: "Enable the absorb distillation block." + desc_zh: "启用 absorb 蒸馏块。" + - key: compress.absorb.minToolTokens + type: number + default: "1000" + group: compress + desc_en: "Minimum estimated token size of a tool result eligible for absorption." + desc_zh: "可被吸收的工具结果的最小估算 token 大小。" + - key: compress.absorb.contextThresholdPct + type: "number | %" + default: "unset" + group: compress + desc_en: "Only absorb when context usage passes this share of the window." + desc_zh: "仅当上下文使用率超过窗口该占比时才吸收。" + - key: compress.absorb.excludeTools + type: "string[]" + default: "[]" + group: compress + desc_en: "Tool names excluded from absorption." + desc_zh: "排除出吸收范围的工具名。" + - key: compress.absorb.toolName + type: string + default: "\"absorb\"" + group: compress + desc_en: "Registered name of the absorb tool." + desc_zh: "absorb 工具的注册名。" + - key: compress.ccr.enabled + type: boolean + default: "true (proxy mode)" + group: compress + desc_en: "Enable the content-cache-and-retrieve block." + desc_zh: "启用内容缓存与回取块。" + - key: compress.ccr.minToolTokens + type: number + default: "≈4000" + group: compress + desc_en: "Minimum estimated token size of a tool result eligible for CCR storage." + desc_zh: "可进入 CCR 存储的工具结果的最小估算 token 大小。" + - key: compress.ccr.excludeTools + type: "string[]" + default: "[]" + group: compress + desc_en: "Tool names excluded from CCR storage." + desc_zh: "排除出 CCR 存储的工具名。" + - key: compress.ccr.toolName + type: string + default: "\"acp_retrieve\"" + group: compress + desc_en: "Registered name of the retrieval tool." + desc_zh: "回取工具的注册名。" + - key: compress.ccr.maxHeadChars + type: number + default: "96" + group: compress + desc_en: "Maximum head-excerpt length left inline at the storage pointer." + desc_zh: "存储指针处内联首段摘录的最大长度。" + - key: compress.imageCompression.enabled + type: boolean + default: "false" + group: compress + desc_en: "Enable lossy image downscaling (requires the optional sharp dependency)." + desc_zh: "启用有损图片缩放(需要可选依赖 sharp)。" + - key: compress.imageCompression.minTokens + type: number + default: "512" + group: compress + desc_en: "Only downscale images whose counted tokens exceed this." + desc_zh: "只对计得 token 超过该值的图片做缩放。" + - key: compress.imageCompression.maxDimension + type: number + default: "1280" + group: compress + desc_en: "Largest output dimension after downscaling." + desc_zh: "缩放后的最大输出边长。" + - key: compress.imageCompression.quality + type: number + default: "80" + group: compress + desc_en: "Encoder quality (1–100)." + desc_zh: "编码质量(1–100)。" + - key: compress.imageCompression.format + type: string + default: "\"webp\"" + group: compress + desc_en: "Output image format." + desc_zh: "输出图片格式。" + - key: compress.prompts.compressPhilosophy + type: string + default: "unset (kernel text)" + group: compress + desc_en: "Override of the compression philosophy doctrine paragraph." + desc_zh: "覆盖压缩哲学教条文段。" + - key: compress.prompts.howToCompressRules + type: string + default: "unset (kernel text)" + group: compress + desc_en: "Override of the compression how-to rules." + desc_zh: "覆盖压缩操作规则。" + - key: compress.prompts.tier2DistillRules + type: string + default: "unset (kernel text)" + group: compress + desc_en: "Override of the tier-2 distillation rules." + desc_zh: "覆盖二级蒸馏规则。" + - key: compress.prompts.tier3CondenseRules + type: string + default: "unset (kernel text)" + group: compress + desc_en: "Override of the tier-3 condensation rules." + desc_zh: "覆盖三级浓缩规则。" + - key: compress.reasoningGuard.enabled + type: boolean + default: "false" + group: compress + desc_en: "Enable reasoning-lattice auto-repair." + desc_zh: "启用推理格自动修复。" + - key: compress.reasoningGuard.maxContinue + type: number + default: "3" + group: compress + desc_en: "Maximum continue-nudge rounds per truncation." + desc_zh: "单次截断的最多继续提示轮数。" + - key: compress.reasoningGuard.maxTierN + type: number + default: "(built-in)" + group: compress + desc_en: "Upper bound on the repaired lattice tier index." + desc_zh: "修复后格层索引的上限。" + - key: compress.reasoningGuard.markerText + type: string + default: "\"Continue thinking...\"" + group: compress + desc_en: "Marker text that signals a truncated reasoning lattice." + desc_zh: "标识被截断推理格的标记文本。" + - key: compress.reasoningGuard.base + type: number + default: "(built-in)" + group: compress + desc_en: "Base offset parameter of the repair lattice." + desc_zh: "修复格的基础偏移参数。" + - key: compress.reasoningGuard.offset + type: number + default: "(built-in)" + group: compress + desc_en: "Offset step parameter of the repair lattice." + desc_zh: "修复格的偏移步长参数。" + - key: compress.reasoningGuard.debugLog + type: boolean + default: "false" + group: compress + desc_en: "Verbose logging for the repair loop." + desc_zh: "修复环的详细日志。" + - key: compress.outputSteering.enabled + type: boolean + default: "false" + group: compress + desc_en: "Enable the conciseness directive appended to the system-prompt tail." + desc_zh: "启用附加在系统提示词尾部的简洁度指令。" + - key: compress.outputSteering.verbosityLevel + type: "number (0–4)" + default: "2" + group: compress + desc_en: "Target verbosity level for the directive." + desc_zh: "指令的目标详细程度级别。" + - key: compress.outputSteering.effortRouting + type: boolean + default: "(built-in)" + group: compress + desc_en: "Route effort hints alongside the directive." + desc_zh: "随指令一起路由 effort 提示。" + - key: compress.priceProfile.w + type: number + default: "unset (registry)" + group: compress + desc_en: "Write-price ratio relative to the input price." + desc_zh: "写入价相对输入价的比率。" + - key: compress.priceProfile.r + type: number + default: "unset (registry)" + group: compress + desc_en: "Cache-read price ratio relative to the input price." + desc_zh: "缓存读价相对输入价的比率。" + - key: compress.priceProfile.q + type: number + default: "unset (registry)" + group: compress + desc_en: "Output price ratio relative to the input price." + desc_zh: "输出价相对输入价的比率。" + - key: compress.reasoning.drop + type: boolean + default: "true" + group: compress + desc_en: "Drop finished-round reasoning runs longer than the threshold." + desc_zh: "丢弃超过阈值的已结束轮次推理块。" + - key: compress.reasoning.threshold + type: number + default: "2048" + group: compress + desc_en: "Character threshold above which finished reasoning runs are dropped." + desc_zh: "已结束推理块被丢弃的字符阈值。" + - key: compress.minCompressRange + type: number + default: "same as minCompressRangeChars" + group: compress + deprecated: true + desc_en: "Deprecated alias of minCompressRangeChars (accepted, mapped onto it)." + desc_zh: "minCompressRangeChars 的弃用别名(接受,映射到后者)。" diff --git a/website/config-reference/diagnostics.yaml b/website/config-reference/diagnostics.yaml new file mode 100644 index 0000000000..745dbbaab2 --- /dev/null +++ b/website/config-reference/diagnostics.yaml @@ -0,0 +1,141 @@ +# Config reference seed — diagnostics & tuning scalars (#2107 single source of truth). +# Edit HERE, then run: node tools/gen-config-docs.mjs generate +domain: diagnostics +entries: + - key: diagnostics + type: object + default: "{} (all defaults)" + group: diagnostics + id: tt.diag + site_group: diag + desc_en: "Local troubleshooting knobs (dumps, render/injection toggles, count-tokens passthrough)." + desc_zh: "本地排障旋钮(转储、渲染/注入开关、count-tokens 透传)。" + site_en: "diagnostics — local troubleshooting knobs: dumpBody false · dumpReq true · rawDumpDir · dump4xx false (+MaxBytes 2 MiB) · renderNone/noInjectTool/noCompressPrompt false · countTokensPassthrough false · compressProtocol \"tools\"." + site_zh: "diagnostics —— 本地排障旋钮:dumpBody false · dumpReq true · rawDumpDir · dump4xx false (+MaxBytes 2 MiB) · renderNone/noInjectTool/noCompressPrompt false · countTokensPassthrough false · compressProtocol \"tools\"。" + - key: diagnostics.dumpBody + type: boolean + default: "false" + env: ACP_DUMP_BODY + group: diagnostics + desc_en: "Dump full request/response bodies to the log for troubleshooting." + desc_zh: "把完整请求/响应体转储到日志用于排障。" + - key: diagnostics.dumpReq + type: boolean + default: "true" + env: ACP_DUMP_REQ + group: diagnostics + desc_en: "Log outgoing upstream request metadata per call." + desc_zh: "逐次调用记录发往上游的请求元数据。" + - key: diagnostics.rawDumpDir + type: string + default: "/raw" + env: ACP_RAW_DUMP_DIR + group: diagnostics + desc_en: "Directory for raw wire dumps." + desc_zh: "原始线路转储目录。" + - key: diagnostics.dump4xx + type: boolean + default: "false" + env: BILI_DUMP_4XX + group: diagnostics + desc_en: "Persist upstream 4xx responses to disk for post-mortem inspection." + desc_zh: "把上游 4xx 响应落盘以便事后检查。" + - key: diagnostics.dump4xxMaxBytes + type: number + default: "2097152 (floor 1024)" + env: BILI_DUMP_4XX_MAX_BYTES + group: diagnostics + desc_en: "Size cap for a single 4xx dump file." + desc_zh: "单个 4xx 转储文件的大小上限。" + - key: diagnostics.renderNone + type: boolean + default: "false" + env: ACP_RENDER_NONE + group: diagnostics + desc_en: "Disable all ACP tag rendering (raw wire study mode)." + desc_zh: "禁用所有 ACP 标签渲染(原始线路研究模式)。" + - key: diagnostics.noInjectTool + type: boolean + default: "false" + env: ACP_NO_INJECT_TOOL + group: diagnostics + desc_en: "Stop injecting the acp_compress tool definition into requests." + desc_zh: "停止向请求注入 acp_compress 工具定义。" + - key: diagnostics.noCompressPrompt + type: boolean + default: "false" + env: ACP_NO_COMPRESS_PROMPT + group: diagnostics + desc_en: "Stop appending the compression doctrine to system prompts." + desc_zh: "停止向系统提示词附加压缩教条文本。" + - key: diagnostics.countTokensPassthrough + type: boolean + default: "false" + env: ACP_COUNT_TOKENS_PASSTHROUGH + group: diagnostics + desc_en: "Forward /v1/messages/count_tokens to the upstream instead of answering locally." + desc_zh: "把 /v1/messages/count_tokens 转发给上游,而不是本地应答。" + - key: diagnostics.compressProtocol + type: "\"tools\" | \"marker\"" + default: "\"tools\"" + env: ACP_COMPRESS_PROTOCOL + group: diagnostics + desc_en: "ACP injection surface for compression: native tools (default) or legacy prompt markers." + desc_zh: "压缩的 ACP 注入面:原生工具(默认)或旧版提示词标记。" + - key: fakeCompletion + type: object + default: "{} (all defaults)" + group: diagnostics + id: tt.fake + site_group: diag + desc_en: "Retry loop that re-requests when a final chunk arrives truncated." + desc_zh: "末块被截断时重新发起请求的重试环。" + site_en: "fakeCompletion — retry loop for truncated final chunks: retries 0 (opt-in) · bufCapBytes 16 MiB." + site_zh: "fakeCompletion —— 被截断末块的补完成重试环:retries 0 (可选) · bufCapBytes 16 MiB。" + - key: fakeCompletion.retries + type: number + default: "0 (opt-in)" + env: BILI_FAKE_COMPLETION_RETRIES + group: diagnostics + desc_en: "How many times a truncated final completion may be re-requested; 0 disables the loop." + desc_zh: "被截断的末块完成可被重新请求的次数;0 禁用该重试环。" + - key: fakeCompletion.bufCapBytes + type: number + default: "16777216" + env: BILI_FAKE_BUF_CAP + group: diagnostics + desc_en: "Buffer size cap for the retry loop's accumulated stream." + desc_zh: "重试环累积流缓冲的大小上限。" + - key: codexCompact + type: "\"intercept\" | \"pass\"" + default: "\"intercept\"" + env: BILI_CODEX_COMPACT + group: diagnostics + id: tt.ccx + site_group: adv + desc_en: "Handle Codex /responses/compact inside bili (intercept, default) or forward it upstream (pass)." + desc_zh: "在 bili 内处理 Codex /responses/compact(intercept,默认)还是转给上游(pass)。" + site_en: "codexCompact — intercept | pass (default intercept): handle Codex /responses/compact inside bili or forward upstream." + site_zh: "codexCompact —— intercept | pass(默认 intercept):在 bili 内处理 Codex /responses/compact,还是转给上游。" + - key: ccrRetrievalTtlMs + type: number + default: "600000 (0 disables retrieval)" + env: BILI_CCR_RETRIEVAL_TTL_MS + group: diagnostics + id: ttl.ttl + site_group: adv + desc_en: "Lifetime of CCR retrieval pointers before originals stop being fetchable via acp_retrieve." + desc_zh: "CCR 回取指针的有效期,过期后原文不再可通过 acp_retrieve 取回。" + site_en: "ccrRetrievalTtlMs — lifetime of CCR retrieval pointers (default 600000; 0 disables retrieval)." + site_zh: "ccrRetrievalTtlMs —— CCR 回取指针有效期(默认 600000;0 禁用回取)。" + - key: decompressTmpCap + type: number + default: "50" + env: BILI_DECOMPRESS_TMP_CAP + group: diagnostics + id: ttl.tmp + site_group: adv + desc_en: "Size cap (blocks) for temporary decompressed content held in-session." + desc_zh: "会话内临时展开内容的大小上限(按块计)。" + site_en: "decompressTmpCap — size cap for temporary decompressed blocks (default 50)." + site_zh: "decompressTmpCap —— 临时展开块的大小上限(默认 50)。" diff --git a/website/config-reference/env-only.yaml b/website/config-reference/env-only.yaml new file mode 100644 index 0000000000..213d4021f5 --- /dev/null +++ b/website/config-reference/env-only.yaml @@ -0,0 +1,404 @@ +# Config reference seed — environment-only variables (no config-file twin) (#2107 single source of truth). +# Edit HERE, then run: node tools/gen-config-docs.mjs generate +domain: env-only +entries: + - key: BILI_CONFIG_FILE + type: string + default: "unset (XDG config path)" + kind: env-only + audience: user + group: envonly + desc_en: "Override the config file path (path relocation)." + desc_zh: "覆盖配置文件路径(路径重定位)。" + - key: BILI_SESSIONS_DIR + type: string + default: "unset (XDG state path)" + kind: env-only + audience: user + group: envonly + desc_en: "Where session records are stored (path relocation)." + desc_zh: "会话记录的存放目录(路径重定位)。" + - key: BILI_ENCRYPTION_KEY + type: string + default: "unset" + kind: env-only + audience: user + group: envonly + desc_en: "Key material for encrypted persisted payloads (secret)." + desc_zh: "加密持久化载荷的密钥材料(机密)。" + - key: BILI_TUNNEL_ALLOWED_HOSTS + type: "string[] (csv)" + default: "unset" + kind: env-only + audience: user + group: envonly + desc_en: "Host allowlist for the MITM tunnel lane." + desc_zh: "MITM 隧道车道的主机白名单。" + - key: BILI_RECLAIM_FETCH_PATCH + type: boolean-ish + default: "on" + kind: env-only + audience: user + group: envonly + desc_en: "Toggle for reclaiming the global fetch patch on shutdown." + desc_zh: "进程退出时回收全局 fetch 补丁的开关。" + - key: BILI_CONFLICT_SCAN + type: boolean-ish + default: "off" + kind: env-only + audience: user + group: envonly + desc_en: "Enable the install-lane conflict scanner probe." + desc_zh: "启用安装车道冲突扫描探针。" + - key: BILI_CHAIN_MAX_FUTURE_SKEW_MS + type: number + default: "(built-in)" + kind: env-only + audience: user + group: envonly + desc_en: "Tolerance for future-skewed chain checkpoint timestamps." + desc_zh: "链检查点时间戳未来偏移的容忍度。" + - key: BILI_CHAIN_RECENT_WINDOW_MS + type: number + default: "(built-in)" + kind: env-only + audience: user + group: envonly + desc_en: "Recent-window size for chain checkpoint validation." + desc_zh: "链检查点校验的近期窗口大小。" + - key: BILI_ZONE_PORT + type: number + default: "18787 base (derived per lane)" + kind: env-only + audience: user + group: envonly + desc_en: "Base port for lane-spawned proxy zones (port relocation)." + desc_zh: "车道派生代理端口区的基础端口(端口重定位)。" + - key: BILI_ZCODE_ROUTE + type: string + default: "unset" + kind: env-only + audience: user + group: envonly + desc_en: "Route selection for the zcode lane." + desc_zh: "zcode 车道的路由选择。" + - key: BILI_ZCODE_PORT + type: number + default: "unset" + kind: env-only + audience: user + group: envonly + desc_en: "Port pin for the zcode lane." + desc_zh: "zcode 车道的端口钉死。" + - key: BILI_ZCODE_SIGNING_FIXED + type: boolean-ish + default: "off" + kind: env-only + audience: user + group: envonly + desc_en: "Fixed-signing mode for the zcode credential lane." + desc_zh: "zcode 凭据车道的固定签名模式。" + - key: BILI_CLAUDE_UPSTREAM + type: string + default: "unset" + kind: env-only + audience: user + group: envonly + desc_en: "Upstream pin for the claude lane." + desc_zh: "claude 车道的上游钉死。" + - key: BILI_ATTACH_HEALTH_DEADLINE_MS + type: number + default: "(built-in)" + kind: env-only + audience: user + group: envonly + desc_en: "Deadline for attach health checks when joining an external daemon." + desc_zh: "挂接外部守护进程时健康检查的截止时间。" + - key: BILI_ATTACH_EVIDENCE_GRACE_MS + type: number + default: "(built-in)" + kind: env-only + audience: user + group: envonly + desc_en: "Grace period for attach ownership evidence." + desc_zh: "挂接归属证据的宽限期。" + - key: BILI_PROVIDER_REWRITES + type: string + default: "unset" + kind: env-only + audience: user + group: envonly + desc_en: "Provider URL rewrite rules applied before routing." + desc_zh: "路由前应用的 provider URL 重写规则。" + - key: BILI_MCP_PROXY + type: string + default: "unset" + kind: env-only + audience: internal + group: envonly + desc_en: "Spawn channel: MCP proxy target for plugin-hosted tools." + desc_zh: "派生通道:插件宿主工具的 MCP 代理目标。" + - key: BILI_PARENT_PID + type: number + default: "unset" + kind: env-only + audience: internal + group: envonly + desc_en: "Spawn channel: parent process id for lifecycle supervision." + desc_zh: "派生通道:父进程 id,用于生命周期监管。" + - key: BILI_STRICT_PORT + type: number + default: "unset" + kind: env-only + audience: internal + group: envonly + desc_en: "Spawn channel: exact-port requirement (squatters refused loudly instead of hopping)." + desc_zh: "派生通道:精确端口要求(被占用时响亮拒绝而非跳端口)。" + - key: BILI_OPENCODE_ACP_SPEC + type: string + default: "unset" + kind: env-only + audience: internal + group: envonly + desc_en: "Spawn channel: ACP spec marker for opencode-native lanes." + desc_zh: "派生通道:opencode 原生车道的 ACP 规格标记。" + - key: BILI_LAUNCHER_MODEL_WINDOWS + type: string + default: "unset" + kind: env-only + audience: internal + group: envonly + desc_en: "Launcher channel: model-window overrides passed into spawned clients." + desc_zh: "启动器通道:传入被派生客户端的模型窗口覆盖。" + - key: BILI_LAUNCHER_LANE + type: string + default: "unset" + kind: env-only + audience: internal + group: envonly + desc_en: "Launcher channel: lane identity of the spawning bili process." + desc_zh: "启动器通道:派生方 bili 进程的车道身份。" + - key: BILI_LAUNCHER_PLUGIN + type: string + default: "unset" + kind: env-only + audience: internal + group: envonly + desc_en: "Launcher channel: plugin-mode handoff marker." + desc_zh: "启动器通道:插件模式交接标记。" + - key: BILI_LAUNCHER_DIRECT + type: boolean-ish + default: "off" + kind: env-only + audience: internal + group: envonly + desc_en: "Launcher channel: bypass the injected proxy for this launch." + desc_zh: "启动器通道:本次启动绕过注入的代理。" + - key: BILI_INHERITED_HTTP_PROXY + type: string + default: "unset" + kind: env-only + audience: internal + group: envonly + desc_en: "Launcher channel: inherited http_proxy value preserved across the spawn boundary." + desc_zh: "启动器通道:跨派生边界保留的 http_proxy 继承值。" + - key: BILI_INHERITED_HTTPS_PROXY + type: string + default: "unset" + kind: env-only + audience: internal + group: envonly + desc_en: "Launcher channel: inherited https_proxy value preserved across the spawn boundary." + desc_zh: "启动器通道:跨派生边界保留的 https_proxy 继承值。" + - key: BILI_INHERITED_ALL_PROXY + type: string + default: "unset" + kind: env-only + audience: internal + group: envonly + desc_en: "Launcher channel: inherited all_proxy value preserved across the spawn boundary." + desc_zh: "启动器通道:跨派生边界保留的 all_proxy 继承值。" + - key: BILI_INHERITED_NO_PROXY + type: string + default: "unset" + kind: env-only + audience: internal + group: envonly + desc_en: "Launcher channel: inherited no_proxy value preserved across the spawn boundary." + desc_zh: "启动器通道:跨派生边界保留的 no_proxy 继承值。" + - key: BILI_NATIVE_CLAUDE + type: boolean-ish + default: "off" + kind: env-only + audience: internal + group: envonly + desc_en: "Host posture: marks a claude-native plugin process." + desc_zh: "宿主姿态:标记 claude 原生插件进程。" + - key: BILI_NATIVE_DSH + type: boolean-ish + default: "off" + kind: env-only + audience: internal + group: envonly + desc_en: "Host posture: marks a dsh-native plugin process." + desc_zh: "宿主姿态:标记 dsh 原生插件进程。" + - key: BILI_NATIVE_KIMI + type: boolean-ish + default: "off" + kind: env-only + audience: internal + group: envonly + desc_en: "Host posture: marks a kimi-native plugin process." + desc_zh: "宿主姿态:标记 kimi 原生插件进程。" + - key: BILI_NATIVE_OMP + type: boolean-ish + default: "off" + kind: env-only + audience: internal + group: envonly + desc_en: "Host posture: marks an omp-native plugin process." + desc_zh: "宿主姿态:标记 omp 原生插件进程。" + - key: BILI_NATIVE_OPENCODE + type: boolean-ish + default: "off" + kind: env-only + audience: internal + group: envonly + desc_en: "Host posture: marks an opencode-native plugin process." + desc_zh: "宿主姿态:标记 opencode 原生插件进程。" + - key: BILI_NATIVE_PI + type: boolean-ish + default: "off" + kind: env-only + audience: internal + group: envonly + desc_en: "Host posture: marks a pi-native plugin process." + desc_zh: "宿主姿态:标记 pi 原生插件进程。" + - key: BILI_NATIVE_ZCODE + type: boolean-ish + default: "off" + kind: env-only + audience: internal + group: envonly + desc_en: "Host posture: marks a zcode-native plugin process." + desc_zh: "宿主姿态:标记 zcode 原生插件进程。" + - key: BILI_PI_BIN + type: string + default: "pi (PATH lookup)" + kind: env-only + audience: internal + group: envonly + desc_en: "Host posture: explicit binary path for the pi client binary." + desc_zh: "宿主姿态:pi 客户端二进制的显式路径。" + - key: BILI_DSH_BIN + type: string + default: "dsh (PATH lookup)" + kind: env-only + audience: internal + group: envonly + desc_en: "Host posture: explicit binary path for the dsh client binary." + desc_zh: "宿主姿态:dsh 客户端二进制的显式路径。" + - key: BILI_MODEL_INFO_RETRY_MS + type: number + default: "(built-in)" + kind: env-only + audience: test + group: envonly + desc_en: "Test hook: retry interval for model-info lookups." + desc_zh: "测试钩子:模型信息查询的重试间隔。" + - key: BILI_DSH_RETRY_INTERVAL_MS + type: number + default: "(built-in)" + kind: env-only + audience: test + group: envonly + desc_en: "Test hook: retry interval for dsh lane operations." + desc_zh: "测试钩子:dsh 车道操作的重试间隔。" + - key: BILI_DSH_RECOVERY_INTERVAL_MS + type: number + default: "(built-in)" + kind: env-only + audience: test + group: envonly + desc_en: "Test hook: recovery sweep interval for the dsh lane." + desc_zh: "测试钩子:dsh 车道恢复清扫间隔。" + - key: ACP_DUMP_DIR + type: string + default: "unset" + kind: env-only + audience: user + group: envonly + desc_en: "Base directory override for wire dump output (path relocation)." + desc_zh: "线路转储输出基础目录覆盖(路径重定位)。" + - key: BILI_STREAM_STALL_MS + type: number + default: "(built-in)" + kind: env-only + audience: user + group: envonly + desc_en: "Stall-detection timeout for committed upstream streams (no-byte silence before abort)." + desc_zh: "已提交上游流的停滞检测超时(无字节静默多久后中止)。" + - key: BILI_CLIENT_BIN + type: string + default: "unset (PATH lookup)" + kind: env-only + audience: internal + group: envonly + desc_en: "Explicit binary override for the launched client (resolved on PATH)." + desc_zh: "被启动客户端二进制的显式覆盖(在 PATH 上解析)。" + - key: BILI_CONVERSATION_ID + type: string + default: "unset (per-spawn UUID written by bili)" + kind: env-only + audience: internal + group: envonly + desc_en: "Per-spawn conversation UUID handed to MCP children whose host passes no session id (headless self-registration)." + desc_zh: "传给 MCP 子进程的逐派生会话 UUID(宿主不传会话 id 时用于无头自注册)。" + - key: BILI_LAUNCHER_MODEL_MAX_OUTPUTS + type: "string (JSON id→maxOutput map)" + default: "unset" + kind: env-only + audience: internal + group: envonly + desc_en: "Launcher channel: per-model max-output map handed to the spawned proxy for output-headroom reservation." + desc_zh: "启动器通道:传给被派生代理的逐模型最大输出映射,用于输出预留。" + - key: BILI_LAUNCH_TOKEN + type: string + default: "unset (generated per launch)" + kind: env-only + audience: internal + group: envonly + desc_en: "Launch token authenticating lane-internal endpoints between a launcher and its spawned proxy (secret)." + desc_zh: "启动令牌,鉴权启动器与其派生代理之间的车道内部端点(机密)。" + - key: BILI_MCP_DEFAULT_ORIGIN + type: string + default: "http://127.0.0.1:8787" + kind: env-only + audience: internal + group: envonly + desc_en: "Fallback proxy origin candidate for MCP entry points." + desc_zh: "MCP 入口的兜底代理 origin 候选。" + - key: BILI_MCP_NO_ORPHAN_ADOPT + type: boolean-ish + default: "off (=1 disables orphan adoption)" + kind: env-only + audience: internal + group: envonly + desc_en: "Opt out of resumed-session orphan adoption when several host sessions share one proxy." + desc_zh: "多个宿主会话共享一个代理时,退出恢复会话的孤儿收养。" + - key: BILI_MITM_HOSTS + type: "string[] (csv)" + default: "unset" + kind: env-only + audience: internal + group: envonly + desc_en: "Launcher channel: MITM whitelist hosts handed to the spawned proxy (distinct from the config-file twin BILI_MITM_DOMAINS)." + desc_zh: "启动器通道:传给被派生代理的 MITM 白名单主机(区别于配置文件对应项 BILI_MITM_DOMAINS)。" + - key: BILI_PLUGIN_AGENT + type: boolean-ish + default: "off" + kind: env-only + audience: internal + group: envonly + desc_en: "Spawn channel: marks a plugin-agent process." + desc_zh: "派生通道:标记插件 agent 进程。" diff --git a/website/config-reference/process.yaml b/website/config-reference/process.yaml new file mode 100644 index 0000000000..ad33bf16c1 --- /dev/null +++ b/website/config-reference/process.yaml @@ -0,0 +1,213 @@ +# 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: "network — transport timeouts & replays: upstreamTimeoutMs 720000 · requestWatchdogMs 2× · replayRetryMax 3 · replayRetryBaseMs 1500 · keepAliveTimeoutMs 5000 · clientErrorBackstopMs 30000 · exposureLogIntervalMs 3600000 · streamKeepAliveMs 15000 · preflightHoldMs 30000 · preflightDeadEndCooldownMs 300000 · proxyKeepAliveMaxMs 55000." + site_zh: "network —— 传输超时与重放:upstreamTimeoutMs 720000 · requestWatchdogMs 2× · replayRetryMax 3 · replayRetryBaseMs 1500 · keepAliveTimeoutMs 5000 · clientErrorBackstopMs 30000 · exposureLogIntervalMs 3600000 · streamKeepAliveMs 15000 · preflightHoldMs 30000 · preflightDeadEndCooldownMs 300000 · proxyKeepAliveMaxMs 55000。" + - 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: 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: "persist — session persistence to disk: enabled true · zstd false · debounceMs 500 · tailTokens 16384 · epermAlertThreshold 5 · epermAlertRepeatMs 0." + site_zh: "persist —— 会话落盘持久化:enabled true · zstd false · debounceMs 500 · tailTokens 16384 · epermAlertThreshold 5 · epermAlertRepeatMs 0。" + - 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: 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: "sessions — max 256 (LRU) · gc { enabled false, maxAgeDays 7, maxTokens 1000000, intervalMs 3600000 } — GC is opt-in; user data is never pruned silently." + site_zh: "sessions —— max 256 (LRU) · gc { enabled false, maxAgeDays 7, maxTokens 1000000, intervalMs 3600000 } —— 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.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: "16777216 (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: "plugin.snapshotCapBytes — fork API snapshot cap (default 16 MiB; 0 disables snapshots)." + site_zh: "plugin.snapshotCapBytes —— fork API 快照上限(默认 16 MiB;0 禁用快照)。" diff --git a/website/config-reference/providers.yaml b/website/config-reference/providers.yaml new file mode 100644 index 0000000000..0034da0e36 --- /dev/null +++ b/website/config-reference/providers.yaml @@ -0,0 +1,159 @@ +# Config reference seed — provider route table fields (#2107 single source of truth). +# Edit HERE, then run: node tools/gen-config-docs.mjs generate +domain: providers +entries: + - key: models + type: "record name → { context?, output?, compress?, benefit? }" + default: "{}" + group: providers + id: cr.models + render: route-row + desc_en: "Per-model declarations: context window, output ceiling, per-model compression overrides; not a traffic filter." + desc_zh: "逐模型声明:上下文窗口、输出上限、逐模型压缩覆盖;不是流量过滤器。" + site_en: "Record of model name → {context?, output?, compress?, benefit?}: declares each model's context window, output ceiling, and per-model compression overrides (benefit marks free-quota billing). Not a traffic filter." + site_zh: "模型名 → {context?, output?, compress?, benefit?} 的记录:声明每个模型的上下文窗口、输出上限与逐模型压缩覆盖(benefit 标记免费额度计费)。不是流量过滤器。" + - key: models.context + type: number + default: "unset (model registry)" + group: providers + desc_en: "Context window tokens declared for this model name." + desc_zh: "为该模型名声明的上下文窗口 token 数。" + - key: models.output + type: number + default: "unset" + group: providers + desc_en: "Output token ceiling declared for this model name." + desc_zh: "为该模型名声明的输出 token 上限。" + - key: models.compress + type: object + default: "unset" + group: providers + desc_en: "Level-3 compression overrides for this model (deepest in the global→provider→model merge)." + desc_zh: "该模型的第 3 级压缩覆盖(全局→provider→模型合并中最深)。" + - key: models.benefit + type: boolean + default: "false" + group: providers + desc_en: "Marks free-quota billing for this model in the economics ledger." + desc_zh: "在经济学账本中标记该模型为免费额度计费。" + - key: proxy + type: "string (\"\" = explicit direct)" + default: "unset" + group: providers + id: cr.proxy + render: route-row + desc_en: "Per-route outbound proxy URL." + desc_zh: "本路由出站代理地址。" + site_en: "Per-route outbound proxy URL; empty string = explicitly direct." + site_zh: "本路由出站代理地址;空字符串 = 显式直连。" + - key: compressProtocol + type: "\"tools\" (default) | \"marker\"" + default: "\"tools\"" + group: providers + id: cr.cp + render: route-row + desc_en: "Which ACP injection surface this lane speaks." + desc_zh: "本通道的 ACP 注入面。" + site_en: "Which ACP injection surface this lane speaks: native tools (default) or prompt markers." + site_zh: "本通道的 ACP 注入面:原生工具(默认)或提示词标记。" + - key: protocol + type: "\"anthropic\" | \"openai\" | \"responses\" | \"google\"" + default: "inferred from the URL marker" + group: providers + id: cr.proto + render: route-row + desc_en: "Declare this lane's wire protocol; a client-side /bili// URL marker outranks the declaration." + desc_zh: "声明本通道的线上协议;客户端侧 /bili// URL 标记优先级更高。" + site_en: "Declare this lane's wire protocol. A client-side /bili/<protocol>/ URL marker outranks the declaration; unparseable bodies relay verbatim." + site_zh: "声明本通道的线上协议。客户端侧 /bili/<protocol>/ URL 标记优先级更高;不可解析的请求体原样转发。" + - key: compress + type: "object (level 2)" + default: "unset" + group: providers + id: cr.compress + render: route-row + desc_en: "Any compress field can be overridden here — level 2 of the global→provider→model merge." + desc_zh: "任意 compress 字段可在此覆盖——全局→provider→模型三级合并的第 2 级。" + site_en: "Any compress field can be overridden here — level 2 of the global→provider→model merge (per-field, deepest wins)." + site_zh: "任意 compress 字段可在此覆盖——全局→provider→模型三级合并的第 2 级(逐字段、最深层胜出)。" + - key: compat + type: "{ roles?, dropFields? }" + default: "{}" + group: providers + id: cr.compat + render: route-row + desc_en: "Per-route wire-compat overrides; provider entries beat the global block per key; dropFields union additively." + desc_zh: "逐路由线上兼容覆盖;provider 条目按键级覆盖全局;dropFields 加法并集。" + site_en: "{ roles?, dropFields? } — remap roles the upstream rejects (e.g. developer→system); provider entries beat the global block per key; dropFields strips fields strict schemas reject (additive union)." + site_zh: "{ roles?, dropFields? } —— 重写上游拒收的角色(如 developer→system);provider 条目按键级覆盖全局;dropFields 剔除严格 schema 拒收的字段(加法并集)。" + - key: direct + type: boolean + default: "false" + group: providers + id: cr.direct + render: route-row + desc_en: "Client-side exemption: traffic for this upstream is never pointed at bili at all." + desc_zh: "客户端侧豁免:该上游流量完全不指向 bili。" + site_en: "Client-side exemption: traffic for this upstream is never pointed at bili at all — unlike passthrough, it does not even terminate there." + site_zh: "客户端侧豁免:该上游流量完全不指向 bili——与 passthrough 不同,连终结都不经过它。" + - key: passthrough + type: boolean + default: "false" + group: providers + id: cr.pt + render: route-row + desc_en: "Route-scoped byte-for-byte relay with no session state — for anti-fraud upstreams." + desc_zh: "路由级逐字节透传、无会话状态——面向反作弊上游。" + site_en: "Route-scoped byte-for-byte relay with no session state — for anti-fraud upstreams." + site_zh: "路由级逐字节透传、无会话状态——面向反作弊上游。" + - key: imageBilling + type: "\"auto\" | \"pixels\" | \"bytes\"" + default: "auto (→ pixels)" + group: providers + id: cr.ib + render: route-row + desc_en: "Image-token counting basis for this route; bytes is an explicit opt-in for byte relays." + desc_zh: "本路由图片 token 计费口径;bytes 为字节中继的显式指定。" + site_en: "Image-token counting basis for this route: auto (→ pixels), pixels, or bytes (explicit opt-in for byte relays)." + site_zh: "本路由图片 token 计费口径:auto(默认→pixels)、pixels 或 bytes(字节中继需显式指定)。" + - key: imageTokenCap + type: number + default: "unset (uncapped)" + group: providers + id: cr.itc + render: route-row + desc_en: "Per-image token cost cap for this route." + desc_zh: "本路由单张图片 token 成本上限。" + site_en: "Per-image token cost cap for this route; unset = uncapped." + site_zh: "本路由单张图片 token 成本上限;未设置 = 不限制。" + - key: resign + type: "scheme → { enabled?, passthrough?, credentialRef? }" + default: "{} (global map applies)" + group: providers + id: cr.resign + render: route-row + desc_en: "Per-route overrides of the global resign map (level 2, deepest wins)." + desc_zh: "按路由覆盖全局 resign 映射(第 2 级,最深层胜出)。" + site_en: "Per-route overrides of the global resign map (level 2, deepest wins)." + site_zh: "按路由覆盖全局 resign 映射(第 2 级,最深层胜出)。" + - key: bind + type: "string (named entries only)" + default: "unset" + group: providers + id: cr.bind + render: route-row + desc_en: "Deep-merge a named (non-URL) entry onto the bound URL lane as an alias; without bind a named entry stays routing-inert." + desc_zh: "把具名(非 URL)条目深合并到所绑定的 URL 通道作为别名;无 bind 的具名条目不参与路由。" + site_en: "Named (non-URL) entry: deep-merged onto the bound URL lane at config load as an alias. Without bind a named entry stays routing-inert." + site_zh: "具名(非 URL)条目:加载配置时深合并到所绑定的 URL 通道作为别名;无 bind 的具名条目不参与路由。" + - key: compactionOptIn + type: boolean + default: "false" + env: BILI_NON_HTTP_PROVIDERS + group: providers + id: cr.optin + render: route-row + desc_en: "Named entries only: opt a non-http(s)-baseUrl provider into compaction ownership (pi/omp lanes); unions with env BILI_NON_HTTP_PROVIDERS." + desc_zh: "仅命名条目:把非 http(s) baseUrl 供应商纳入压缩所有权(pi/omp 车道);与 env BILI_NON_HTTP_PROVIDERS 取并集。" + site_en: "Named entries only: opt a non-http(s)-baseUrl provider into compaction ownership (pi/omp lanes); unions with env BILI_NON_HTTP_PROVIDERS." + site_zh: "仅命名条目:把非 http(s) baseUrl 供应商纳入压缩所有权(pi/omp 车道);与 env BILI_NON_HTTP_PROVIDERS 取并集。" diff --git a/website/config-reference/server.yaml b/website/config-reference/server.yaml new file mode 100644 index 0000000000..257174575a --- /dev/null +++ b/website/config-reference/server.yaml @@ -0,0 +1,362 @@ +# Config reference seed — server domain (#2107 single source of truth). +# Edit HERE, then run: node tools/gen-config-docs.mjs generate +# Field guide: key (dot path) · type · default · env (var or [vars]) · +# group (doc index section) · id (stable site i18n key) · site_group (site top-list group) · +# desc_en/desc_zh (manual index one-liners, no backticks) · site_en/site_zh (site render, HTML allowed) · +# kind: env-only (no file key; key IS the env var name) · audience: user|internal|test · deprecated: true +domain: server +entries: + - key: port + type: number + default: "8787" + env: [ACP_PORT, PORT] + group: core + id: tt.port + site_group: core + desc_en: "TCP port the proxy listens on (user zone; lane-spawned proxies use BILI_ZONE_PORT instead)." + desc_zh: "代理监听端口(用户区;车道派生代理使用 BILI_ZONE_PORT,互不干扰)。" + site_en: "port — listen port (default 8787)." + site_zh: "port —— 监听端口(默认 8787)。" + - key: host + type: string + default: "127.0.0.1" + env: ACP_HOST + group: core + id: tt.host + site_group: core + desc_en: "Bind address. 127.0.0.1 = loopback only; :: = dual-stack; 0.0.0.0 exposes outward (no auth — trusted networks only)." + desc_zh: "绑定地址。127.0.0.1 仅本机回环;:: 双栈;0.0.0.0 对外暴露(无鉴权,仅限可信网络)。" + site_en: "host — bind address (default 127.0.0.1; \"::\" is dual-stack, 0.0.0.0 exposes outward)." + site_zh: "host —— 绑定地址(默认 127.0.0.1;\"::\" 双栈,0.0.0.0 对外暴露)。" + - key: sessionHeader + type: string + default: "x-acp-session" + env: ACP_SESSION_HEADER + group: core + id: tt.sessionheader + site_group: core + desc_en: "HTTP header carrying the conversation id; same value shares compression state." + desc_zh: "携带会话 id 的请求头;相同取值的请求共享压缩状态。" + site_en: "sessionHeader — HTTP header carrying the session id (default x-acp-session)." + site_zh: "sessionHeader —— 携带会话 id 的请求头(默认 x-acp-session)。" + - key: log + type: boolean + default: "true" + env: ACP_LOG + group: core + id: tt.log + site_group: core + desc_en: "Per-request logging master switch." + desc_zh: "逐请求日志总开关。" + site_en: "log — file logging master switch (on by default)." + site_zh: "log —— 文件日志总开关(默认开)。" + - key: logFile + type: string + default: "XDG state path (off disables the file, keeps stderr)" + env: ACP_LOG_FILE + group: core + id: tt.logfile + site_group: core + desc_en: "Explicit path for bili.log; auto-rotates at 10 MB." + desc_zh: "bili.log 的显式路径;10 MB 自动轮转。" + site_en: "logFile — explicit path for bili.log (env ACP_LOG_FILE wins)." + site_zh: "logFile —— bili.log 显式路径(环境变量 ACP_LOG_FILE 优先)。" + - key: debug + type: boolean + default: "false" + env: ACP_DEBUG + group: core + id: tt.debug + site_group: core + desc_en: "Verbose per-request logging." + desc_zh: "逐请求详细日志。" + site_en: "debug — verbose per-request logging." + site_zh: "debug —— 逐请求详细日志。" + - key: dumpSse + type: string + default: "unset (directory)" + env: ACP_DUMP_SSE + group: core + id: tt.dumsse + site_group: core + desc_en: "Directory to dump raw SSE frames for debugging, including loop-originated responses." + desc_zh: "原始 SSE 帧转储目录(排障用),含循环内发起的上游响应。" + site_en: "dumpSse — raw SSE stream dump level for debugging." + site_zh: "dumpSse —— 原始 SSE 流转储级别(排障用)。" + - key: passthrough + type: boolean + default: "false" + env: ACP_PASSTHROUGH + group: core + id: tt.pt3 + site_group: core + desc_en: "Global raw-relay switch: forward every request without compression, tool injection, or nudging." + desc_zh: "全局裸转发开关:所有请求不做压缩、工具注入或提醒直接转发。" + site_en: "passthrough — global raw-relay switch (off by default; ACP_PASSTHROUGH / --passthrough win over the file)." + site_zh: "passthrough —— 全局裸转发开关(默认关;ACP_PASSTHROUGH / --passthrough 优先于文件)。" + - key: upstream + type: string + default: "https://api.anthropic.com" + env: ACP_UPSTREAM + group: upstream + id: tt.upstream + site_group: up + desc_en: "Fallback upstream base URL when a request matches no provider route." + desc_zh: "请求未命中任何路由时的兜底上游基础地址。" + site_en: "upstream — fallback upstream base URL (ACP_UPSTREAM overrides)." + site_zh: "upstream —— 兜底上游基础地址(ACP_UPSTREAM 覆盖)。" + - key: proxy + type: string + default: "unset (direct)" + env: BILI_UPSTREAM_PROXY + group: upstream + id: tt.proxy + site_group: up + desc_en: "Global outbound proxy for the proxy's own egress. Resolution: per-route → BILI_UPSTREAM_PROXY → Web UI → this value → HTTP(S)_PROXY → Windows system proxy → direct. Empty string = explicitly direct; SOCKS5 rejected." + desc_zh: "代理自身出站的全局代理。解析顺序:按路由 → BILI_UPSTREAM_PROXY → Web UI → 本值 → HTTP(S)_PROXY 环境变量 → Windows 系统代理 → 直连。空字符串 = 显式直连;不支持 SOCKS5。" + site_en: "proxy — global outbound proxy. Resolution: per-route → BILI_UPSTREAM_PROXY → Web UI → this value → HTTP(S)_PROXY env → Windows system proxy → direct. Empty string = explicitly direct; SOCKS5 is rejected." + site_zh: "proxy —— 全局出站代理。解析顺序:按路由 → BILI_UPSTREAM_PROXY → Web UI → 本值 → HTTP(S)_PROXY 环境变量 → Windows 系统代理 → 直连。空字符串 = 显式直连;不支持 SOCKS5。" + - key: upstreamProxy + type: string + default: "unset" + group: upstream + desc_en: "Web-UI manual proxy tier (written by the dashboard's proxy editor); sits below BILI_UPSTREAM_PROXY in resolution order." + desc_zh: "Web 面板手动设置的代理层级(由仪表盘代理编辑器写入);解析顺序中位于 BILI_UPSTREAM_PROXY 之下。" + - key: upstreamProxyMode + type: "\"auto\" | \"manual\" | \"direct\"" + default: "auto (unset behaves as direct)" + env: BILI_UPSTREAM_PROXY_MODE + group: upstream + desc_en: "How the global proxy is sourced: auto (env/system discovery), manual (Web-UI value only), direct (never use a proxy)." + desc_zh: "全局代理来源策略:auto(环境变量/系统发现)、manual(仅 Web 面板值)、direct(从不使用代理)。" + - key: providersPath + type: string + default: "unset" + env: ACP_PROVIDERS + group: mitm + id: tt.ppath + site_group: mitm + desc_en: "Path to an external providers.json (legacy/shared routes file); beats both inline providers and the config-file location." + desc_zh: "外部 providers.json 路径(遗留/共享路由文件);优先于内联 providers 与配置文件位置。" + site_en: "providersPath — external routes file path (env ACP_PROVIDERS beats both it and inline providers)." + site_zh: "providersPath —— 外部路由文件路径(环境变量 ACP_PROVIDERS 优先于它与内联 providers)。" + - key: providers + type: "record url-prefix → route entry" + default: "{}" + group: upstream + desc_en: "Route table: URL-prefix keys to per-provider entries (models, compress, compat, …). See the Providers section." + desc_zh: "路由表:URL 前缀键到逐 provider 条目(models、compress、compat…)的映射。详见 Providers 章节。" + - key: modelContextLimit + type: number + default: "200000" + env: ACP_MODEL_CONTEXT_LIMIT + group: upstream + id: tt.mcl2 + site_group: up + desc_en: "Legacy global window ceiling (highest-priority window source and usage denominator); prefer compress.modelContextLimit." + desc_zh: "旧版全局窗口上限(窗口来源中优先级最高,兼作使用率分母);建议改用 compress.modelContextLimit。" + site_en: "modelContextLimit — legacy global window ceiling (default 200000); prefer compress.modelContextLimit." + site_zh: "modelContextLimit —— 旧版全局窗口上限(默认 200000);建议改用 compress.modelContextLimit。" + - key: imageBilling + type: "\"auto\" | \"pixels\" | \"bytes\"" + default: "auto (resolves to pixels)" + env: BILI_IMAGE_BILLING + group: upstream + id: tt.ib2 + site_group: up + desc_en: "Global image-token estimation basis; live-read per request, beats every per-provider setting." + desc_zh: "全局图片 token 估算口径;逐请求实时读取,优先于所有逐 provider 设置。" + site_en: "imageBilling — global image-token estimation: \"auto\" (default → pixels), \"pixels\" or \"bytes\" (explicit opt-in for byte relays)." + site_zh: "imageBilling —— 全局图片 token 估算口径:\"auto\"(默认→pixels)、\"pixels\" 或 \"bytes\"(字节中继需显式指定)。" + - key: imageTokenCap + type: number + default: "unset (uncapped)" + env: BILI_IMAGE_TOKEN_CAP + group: upstream + id: tt.itc2 + site_group: up + desc_en: "Global per-image token ceiling applied on top of the resolved billing mode; live-read per request." + desc_zh: "全局单图 token 上限,叠加在计费口径之上生效;逐请求实时读取。" + site_en: "imageTokenCap — global per-image token cap; unset = uncapped (BILI_IMAGE_TOKEN_CAP wins, read live)." + site_zh: "imageTokenCap —— 全局单图 token 上限;未设置 = 不限(BILI_IMAGE_TOKEN_CAP 优先且实时读取)。" + - key: maskHosts + type: boolean + default: "true" + env: BILI_LOG_MASK_HOSTS + group: behavior + id: tt.mask + site_group: beh + desc_en: "Mask non-public target hosts in logs as ; credential headers are always masked regardless." + desc_zh: "日志中把非公开目标主机遮成 ;凭据头无论此开关如何总是遮盖。" + site_en: "maskHosts — mask non-public host names in logs as <private-host> (on by default; credentials are always masked)." + site_zh: "maskHosts —— 日志中把非公开主机名遮成 <private-host>(默认开;凭据总是遮盖)。" + - key: subagentSplit + type: boolean + default: "true" + env: BILI_SUBAGENT_SPLIT + group: behavior + id: tt.subagent + site_group: beh + desc_en: "Claude Code subagents get their own session namespace (|sub:) instead of queueing behind the main session." + desc_zh: "Claude 子代理拥有独立会话命名空间(|sub:),不再排队在主会话锁后。" + site_en: "subagentSplit — Claude subagents get their own session namespace (on by default)." + site_zh: "subagentSplit —— Claude 子代理拥有独立会话命名空间(默认开)。" + - key: forkAdoption + type: boolean + default: "false" + env: BILI_FORK_ADOPTION + group: behavior + id: tt.fork + site_group: beh + desc_en: "Anonymous forks inherit the parent's compression blocks whose source content is fully present in the forked request." + desc_zh: "匿名 fork 会话继承父会话中源内容完整存在于本次请求里的压缩块。" + site_en: "forkAdoption — adopt anonymous forks into their parent session (off by default)." + site_zh: "forkAdoption —— 匿名 fork 会话并入父会话(默认关)。" + - key: resumeInheritance + type: boolean + default: "true" + env: BILI_RESUME_INHERITANCE + group: behavior + id: tt.resinherit + site_group: beh + desc_en: "Identified clients resuming under a new session id inherit the parent's ref assignments and fully-present compression blocks." + desc_zh: "以新会话 id 恢复的已识别客户端继承父会话的引用编号与完整存在的压缩块。" + site_en: "resumeInheritance — inherited refs/blocks on resume (cc --resume) (on by default)." + site_zh: "resumeInheritance —— resume(cc --resume)继承引用与区块(默认开)。" + - key: chainContentDetection + type: boolean + default: "false" + env: BILI_CHAIN_CONTENT + group: behavior + id: tt.chain + site_group: beh + desc_en: "Body-content detection of bili→bili chains (off: body scanning can false-positive on CCR/model-echoed text); by default only x-bili-hop drives chain recognition." + desc_zh: "按请求体内容识别 bili→bili 链(默认关:正文扫描会对 CCR/模型回声文本误报);默认仅 x-bili-hop 驱动链识别。" + site_en: "chainContentDetection — recognize bili-owned traffic by body content (off; false-positive risk)." + site_zh: "chainContentDetection —— 按请求体内容识别 bili 自有流量(默认关;有误报风险)。" + - key: chainEgressStamp + type: boolean + default: "false" + env: BILI_CHAIN_STAMP + group: behavior + id: tt.stamp + site_group: beh + desc_en: "Emit the model-visible checkpoint carrier on egress (off: models treat it as phantom input and burn tokens)." + desc_zh: "在出口消息上打模型可见的 链完整性标记(默认关:模型会把它当幽灵输入而消耗 token)。" + site_en: "chainEgressStamp — model-visible stamp on egress messages (off; burns tokens)." + site_zh: "chainEgressStamp —— 在出口消息上打模型可见的标记(默认关;消耗 token)。" + - key: stableSystemAnchor + type: boolean + default: "false" + env: BILI_STABLE_SYSTEM_ANCHOR + group: behavior + id: tt.anchor + site_group: beh + desc_en: "Best-effort wire-layer prefix-cache anchor: re-sends the first-seen head system bytes even when the client changes them (plain-proxy lanes only)." + desc_zh: "线路层尽力而为的前缀缓存锚点:客户端改动头部 system 时仍重发首次见到的字节(仅纯代理通道)。" + site_en: "stableSystemAnchor — best-effort wire-layer prefix-cache anchor (off; plain-proxy lanes)." + site_zh: "stableSystemAnchor —— 线路层尽力而为的前缀缓存锚点(默认关;纯代理通道)。" + - key: compat + type: "{ roles?, dropFields?, streamErrorShape?, noCacheControl?, keepResponseId? }" + default: "{} (disabled)" + group: behavior + id: tt.compat + site_group: beh + desc_en: "Global wire-compat block: role remaps, strict-schema field drops, stream error shape, cache-control handling." + desc_zh: "全局线上兼容块:角色映射、严格 schema 字段剔除、流式错误形态、缓存控制处理。" + site_en: "compat — wire-compatibility block: role remaps, stream error shape, strict-schema field drops, cache-control handling." + site_zh: "compat —— 线上兼容块:角色映射、流式错误形态、严格 schema 字段剔除、缓存控制处理。" + - key: compat.roles + type: "record role → role" + default: "{}" + group: behavior + desc_en: "Map message roles to the names your upstream accepts (e.g. developer→system); exact-match roles only, per-provider entries win per key." + desc_zh: "把消息角色映射为上游接受的名字(如 developer→system);仅精确匹配角色,逐 provider 条目按键级胜出。" + - key: compat.dropFields + type: "string[] (dot paths)" + default: "[]" + group: behavior + desc_en: "Dot-path fields stripped from every forwarded body for strict-schema gateways that 400 on unknown fields; global + per-provider lists union additively." + desc_zh: "从每个转发请求体中剔除的点路径字段,面向对未知字段返回 400 的严格 schema 网关;全局与逐 provider 列表加法并集。" + - key: compat.streamErrorShape + type: "\"protocol\" | \"completion\"" + default: "protocol" + env: BILI_STREAM_ERROR_SHAPE + group: behavior + desc_en: "How upstream stream failures are presented after the 200 is committed: protocol-native error frames (default) or the legacy synthesized-completion shape." + desc_zh: "200 已提交后上游流失败的呈现方式:协议原生错误帧(默认)或旧版合成完成形态。" + - key: compat.noCacheControl + type: boolean + default: "false" + env: BILI_NO_CACHE_CONTROL + group: behavior + desc_en: "Stop stamping Anthropic-lane cache_control breakpoints entirely (escape hatch for upstreams/relays with their own breakpoint policy)." + desc_zh: "完全停止 Anthropic 通道的 cache_control 断点打标(面向拒收该字段或有自有断点策略的上游/中继的逃生门)。" + - key: compat.keepResponseId + type: boolean + default: "false" + env: ACP_KEEP_RESPONSE_ID + group: behavior + desc_en: "Preserve previous_response_id on kernel-rebuilt Responses requests (default strips it so rebuilt bodies never reference ids the upstream never issued)." + desc_zh: "在内核重建的 Responses 请求上保留 previous_response_id(默认剔除,使重建请求体永不引用上游从未签发过的响应 id)。" + - key: resign + type: "scheme → { enabled?, passthrough?, credentialRef? }" + default: "{} (armed; built-in scheme sdk-hmac-sha256)" + env: [BILI_RESIGN, BILI_RESIGN_PASSTHROUGH, BILI_CODEARTS_REF, BILI_RESIGN_BENEFIT] + group: behavior + desc_en: "Re-sign arm keyed by Authorization scheme: signed model requests tunnel with every egress body re-signed; unresignable requests are refused locally 403 unless passthrough opts that scheme into verbatim forwarding." + desc_zh: "按 Authorization 方案键控的重签名臂:可重签名的模型请求全程重签转发;无法重签的请求本地 403 拒绝,除非该方案经 passthrough 选择原文透传。" + - key: promptCache.routing + type: "\"auto\" | \"enabled\" | \"disabled\"" + default: "auto" + env: ACP_PROMPT_CACHE_ROUTING + group: behavior + desc_en: "Prompt-cache routing posture for cache-aware lane selection." + desc_zh: "面向缓存感知路由选择的提示词缓存路由姿态。" + - key: native.attachExternal + type: boolean + default: "false" + env: BILI_NATIVE_ATTACH_EXTERNAL + group: behavior + id: tt.nat + site_group: adv + desc_en: "Let launcher-less native plugins attach to an external (lane'd, unarmed) daemon instead of spawning their own." + desc_zh: "允许无启动器的原生插件挂到外部(车道化、未武装看门狗)守护进程,而不是自行派生。" + site_en: "native.attachExternal — let launcher-less native plugins attach to an external daemon (off by default)." + site_zh: "native.attachExternal —— 允许无启动器的原生插件挂到外部守护进程(默认关)。" + - key: claude.nativePort + type: number + default: "unset (lane sticky zone port)" + env: BILI_CLAUDE_NATIVE_PORT + group: behavior + desc_en: "Exact port pin for the claude native lane's hook-spawned proxy (strict-port: squatters are refused loudly)." + desc_zh: "claude 原生车道钩子派生代理的精确端口钉死(严格端口:被占用时响亮拒绝而非跳端口)。" + - key: mitm.enabled + type: boolean + default: "true" + env: BILI_MITM + group: mitm + id: tt.mitm + site_group: mitm + desc_en: "HTTPS interception switch for login clients that hard-code their upstream; domains are whitelisted on first sight." + desc_zh: "面向写死 HTTPS 上游的登录客户端的拦截开关;域名首次发现即加入白名单。" + site_en: "mitm.enabled / mitm.domains — HTTPS interception switch and whitelist domains for login clients." + site_zh: "mitm.enabled / mitm.domains —— 登录客户端 HTTPS 拦截开关与白名单域名。" + - key: mitm.domains + type: "string[]" + default: "[]" + env: BILI_MITM_DOMAINS + group: mitm + desc_en: "Explicit MITM whitelist domains (unioned with first-sight auto-whitelisting)." + desc_zh: "显式 MITM 白名单域名(与首次发现的自动白名单取并集)。" + - key: mitm.handshakeTimeoutMs + type: number + default: "10000" + env: BILI_MITM_HANDSHAKE_TIMEOUT_MS + group: mitm + id: tt.mitm2 + site_group: mitm + desc_en: "TLS handshake timeout for intercepted connections." + desc_zh: "被拦截连接的 TLS 握手超时。" + site_en: "mitm.handshakeTimeoutMs — TLS handshake timeout (default 10000)." + site_zh: "mitm.handshakeTimeoutMs —— TLS 握手超时(默认 10000)。" diff --git a/website/config-reference/updates.yaml b/website/config-reference/updates.yaml new file mode 100644 index 0000000000..a0b02744b3 --- /dev/null +++ b/website/config-reference/updates.yaml @@ -0,0 +1,97 @@ +# Config reference seed — updates & advisories (#2107 single source of truth). +# Edit HERE, then run: node tools/gen-config-docs.mjs generate +domain: updates +entries: + - key: autoUpdate + type: boolean + default: "true" + env: ACP_AUTO_UPDATE + group: updates + id: tt.aupd + site_group: diag + desc_en: "Automatic npm version checks (every ~3 min); disable via ACP_AUTO_UPDATE=0 or --no-auto-update." + desc_zh: "自动 npm 版本检查(约每 3 分钟);ACP_AUTO_UPDATE=0 或 --no-auto-update 关闭。" + site_en: "autoUpdate — automatic version checks (on by default; disable via ACP_AUTO_UPDATE=0 or --no-auto-update)." + site_zh: "autoUpdate —— 自动版本检查(默认开;ACP_AUTO_UPDATE=0 或 --no-auto-update 关闭)。" + - key: autoRestartOnUpdate + type: boolean + default: "false" + env: ACP_AUTO_RESTART_ON_UPDATE + group: updates + id: tt.arst + site_group: diag + desc_en: "Restart the daemon automatically once a newer version has been installed." + desc_zh: "新版本装好后自动重启守护进程。" + site_en: "autoRestartOnUpdate — restart the daemon automatically once a newer version is installed (opt-in)." + site_zh: "autoRestartOnUpdate —— 新版本装好后自动重启守护进程(可选开启)。" + - key: updateTag + type: string + default: "latest" + env: ACP_UPDATE_TAG + group: updates + id: tt.utag + site_group: diag + desc_en: "npm dist-tag channel for self-updates: latest (default), dev, or pr." + desc_zh: "自更新的 npm dist-tag 通道:latest(默认)、dev 或 pr。" + site_en: "updateTag — npm dist-tag channel: latest (default), dev, or pr." + site_zh: "updateTag —— npm dist-tag 通道:latest(默认)、dev 或 pr。" + - key: update + type: object + default: "{} (all defaults)" + group: updates + id: tt.update + site_group: proc + desc_en: "Self-update channel settings." + desc_zh: "自更新通道设置。" + site_en: "update — self-update channel: registry \"npmjs\" · checkIntervalMs 180000." + site_zh: "update —— 自更新通道:registry \"npmjs\" · checkIntervalMs 180000。" + - key: update.registry + type: string + default: "\"npmjs\" (registry.npmjs.org)" + env: BILI_UPDATE_REGISTRY + group: updates + desc_en: "Custom npm registry base URL for self-updates (private mirrors)." + desc_zh: "自更新用的自定义 npm registry 基础地址(私有镜像)。" + - key: update.checkIntervalMs + type: number + default: "180000" + env: BILI_UPDATE_CHECK_INTERVAL_MS + group: updates + desc_en: "Interval between npm registry version checks." + desc_zh: "npm registry 版本检查间隔。" + - key: advisoryCheck + type: boolean + default: "true" + env: BILI_ADVISORY_CHECK + group: updates + id: tt.advisory + site_group: diag + desc_en: "Critical-defect advisory watcher; force-installs the recommended fix when the running version is affected." + desc_zh: "关键缺陷公告监视器;本机版本命中受影响范围时装填推荐修复版本。" + site_en: "advisoryCheck / advisoryUrl — critical-defect advisory watcher (on by default; force-installs the recommended fix when your version is affected)." + site_zh: "advisoryCheck / advisoryUrl —— 关键缺陷公告监视器(默认开;本机版本命中受影响范围时装填推荐修复版本)。" + - key: advisoryUrl + type: string + default: "unset (built-in feed)" + env: BILI_ADVISORY_URL + group: updates + desc_en: "Override URL for the advisory feed." + desc_zh: "公告源覆盖地址。" + - key: releaseNotesCheck + type: boolean + default: "true" + env: BILI_RELEASE_NOTES_CHECK + group: updates + id: tt.rnotes + site_group: diag + desc_en: "Release-notes feed for the web panel (fetch + cache only; never installs anything)." + desc_zh: "Web 面板里的发布说明源(只抓取缓存、从不安装任何东西)。" + site_en: "releaseNotesCheck / releaseNotesUrl — release-notes feed for the panel (on by default; fetch + cache only, never installs)." + site_zh: "releaseNotesCheck / releaseNotesUrl —— 面板里的发布说明源(默认开;只抓取缓存、从不安装)。" + - key: releaseNotesUrl + type: string + default: "unset (built-in feed)" + env: BILI_RELEASE_NOTES_URL + group: updates + desc_en: "Override URL for the release-notes feed." + desc_zh: "发布说明源覆盖地址。" diff --git a/website/docs/index.html b/website/docs/index.html index 1ddf58c53d..b3036d501f 100644 --- a/website/docs/index.html +++ b/website/docs/index.html @@ -171,31 +171,35 @@

    compress — every knob

    - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + +
    ParameterTypeWhat it does
    modelContextLimitnumber | "N%"·
    maxContextLimitnumber | "N%"·
    emergencyThresholdPercentnumber | %·
    outputHeadroomMaxPctnumber | %·
    nudgeGrowthTokensnumber·
    preserveRecentMessagesnumber·
    preserveRecentTokensnumber·
    minCompressRangeCharsnumber (deprecated alias: minCompressRange)·
    reconcile"off" | "warn" | "repair"·
    promptPackstring (builtin: "default", "lean")·
    stripImagesKeepRecentnumber·
    tiersbool·
    protectedToolsstring[]·
    protectedLatestToolsstring[]·
    neverPreserveRecentToolsstring[] ([] valid)·
    preserveRecentToolsstring[]·
    stripImagesbool·
    visibilityMarkersbool·
    rulesbool·
    injectToolbool·
    injectNudgebool·
    reasoning{ drop?, threshold? }·
    modelContextLimitnumber | "N%"Effective context window (tokens or "N%"): denominator of the usage ratio and a hard preflight wall. Highest-priority window source — overrides per-route / per-model declarations plus the top-level default.
    maxContextLimitnumber | "N%"Forced-compression nudge threshold (default "75%"): once history passes this share of the window the nudge fires immediately, bypassing the growth gates. Not a hard cap.
    emergencyThresholdPercentnumber | %Default "95%": emergency truncation of oversized tool outputs when history passes this share of the window (must be ≥ maxContextLimit).
    outputHeadroomMaxPctnumber | %Cap (0–1, default 0.25) on the share of the window reserved for output via max_tokens.
    nudgeGrowthTokensnumberGrowth gate (default 50000): nudges fire only when a foldable range exceeds baseline growth by this many tokens.
    preserveRecentMessagesnumberKernel default ≈5: the most recent messages stay soft-protected from folds.
    preserveRecentTokensnumberKernel default ≈5000: the most recent tokens stay soft-protected from folds.
    minCompressRangeCharsnumber (deprecated alias: minCompressRange)Smallest foldable range, in characters (kernel default ≈5000) — shorter ranges never fold.
    reconcile"off" | "warn" | "repair""off" | "warn" | "repair" (default repair): reconcile folded state when the client rewinds or rewrites history between turns.
    promptPackstring (builtin: "default", "lean")Compression prompt pack, resolved project pack → user pack → builtin. Builtins: "default" and "lean" (one-line tool descriptions). Not gated by acknowledgePromptsRisk.
    stripImagesKeepRecentnumberWith stripImages on, images inside the N newest messages (default 5) are kept.
    tiersbooleanOn by default: tiered T1→T3 distillation spreads folding cost across generations.
    protectedToolsstring[]Hard exclusion across all history: results of listed tools never fold (use with care).
    protectedLatestToolsstring[]Protects only the LATEST instance of cumulative-snapshot tools whose newest result supersedes older ones (e.g. todo lists).
    neverPreserveRecentToolsstring[] ([] valid)Excluded from the recent protection zone (immediately compressible); default ["decompress", "search_context", "read", "bash"]. An empty array is valid — it excludes nothing (maximum protection).
    preserveRecentToolsstring[]Subtraction form: recent-zone tools minus this list get full protection. An empty array here is rejected as a typo.
    stripImagesbooleanStrip image payloads from foldable history (off by default).
    visibilityMarkersbooleanAppend 📦/❌ visibility markers after compress/decompress/search_context/acp_status results (on by default; off stops imitated narration).
    rulesbooleanOff by default: persistent model reminders delivered through an injected acp_rule tool, hard-protected from folds. pi/omp expose an /acp-rule command.
    injectToolbooleanRegister the acp_compress tool for clients (on by default; global level only).
    injectNudgebooleanSend growth nudges as the window fills (on by default; global level only).
    reasoning{ drop?, threshold? }{ drop?, threshold? } — drop finished-round reasoning runs longer than 2048 chars (drop: true by default); strict-reasoning upstreams need drop:false.
    -
    • absorb — opt-in instant distillation of large tool results into short abstracts; originals go to the content store (enabled, minToolTokens (default 1000), contextThresholdPct, excludeTools, toolName "absorb").
    • +
        + +
      • absorb — opt-in instant distillation of large tool results into short abstracts; originals go to the content store (enabled, minToolTokens (default 1000), contextThresholdPct, excludeTools, toolName "absorb").
      • ccr — content cache & retrieve: large outputs are stored losslessly beside the session and replaced by a head excerpt plus pointer; the model fetches originals back via acp_retrieve. No cap or eviction; on by default in proxy mode since v2 (enabled, minToolTokens (~4000), excludeTools, toolName "acp_retrieve", maxHeadChars).
      • search.planAware — off by default: when on, search_context candidates are re-ranked against current plan state (latest-wins todos + last user turn); off keeps byte-identical lexical results.
      • imageCompression — opt-in lossy downscale via optional sharp before sending (enabled, minTokens 512, maxDimension 1280, quality 80, format "webp"); image_full restores originals; proxy mode only.
      • @@ -204,76 +208,81 @@

        compress — every knob

      • outputSteering — { enabled? false, verbosityLevel? 2 (0–4), effortRouting? }: appends a conciseness directive to the system-prompt tail; clamps mechanical continuation requests.
      • priceProfile — w / r / q ratios normalized to the input price (write / cache-read / output); unset ⇒ models.dev $/Mtok registry rows, kernel fallback {1, 0.1, 4}. Report-only — never affects triggers or the wire.
      • acknowledgePromptsRisk — must be true before custom prompts take effect.
      • +

      providers — route table fields

      Keys are upstream URL prefixes — longest match wins, boundary-safe. https:// keys match /bili/ traffic; mitm:// keys match login-client traffic on the MITM lane. An entry with no fields is still an ordinary compressed lane.

      - - - - - - - - - - - - - + + + + + + + + + + + + + + +
      FieldTypeWhat it does
      modelsrecord name→{context?, output?, compress?, benefit?}·
      proxystring ("" = explicit direct)·
      compressProtocol"tools" (default) | "marker"·
      protocol"anthropic" | "openai" | "responses" | "google"·
      compressobject (level 2)·
      compat{ roles?, dropFields? }·
      directbool·
      passthroughbool·
      imageBilling"auto" | "pixels" | "bytes"·
      imageTokenCapnumber·
      resignscheme → {enabled?, passthrough?, credentialRef?}·
      bindstring (named entries only)·
      compactionOptInbool·
      modelsrecord name → { context?, output?, compress?, benefit? }Record of model name → {context?, output?, compress?, benefit?}: declares each model's context window, output ceiling, and per-model compression overrides (benefit marks free-quota billing). Not a traffic filter.
      proxystring ("" = explicit direct)Per-route outbound proxy URL; empty string = explicitly direct.
      compressProtocol"tools" (default) | "marker"Which ACP injection surface this lane speaks: native tools (default) or prompt markers.
      protocol"anthropic" | "openai" | "responses" | "google"Declare this lane's wire protocol. A client-side /bili/<protocol>/ URL marker outranks the declaration; unparseable bodies relay verbatim.
      compressobject (level 2)Any compress field can be overridden here — level 2 of the global→provider→model merge (per-field, deepest wins).
      compat{ roles?, dropFields? }{ roles?, dropFields? } — remap roles the upstream rejects (e.g. developer→system); provider entries beat the global block per key; dropFields strips fields strict schemas reject (additive union).
      directbooleanClient-side exemption: traffic for this upstream is never pointed at bili at all — unlike passthrough, it does not even terminate there.
      passthroughbooleanRoute-scoped byte-for-byte relay with no session state — for anti-fraud upstreams.
      imageBilling"auto" | "pixels" | "bytes"Image-token counting basis for this route: auto (→ pixels), pixels, or bytes (explicit opt-in for byte relays).
      imageTokenCapnumberPer-image token cost cap for this route; unset = uncapped.
      resignscheme → { enabled?, passthrough?, credentialRef? }Per-route overrides of the global resign map (level 2, deepest wins).
      bindstring (named entries only)Named (non-URL) entry: deep-merged onto the bound URL lane at config load as an alias. Without bind a named entry stays routing-inert.
      compactionOptInbooleanNamed entries only: opt a non-http(s)-baseUrl provider into compaction ownership (pi/omp lanes); unions with env BILI_NON_HTTP_PROVIDERS.

      Other top-level fields

        +
      • Server & core
      • -
      • -
      • -
      • -
      • -
      • -
      • -
      • -
      • +
      • port — listen port (default 8787).
      • +
      • host — bind address (default 127.0.0.1; "::" is dual-stack, 0.0.0.0 exposes outward).
      • +
      • sessionHeader — HTTP header carrying the session id (default x-acp-session).
      • +
      • log — file logging master switch (on by default).
      • +
      • logFile — explicit path for bili.log (env ACP_LOG_FILE wins).
      • +
      • debug — verbose per-request logging.
      • +
      • dumpSse — raw SSE stream dump level for debugging.
      • +
      • passthrough — global raw-relay switch (off by default; ACP_PASSTHROUGH / --passthrough win over the file).
      • Upstream & billing
      • -
      • -
      • -
      • -
      • -
      • +
      • upstream — fallback upstream base URL (ACP_UPSTREAM overrides).
      • +
      • proxy — global outbound proxy. Resolution: per-route → BILI_UPSTREAM_PROXY → Web UI → this value → HTTP(S)_PROXY env → Windows system proxy → direct. Empty string = explicitly direct; SOCKS5 is rejected.
      • +
      • modelContextLimit — legacy global window ceiling (default 200000); prefer compress.modelContextLimit.
      • +
      • imageBilling — global image-token estimation: "auto" (default → pixels), "pixels" or "bytes" (explicit opt-in for byte relays).
      • +
      • imageTokenCap — global per-image token cap; unset = uncapped (BILI_IMAGE_TOKEN_CAP wins, read live).
      • Behavior toggles
      • -
      • -
      • -
      • -
      • -
      • -
      • -
      • -
      • +
      • maskHosts — mask non-public host names in logs as <private-host> (on by default; credentials are always masked).
      • +
      • subagentSplit — Claude subagents get their own session namespace (on by default).
      • +
      • forkAdoption — adopt anonymous forks into their parent session (off by default).
      • +
      • resumeInheritance — inherited refs/blocks on resume (cc --resume) (on by default).
      • +
      • chainContentDetection — recognize bili-owned traffic by body content (off; false-positive risk).
      • +
      • chainEgressStamp — model-visible stamp on egress messages (off; burns tokens).
      • +
      • stableSystemAnchor — best-effort wire-layer prefix-cache anchor (off; plain-proxy lanes).
      • +
      • compat — wire-compatibility block: role remaps, stream error shape, strict-schema field drops, cache-control handling.
      • MITM lane
      • -
      • -
      • -
      • +
      • providersPath — external routes file path (env ACP_PROVIDERS beats both it and inline providers).
      • +
      • mitm.enabled / mitm.domains — HTTPS interception switch and whitelist domains for login clients.
      • +
      • mitm.handshakeTimeoutMs — TLS handshake timeout (default 10000).
      • Process blocks
      • -
      • -
      • -
      • -
      • -
      • +
      • network — transport timeouts & replays: upstreamTimeoutMs 720000 · requestWatchdogMs 2× · replayRetryMax 3 · replayRetryBaseMs 1500 · keepAliveTimeoutMs 5000 · clientErrorBackstopMs 30000 · exposureLogIntervalMs 3600000 · streamKeepAliveMs 15000 · preflightHoldMs 30000 · preflightDeadEndCooldownMs 300000 · proxyKeepAliveMaxMs 55000.
      • +
      • persist — session persistence to disk: enabled true · zstd false · debounceMs 500 · tailTokens 16384 · epermAlertThreshold 5 · epermAlertRepeatMs 0.
      • +
      • sessions — max 256 (LRU) · gc { enabled false, maxAgeDays 7, maxTokens 1000000, intervalMs 3600000 } — GC is opt-in; user data is never pruned silently.
      • +
      • plugin.snapshotCapBytes — fork API snapshot cap (default 16 MiB; 0 disables snapshots).
      • +
      • update — self-update channel: registry "npmjs" · checkIntervalMs 180000.
      • Diagnostics & updates
      • -
      • -
      • -
      • -
      • -
      • -
      • -
      • +
      • diagnostics — local troubleshooting knobs: dumpBody false · dumpReq true · rawDumpDir · dump4xx false (+MaxBytes 2 MiB) · renderNone/noInjectTool/noCompressPrompt false · countTokensPassthrough false · compressProtocol "tools".
      • +
      • fakeCompletion — retry loop for truncated final chunks: retries 0 (opt-in) · bufCapBytes 16 MiB.
      • +
      • autoUpdate — automatic version checks (on by default; disable via ACP_AUTO_UPDATE=0 or --no-auto-update).
      • +
      • autoRestartOnUpdate — restart the daemon automatically once a newer version is installed (opt-in).
      • +
      • updateTag — npm dist-tag channel: latest (default), dev, or pr.
      • +
      • advisoryCheck / advisoryUrl — critical-defect advisory watcher (on by default; force-installs the recommended fix when your version is affected).
      • +
      • releaseNotesCheck / releaseNotesUrl — release-notes feed for the panel (on by default; fetch + cache only, never installs).
      • Advanced scalars
      • -
      • -
      • -
      • -
      • +
      • codexCompact — intercept | pass (default intercept): handle Codex /responses/compact inside bili or forward upstream.
      • +
      • ccrRetrievalTtlMs — lifetime of CCR retrieval pointers (default 600000; 0 disables retrieval).
      • +
      • decompressTmpCap — size cap for temporary decompressed blocks (default 50).
      • +
      • native.attachExternal — let launcher-less native plugins attach to an external daemon (off by default).
      • +

      Environment variables win over the config file — precedence: env > file > built-in default, and a set variable owns the knob even if its value looks invalid. Common ones:

      diff --git a/website/main.js b/website/main.js index 6ce64531d0..a5942824ae 100644 --- a/website/main.js +++ b/website/main.js @@ -59,6 +59,7 @@ "d.cf.th_type": "Type", "d.cf.th_desc": "What it does", "d.cf.routes_intro": "Keys are upstream URL prefixes — longest match wins, boundary-safe. https:// keys match /bili/ traffic; mitm:// keys match login-client traffic on the MITM lane. An entry with no fields is still an ordinary compressed lane.", + /* bili:gen site-dict-en */ "cw.mcl": "Effective context window (tokens or \"N%\"): denominator of the usage ratio and a hard preflight wall. Highest-priority window source — overrides per-route / per-model declarations plus the top-level default.", "cw.mxcl": "Forced-compression nudge threshold (default \"75%\"): once history passes this share of the window the nudge fires immediately, bypassing the growth gates. Not a hard cap.", "cw.etc": "Default \"95%\": emergency truncation of oversized tool outputs when history passes this share of the window (must be ≥ maxContextLimit).", @@ -67,10 +68,10 @@ "cw.prm": "Kernel default ≈5: the most recent messages stay soft-protected from folds.", "cw.prt": "Kernel default ≈5000: the most recent tokens stay soft-protected from folds.", "cw.mrc": "Smallest foldable range, in characters (kernel default ≈5000) — shorter ranges never fold.", - "cw.sikr": "With stripImages on, images inside the N newest messages (default 5) are kept.", - "cw.tiers": "On by default: tiered T1→T3 distillation spreads folding cost across generations.", "cw.rec": "\"off\" | \"warn\" | \"repair\" (default repair): reconcile folded state when the client rewinds or rewrites history between turns.", "cw.ppk": "Compression prompt pack, resolved project pack → user pack → builtin. Builtins: \"default\" and \"lean\" (one-line tool descriptions). Not gated by acknowledgePromptsRisk.", + "cw.sikr": "With stripImages on, images inside the N newest messages (default 5) are kept.", + "cw.tiers": "On by default: tiered T1→T3 distillation spreads folding cost across generations.", "ct.pt": "Hard exclusion across all history: results of listed tools never fold (use with care).", "ct.plt": "Protects only the LATEST instance of cumulative-snapshot tools whose newest result supersedes older ones (e.g. todo lists).", "ct.nprt": "Excluded from the recent protection zone (immediately compressible); default [\"decompress\", \"search_context\", \"read\", \"bash\"]. An empty array is valid — it excludes nothing (maximum protection).", @@ -110,46 +111,47 @@ "tg.proc": "Process blocks", "tg.diag": "Diagnostics & updates", "tg.adv": "Advanced scalars", + "tt.diag": "diagnostics — local troubleshooting knobs: dumpBody false · dumpReq true · rawDumpDir · dump4xx false (+MaxBytes 2 MiB) · renderNone/noInjectTool/noCompressPrompt false · countTokensPassthrough false · compressProtocol \"tools\".", + "tt.fake": "fakeCompletion — retry loop for truncated final chunks: retries 0 (opt-in) · bufCapBytes 16 MiB.", + "tt.ccx": "codexCompact — intercept | pass (default intercept): handle Codex /responses/compact inside bili or forward upstream.", + "ttl.ttl": "ccrRetrievalTtlMs — lifetime of CCR retrieval pointers (default 600000; 0 disables retrieval).", + "ttl.tmp": "decompressTmpCap — size cap for temporary decompressed blocks (default 50).", + "tt.network": "network — transport timeouts & replays: upstreamTimeoutMs 720000 · requestWatchdogMs 2× · replayRetryMax 3 · replayRetryBaseMs 1500 · keepAliveTimeoutMs 5000 · clientErrorBackstopMs 30000 · exposureLogIntervalMs 3600000 · streamKeepAliveMs 15000 · preflightHoldMs 30000 · preflightDeadEndCooldownMs 300000 · proxyKeepAliveMaxMs 55000.", + "tt.persist": "persist — session persistence to disk: enabled true · zstd false · debounceMs 500 · tailTokens 16384 · epermAlertThreshold 5 · epermAlertRepeatMs 0.", + "tt.sessions": "sessions — max 256 (LRU) · gc { enabled false, maxAgeDays 7, maxTokens 1000000, intervalMs 3600000 } — GC is opt-in; user data is never pruned silently.", + "tt.snap": "plugin.snapshotCapBytes — fork API snapshot cap (default 16 MiB; 0 disables snapshots).", "tt.port": "port — listen port (default 8787).", "tt.host": "host — bind address (default 127.0.0.1; \"::\" is dual-stack, 0.0.0.0 exposes outward).", "tt.sessionheader": "sessionHeader — HTTP header carrying the session id (default x-acp-session).", "tt.log": "log — file logging master switch (on by default).", "tt.logfile": "logFile — explicit path for bili.log (env ACP_LOG_FILE wins).", "tt.debug": "debug — verbose per-request logging.", - "tt.pt3": "passthrough — global raw-relay switch (off by default; ACP_PASSTHROUGH / --passthrough win over the file).", "tt.dumsse": "dumpSse — raw SSE stream dump level for debugging.", + "tt.pt3": "passthrough — global raw-relay switch (off by default; ACP_PASSTHROUGH / --passthrough win over the file).", "tt.upstream": "upstream — fallback upstream base URL (ACP_UPSTREAM overrides).", "tt.proxy": "proxy — global outbound proxy. Resolution: per-route → BILI_UPSTREAM_PROXY → Web UI → this value → HTTP(S)_PROXY env → Windows system proxy → direct. Empty string = explicitly direct; SOCKS5 is rejected.", + "tt.ppath": "providersPath — external routes file path (env ACP_PROVIDERS beats both it and inline providers).", "tt.mcl2": "modelContextLimit — legacy global window ceiling (default 200000); prefer compress.modelContextLimit.", "tt.ib2": "imageBilling — global image-token estimation: \"auto\" (default → pixels), \"pixels\" or \"bytes\" (explicit opt-in for byte relays).", "tt.itc2": "imageTokenCap — global per-image token cap; unset = uncapped (BILI_IMAGE_TOKEN_CAP wins, read live).", "tt.mask": "maskHosts — mask non-public host names in logs as <private-host> (on by default; credentials are always masked).", "tt.subagent": "subagentSplit — Claude subagents get their own session namespace (on by default).", + "tt.fork": "forkAdoption — adopt anonymous forks into their parent session (off by default).", + "tt.resinherit": "resumeInheritance — inherited refs/blocks on resume (cc --resume) (on by default).", "tt.chain": "chainContentDetection — recognize bili-owned traffic by body content (off; false-positive risk).", "tt.stamp": "chainEgressStamp — model-visible stamp on egress messages (off; burns tokens).", "tt.anchor": "stableSystemAnchor — best-effort wire-layer prefix-cache anchor (off; plain-proxy lanes).", - "tt.resinherit": "resumeInheritance — inherited refs/blocks on resume (cc --resume) (on by default).", - "tt.fork": "forkAdoption — adopt anonymous forks into their parent session (off by default).", "tt.compat": "compat — wire-compatibility block: role remaps, stream error shape, strict-schema field drops, cache-control handling.", + "tt.nat": "native.attachExternal — let launcher-less native plugins attach to an external daemon (off by default).", "tt.mitm": "mitm.enabled / mitm.domains — HTTPS interception switch and whitelist domains for login clients.", "tt.mitm2": "mitm.handshakeTimeoutMs — TLS handshake timeout (default 10000).", - "tt.ppath": "providersPath — external routes file path (env ACP_PROVIDERS beats both it and inline providers).", - "tt.network": "network — transport timeouts & replays: upstreamTimeoutMs 720000 · requestWatchdogMs 2× · replayRetryMax 3 · replayRetryBaseMs 1500 · keepAliveTimeoutMs 5000 · clientErrorBackstopMs 30000 · exposureLogIntervalMs 3600000 · streamKeepAliveMs 15000 · preflightHoldMs 30000 · preflightDeadEndCooldownMs 300000 · proxyKeepAliveMaxMs 55000.", - "tt.persist": "persist — session persistence to disk: enabled true · zstd false · debounceMs 500 · tailTokens 16384 · epermAlertThreshold 5 · epermAlertRepeatMs 0.", - "tt.sessions": "sessions — max 256 (LRU) · gc { enabled false, maxAgeDays 7, maxTokens 1000000, intervalMs 3600000 } — GC is opt-in; user data is never pruned silently.", - "tt.snap": "plugin.snapshotCapBytes — fork API snapshot cap (default 16 MiB; 0 disables snapshots).", + "tt.aupd": "autoUpdate — automatic version checks (on by default; disable via ACP_AUTO_UPDATE=0 or --no-auto-update).", + "tt.arst": "autoRestartOnUpdate — restart the daemon automatically once a newer version is installed (opt-in).", + "tt.utag": "updateTag — npm dist-tag channel: latest (default), dev, or pr.", "tt.update": "update — self-update channel: registry \"npmjs\" · checkIntervalMs 180000.", - "tt.diag": "diagnostics — local troubleshooting knobs: dumpBody false · dumpReq true · rawDumpDir · dump4xx false (+MaxBytes 2 MiB) · renderNone/noInjectTool/noCompressPrompt false · countTokensPassthrough false · compressProtocol \"tools\".", - "tt.fake": "fakeCompletion — retry loop for truncated final chunks: retries 0 (opt-in) · bufCapBytes 16 MiB.", "tt.advisory": "advisoryCheck / advisoryUrl — critical-defect advisory watcher (on by default; force-installs the recommended fix when your version is affected).", "tt.rnotes": "releaseNotesCheck / releaseNotesUrl — release-notes feed for the panel (on by default; fetch + cache only, never installs).", - "tt.utag": "updateTag — npm dist-tag channel: latest (default), dev, or pr.", - "tt.aupd": "autoUpdate — automatic version checks (on by default; disable via ACP_AUTO_UPDATE=0 or --no-auto-update).", - "tt.arst": "autoRestartOnUpdate — restart the daemon automatically once a newer version is installed (opt-in).", - "tt.ccx": "codexCompact — intercept | pass (default intercept): handle Codex /responses/compact inside bili or forward upstream.", - "ttl.ttl": "ccrRetrievalTtlMs — lifetime of CCR retrieval pointers (default 600000; 0 disables retrieval).", - "ttl.tmp": "decompressTmpCap — size cap for temporary decompressed blocks (default 50).", - "tt.nat": "native.attachExternal — let launcher-less native plugins attach to an external daemon (off by default).", +/* /bili:gen */ "d.wu.access": "Access: once the daemon is up, open http://127.0.0.1:8787/__bili/ in a browser (change the port if you set ACP_PORT; it binds loopback only). Or just type /acp in your agent — the panel footer carries a direct link to the current session.", "fa.panel.q": "I can't reach the dashboard?", "fa.panel.a": "Check the daemon is running (bili doctor) and the port isn't changed (default 8787). The dashboard binds 127.0.0.1 only — from another machine or phone you need an SSH port-forward or an explicit ACP_HOST setting.", @@ -267,6 +269,7 @@ "d.cf.th_type": "类型", "d.cf.th_desc": "作用", "d.cf.routes_intro": "键是上游 URL 前缀——最长前缀优先、边界安全。https:// 键匹配 /bili/ 流量,mitm:// 键匹配 MITM 通道的登录客户端流量。不带任何字段的条目仍是普通压缩通道。", + /* bili:gen site-dict-zh */ "cw.mcl": "有效上下文窗口(token 数或 \"N%\"):使用率的分母,也是硬性 preflight 墙。窗口来源中优先级最高——覆盖路由/模型声明与顶层默认值。", "cw.mxcl": "强制压缩提醒阈值(默认 \"75%\"):历史超过窗口的该占比时提醒立即触发,绕过增长门槛。不是硬上限。", "cw.etc": "默认 \"95%\":历史超过窗口该占比时,对超大工具输出做紧急截断(必须 ≥ maxContextLimit)。", @@ -275,10 +278,10 @@ "cw.prm": "内核默认约 5:最近消息软保护、免于折叠。", "cw.prt": "内核默认约 5000:最近的 token 软保护、免于折叠。", "cw.mrc": "可折叠片段的最小字符数(内核默认约 5000),更短的永不折叠。", - "cw.sikr": "开启剥离图片时,最新 N 条消息(默认 5)内的图片保留。", - "cw.tiers": "默认开:T1→T3 分级蒸馏,把折叠成本摊到多代。", "cw.rec": "\"off\" | \"warn\" | \"repair\"(默认 repair):客户端在轮次之间回退或改写历史时校准已折叠状态。", "cw.ppk": "压缩提示词包,按 项目包 → 用户包 → 内置 解析。内置:\"default\" 与 \"lean\"(单行工具描述)。不受 acknowledgePromptsRisk 门控。", + "cw.sikr": "开启剥离图片时,最新 N 条消息(默认 5)内的图片保留。", + "cw.tiers": "默认开:T1→T3 分级蒸馏,把折叠成本摊到多代。", "ct.pt": "全历史硬排除:列出工具的结果永不折叠(慎用)。", "ct.plt": "只保护累积快照类工具的「最新一次」实例(新结果覆盖旧结果的工具,如 todo 列表)。", "ct.nprt": "从近期保护区排除(立即可压);默认 [\"decompress\", \"search_context\", \"read\", \"bash\"]。空数组合法=不排除任何工具(最大保护)。", @@ -318,46 +321,47 @@ "tg.proc": "进程级块", "tg.diag": "诊断与更新", "tg.adv": "高级标量", + "tt.diag": "diagnostics —— 本地排障旋钮:dumpBody false · dumpReq true · rawDumpDir · dump4xx false (+MaxBytes 2 MiB) · renderNone/noInjectTool/noCompressPrompt false · countTokensPassthrough false · compressProtocol \"tools\"。", + "tt.fake": "fakeCompletion —— 被截断末块的补完成重试环:retries 0 (可选) · bufCapBytes 16 MiB。", + "tt.ccx": "codexCompact —— intercept | pass(默认 intercept):在 bili 内处理 Codex /responses/compact,还是转给上游。", + "ttl.ttl": "ccrRetrievalTtlMs —— CCR 回取指针有效期(默认 600000;0 禁用回取)。", + "ttl.tmp": "decompressTmpCap —— 临时展开块的大小上限(默认 50)。", + "tt.network": "network —— 传输超时与重放:upstreamTimeoutMs 720000 · requestWatchdogMs 2× · replayRetryMax 3 · replayRetryBaseMs 1500 · keepAliveTimeoutMs 5000 · clientErrorBackstopMs 30000 · exposureLogIntervalMs 3600000 · streamKeepAliveMs 15000 · preflightHoldMs 30000 · preflightDeadEndCooldownMs 300000 · proxyKeepAliveMaxMs 55000。", + "tt.persist": "persist —— 会话落盘持久化:enabled true · zstd false · debounceMs 500 · tailTokens 16384 · epermAlertThreshold 5 · epermAlertRepeatMs 0。", + "tt.sessions": "sessions —— max 256 (LRU) · gc { enabled false, maxAgeDays 7, maxTokens 1000000, intervalMs 3600000 } —— GC 为可选:用户数据不会被悄悄清理。", + "tt.snap": "plugin.snapshotCapBytes —— fork API 快照上限(默认 16 MiB;0 禁用快照)。", "tt.port": "port —— 监听端口(默认 8787)。", "tt.host": "host —— 绑定地址(默认 127.0.0.1;\"::\" 双栈,0.0.0.0 对外暴露)。", "tt.sessionheader": "sessionHeader —— 携带会话 id 的请求头(默认 x-acp-session)。", "tt.log": "log —— 文件日志总开关(默认开)。", "tt.logfile": "logFile —— bili.log 显式路径(环境变量 ACP_LOG_FILE 优先)。", "tt.debug": "debug —— 逐请求详细日志。", - "tt.pt3": "passthrough —— 全局裸转发开关(默认关;ACP_PASSTHROUGH / --passthrough 优先于文件)。", "tt.dumsse": "dumpSse —— 原始 SSE 流转储级别(排障用)。", + "tt.pt3": "passthrough —— 全局裸转发开关(默认关;ACP_PASSTHROUGH / --passthrough 优先于文件)。", "tt.upstream": "upstream —— 兜底上游基础地址(ACP_UPSTREAM 覆盖)。", "tt.proxy": "proxy —— 全局出站代理。解析顺序:按路由 → BILI_UPSTREAM_PROXY → Web UI → 本值 → HTTP(S)_PROXY 环境变量 → Windows 系统代理 → 直连。空字符串 = 显式直连;不支持 SOCKS5。", + "tt.ppath": "providersPath —— 外部路由文件路径(环境变量 ACP_PROVIDERS 优先于它与内联 providers)。", "tt.mcl2": "modelContextLimit —— 旧版全局窗口上限(默认 200000);建议改用 compress.modelContextLimit。", "tt.ib2": "imageBilling —— 全局图片 token 估算口径:\"auto\"(默认→pixels)、\"pixels\" 或 \"bytes\"(字节中继需显式指定)。", "tt.itc2": "imageTokenCap —— 全局单图 token 上限;未设置 = 不限(BILI_IMAGE_TOKEN_CAP 优先且实时读取)。", "tt.mask": "maskHosts —— 日志中把非公开主机名遮成 <private-host>(默认开;凭据总是遮盖)。", "tt.subagent": "subagentSplit —— Claude 子代理拥有独立会话命名空间(默认开)。", + "tt.fork": "forkAdoption —— 匿名 fork 会话并入父会话(默认关)。", + "tt.resinherit": "resumeInheritance —— resume(cc --resume)继承引用与区块(默认开)。", "tt.chain": "chainContentDetection —— 按请求体内容识别 bili 自有流量(默认关;有误报风险)。", "tt.stamp": "chainEgressStamp —— 在出口消息上打模型可见的标记(默认关;消耗 token)。", "tt.anchor": "stableSystemAnchor —— 线路层尽力而为的前缀缓存锚点(默认关;纯代理通道)。", - "tt.resinherit": "resumeInheritance —— resume(cc --resume)继承引用与区块(默认开)。", - "tt.fork": "forkAdoption —— 匿名 fork 会话并入父会话(默认关)。", "tt.compat": "compat —— 线上兼容块:角色映射、流式错误形态、严格 schema 字段剔除、缓存控制处理。", + "tt.nat": "native.attachExternal —— 允许无启动器的原生插件挂到外部守护进程(默认关)。", "tt.mitm": "mitm.enabled / mitm.domains —— 登录客户端 HTTPS 拦截开关与白名单域名。", "tt.mitm2": "mitm.handshakeTimeoutMs —— TLS 握手超时(默认 10000)。", - "tt.ppath": "providersPath —— 外部路由文件路径(环境变量 ACP_PROVIDERS 优先于它与内联 providers)。", - "tt.network": "network —— 传输超时与重放:upstreamTimeoutMs 720000 · requestWatchdogMs 2× · replayRetryMax 3 · replayRetryBaseMs 1500 · keepAliveTimeoutMs 5000 · clientErrorBackstopMs 30000 · exposureLogIntervalMs 3600000 · streamKeepAliveMs 15000 · preflightHoldMs 30000 · preflightDeadEndCooldownMs 300000 · proxyKeepAliveMaxMs 55000。", - "tt.persist": "persist —— 会话落盘持久化:enabled true · zstd false · debounceMs 500 · tailTokens 16384 · epermAlertThreshold 5 · epermAlertRepeatMs 0。", - "tt.sessions": "sessions —— max 256 (LRU) · gc { enabled false, maxAgeDays 7, maxTokens 1000000, intervalMs 3600000 } —— GC 为可选:用户数据不会被悄悄清理。", - "tt.snap": "plugin.snapshotCapBytes —— fork API 快照上限(默认 16 MiB;0 禁用快照)。", + "tt.aupd": "autoUpdate —— 自动版本检查(默认开;ACP_AUTO_UPDATE=0 或 --no-auto-update 关闭)。", + "tt.arst": "autoRestartOnUpdate —— 新版本装好后自动重启守护进程(可选开启)。", + "tt.utag": "updateTag —— npm dist-tag 通道:latest(默认)、dev 或 pr。", "tt.update": "update —— 自更新通道:registry \"npmjs\" · checkIntervalMs 180000。", - "tt.diag": "diagnostics —— 本地排障旋钮:dumpBody false · dumpReq true · rawDumpDir · dump4xx false (+MaxBytes 2 MiB) · renderNone/noInjectTool/noCompressPrompt false · countTokensPassthrough false · compressProtocol \"tools\"。", - "tt.fake": "fakeCompletion —— 被截断末块的补完成重试环:retries 0 (可选) · bufCapBytes 16 MiB。", "tt.advisory": "advisoryCheck / advisoryUrl —— 关键缺陷公告监视器(默认开;本机版本命中受影响范围时装填推荐修复版本)。", "tt.rnotes": "releaseNotesCheck / releaseNotesUrl —— 面板里的发布说明源(默认开;只抓取缓存、从不安装)。", - "tt.utag": "updateTag —— npm dist-tag 通道:latest(默认)、dev 或 pr。", - "tt.aupd": "autoUpdate —— 自动版本检查(默认开;ACP_AUTO_UPDATE=0 或 --no-auto-update 关闭)。", - "tt.arst": "autoRestartOnUpdate —— 新版本装好后自动重启守护进程(可选开启)。", - "tt.ccx": "codexCompact —— intercept | pass(默认 intercept):在 bili 内处理 Codex /responses/compact,还是转给上游。", - "ttl.ttl": "ccrRetrievalTtlMs —— CCR 回取指针有效期(默认 600000;0 禁用回取)。", - "ttl.tmp": "decompressTmpCap —— 临时展开块的大小上限(默认 50)。", - "tt.nat": "native.attachExternal —— 允许无启动器的原生插件挂到外部守护进程(默认关)。", +/* /bili:gen */ "d.wu.access": "访问方式:守护进程运行后,浏览器打开 http://127.0.0.1:8787/__bili/(改过 ACP_PORT 请换端口;默认只监听本机回环)。也可以在 agent 里输入 /acp——面板底部有当前会话的直达链接。", "fa.panel.q": "打不开面板怎么办?", "fa.panel.a": "先确认守护进程在跑(bili doctor)、端口没被改(默认 8787)。面板只绑定 127.0.0.1——在别的机器或手机上看需要 SSH 端口转发,或显式设置 ACP_HOST。",