mirror of
https://github.com/ranxianglei/billion-context.git
synced 2026-12-03 03:36:15 +08:00
579 lines
65 KiB
JavaScript
579 lines
65 KiB
JavaScript
/* billion-context landing — i18n + interactions */
|
||
(function () {
|
||
"use strict";
|
||
|
||
var I18N = {
|
||
en: {
|
||
"doc.title": "billion-context — month-long coding sessions on a 100K window",
|
||
"nav.how": "How it works",
|
||
"nav.agents": "Agents",
|
||
"nav.install": "Install",
|
||
"nav.paper": "Paper",
|
||
"nav.docs": "Docs",
|
||
"nav.blog": "Blog",
|
||
"hero.kicker_live": "runs on your machine, sees nothing else",
|
||
"hero.t1": "Month-long sessions",
|
||
"hero.t2": "on a 100K window.",
|
||
"hero.lede": "<strong>billion-context</strong> is a local context-compression proxy for AI coding agents — <em>billion-context is all you need.</em> Small context windows are enough: it keeps a 100K-window model working for days at a time, cuts token spend by up to 5×, and accounts for every token it moves.",
|
||
"hero.cta1": "Get started",
|
||
"hero.cta2": "Read the code",
|
||
"bullet1": "Prompt-cache-aware compaction — rewrites cost almost nothing",
|
||
"bullet2": "A per-request ledger: new content vs. repay cost, visible in-terminal",
|
||
"bullet3": "Works as a transparent proxy — no agent source changes required",
|
||
"stat1": "fewer tokens per task",
|
||
"stat2": "model calls in the longitudinal study",
|
||
"stat3": "cumulative input tokens compressed",
|
||
"stat4": "window violations on 204,800-token models",
|
||
"stats.src": "Figures from the open-sourced study (4.5 months, 3 hosts, marathon sessions of 8,584–12,049 calls) — see the paper below.",
|
||
"wall.label": "Works with the agents you already run",
|
||
"how.title": "How it works",
|
||
"how.sub": "Not a bigger window — a better layout. Four mechanisms keep months of work inside an ordinary context limit:",
|
||
"m1.t": "Folded, not rewritten",
|
||
"m1.b": "When history outgrows its budget, only the newly consumed slice is folded into a compact summary block — once per block, ever. The window oscillates in a bounded band instead of growing without limit; production sessions ran months at ten-thousand-plus calls. Any block decompresses back to full text when you need the detail.",
|
||
"m2.t": "The provider's cache stays warm",
|
||
"m2.b": "A fold deactivates old ranges without touching the front of the conversation, so the prompt-cache prefix survives turn after turn — 94.2% of active input was served from cache in the study. Rewrite-style compaction invalidates the whole prefix and re-bills it. This does not.",
|
||
"m3.t": "The model decides what to forget",
|
||
"m3.b": "A versioned compression doctrine lives in the system prompt; a growth-gated nudge says when folding pays off. The agent judges what the task still needs, may refuse, and compresses between steps — never mid-step.",
|
||
"m4.t": "Every token is accounted",
|
||
"m4.b": "Each request is sampled into a per-session ledger — new content, cache reads, compression repay, TTL expiry — plotted in percentage points on a trajectory chart. Audit real savings with <code>/acp</code> in the terminal or the built-in web UI at <code>/__bili/</code>.",
|
||
"install.title": "Up and running in under a minute",
|
||
"install.intro": "<strong>One npm package, Node 22+.</strong> Then pick your connection style:",
|
||
"im1.t": "Native plugin — recommended",
|
||
"im1.b": "Installs straight into your client for the deepest integration: <code>bili plugin install pi</code>. Covers pi · omp · claude · codex · opencode · dsh · kimi · hermes · zcode.",
|
||
"im2.t": "Launcher — works for any agent",
|
||
"im2.b": "Wraps your client's command and injects bili automatically, zero config edits: <code>bili pi</code>, <code>bili codex</code>, <code>bili claude</code> — about twenty agents.",
|
||
"im3.t": "Generic proxy",
|
||
"im3.b": "Any client that accepts a custom endpoint works out of the box: point its base URL at <code>http://localhost:8787/bili/<your upstream></code>.",
|
||
"codebox.file": "terminal",
|
||
"common.copy": "Copy",
|
||
"common.copied": "Copied ✓",
|
||
"install.after": "Connected? Type <code>/acp</code> in your agent for the live panel and <code>/acp-cache</code> for the token economics. Per-agent details, MITM mode and troubleshooting: <a href=\"docs/#connect\">the connect guide</a>.",
|
||
"d.cn.chip_copy": "Click any command chip to copy it.",
|
||
"d.cn.mcp_note": "For opencode, <code>bili plugin install opencode --with-mcp</code> also registers its MCP tools.",
|
||
"d.cn.launcher_args": "Your own arguments pass straight through: <code>bili pi -r</code>.",
|
||
"d.cn.url_hint": "Replace the trailing https://api.openai.com/v1 with each client's original upstream address — see the table below for exactly where to put it.",
|
||
"d.th_cmd": "Command (click to copy)",
|
||
"d.cf.t_compress": "compress — every knob",
|
||
"d.cf.t_routes": "providers — route table fields",
|
||
"d.cf.t_top": "Other top-level fields",
|
||
"d.cf.th_param": "Parameter",
|
||
"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. <code>https://</code> keys match /bili/ traffic; <code>mitm://</code> 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).",
|
||
"cw.ohmp": "Cap (0–1, default 0.25) on the share of the window reserved for output via max_tokens.",
|
||
"cw.ngt": "Growth gate (default 50000): nudges fire only when a foldable range exceeds baseline growth by this many tokens.",
|
||
"cw.tnt": "Per-tier token-mass trigger thresholds for the T1/T2/T3 paths; each unset sub-field keeps its derived value (T1 = growth step, T2/T3 = step × 1.5).",
|
||
"cw.mpbt": "Minimum reclaimable tokens for a pressure-band nudge to fire (default max(5000, limit × 1%)); explicit 0 restores legacy any-pending behavior (#3211).",
|
||
"cw.nmd": "Model-decided nudge timing (off by default): an armed tier-1 nudge first asks the model, over the session's cached prefix, whether compressing now helps the current task; a strict-JSON yes injects a directive with a program-finalized span, anything else injects nothing this round.",
|
||
"cw.ndmt": "Output budget (tokens) of the model-decision side call (default 200). Must be > 0.",
|
||
"cw.ssm": "Force streaming (SSE) summarization from the first attempt — stream-mandating upstreams now self-heal via a one-shot SSE probe on any non-streaming 400 (#2494); kept as the escape hatch for gateways that time out long non-streaming calls (e.g. Cloudflare 524), which the self-learn cannot detect, or to skip the one probe round-trip.",
|
||
"cw.prm": "Kernel default 3 (tuned 5 → 3, #3058): 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.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.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).",
|
||
"ct.prt2": "Subtraction form: recent-zone tools minus this list get full protection. An empty array here is rejected as a typo.",
|
||
"ct.vm": "Append 📦/❌ visibility markers after compress/decompress/search_context/acp_status results (on by default; off stops imitated narration).",
|
||
"ct.rules": "Off by default: persistent model reminders delivered through an injected acp_rule tool, hard-protected from folds. pi/omp expose an /acp-rule command.",
|
||
"ct.it": "Register the acp_compress tool for clients (on by default; global level only).",
|
||
"ct.in": "Send growth nudges as the window fills (on by default; global level only).",
|
||
"ct.rz": "{ drop?, threshold? } — drop finished-round reasoning runs longer than 2048 chars (drop: true by default); strict-reasoning upstreams need drop:false.",
|
||
"co.absorb": "<code>absorb</code> — opt-in instant distillation of large tool results into short abstracts; originals go to the content store (<span class='mech'>enabled, minToolTokens (default 1000), contextThresholdPct, excludeTools, toolName \"absorb\"</span>).",
|
||
"co.ccr": "<code>ccr</code> — 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 <code>acp_retrieve</code>. No cap or eviction; on by default in proxy mode since v2 (<span class='mech'>enabled, minToolTokens (~4000), excludeTools, toolName \"acp_retrieve\", maxHeadChars</span>).",
|
||
"co.searchRoot": "<code>search</code> — search-behavior settings for search_context; currently holds <code>planAware</code>.",
|
||
"co.search": "<code>search.planAware</code> — 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.",
|
||
"co.prompts": "<code>prompts</code> — override the kernel doctrine texts (<span class='mech'>compressPhilosophy, howToCompressRules, tier2DistillRules, tier3CondenseRules</span>); load-bearing for quality — gated behind acknowledgePromptsRisk.",
|
||
"co.rg": "<code>reasoningGuard</code> — auto-repair of reasoning-lattice truncation on gpt-5.x/6.x (≤3 continue-nudge rounds, marker \"Continue thinking...\") (<span class='mech'>enabled, maxContinue, maxTierN, markerText, base, offset, debugLog</span>).",
|
||
"co.os": "<code>outputSteering</code> — <span class='mech'>{ enabled? false, verbosityLevel? 2 (0–4), effortRouting? }</span>: appends a conciseness directive to the system-prompt tail; clamps mechanical continuation requests.",
|
||
"co.pp": "<code>priceProfile</code> — <span class='mech'>w / r / q</span> 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.",
|
||
"co.apr": "<code>acknowledgePromptsRisk</code> — must be true before custom prompts take effect.",
|
||
"cr.models": "Record of model name → <span class='mech'>{context?, output?, compress?, benefit?}</span>: declares each model's context window, output ceiling, and per-model compression overrides (benefit marks free-quota billing). Not a traffic filter.",
|
||
"cr.proxy": "Per-route outbound proxy URL; empty string = explicitly direct.",
|
||
"cr.cp": "Which ACP injection surface this lane speaks: native tools (default) or prompt markers.",
|
||
"cr.proto": "Declare this lane's wire protocol. A client-side /bili/<protocol>/ URL marker outranks the declaration; unparseable bodies relay verbatim.",
|
||
"cr.compress": "Any compress field can be overridden here — level 2 of the global→provider→model merge (per-field, deepest wins).",
|
||
"cr.compat": "{ 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).",
|
||
"cr.direct": "Client-side exemption: traffic for this upstream is never pointed at bili at all — unlike passthrough, it does not even terminate there.",
|
||
"cr.pt": "Route-scoped byte-for-byte relay with no session state — for anti-fraud upstreams.",
|
||
"cr.ib": "Image-token counting basis for this route: auto (→ pixels), pixels, or bytes (explicit opt-in for byte relays).",
|
||
"cr.itc": "Per-image token cost cap for this route; unset = uncapped.",
|
||
"cr.resign": "Per-route overrides of the global resign map (level 2, deepest wins).",
|
||
"cr.bind": "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.",
|
||
"cr.lanekey": "Lane credential override (#2336): requests forwarded through this lane carry this env variable's value instead of the client's own credential — x-api-key / x-goog-api-key replaced outright, Bearer authorization replaced, injected when absent. Exactly one of apiKeyEnv / credentialRef per entry.",
|
||
"cr.lanecred": "Lane credential override via the private summary-credential store (`secret:NAME` semantics); exactly one of apiKeyEnv / credentialRef per entry.",
|
||
"cr.calib": "Per-route k̂ calibration policy (#3211): `disabled` suppresses the learned factor on this route; `max` clamps it (0 < max ≤ 4). Applied at publication time — the learned ring stays raw.",
|
||
"cr.optin": "Named entries only: opt a non-http(s)-baseUrl provider into compaction ownership (pi/omp lanes); unions with env BILI_NON_HTTP_PROVIDERS.",
|
||
"tg.core": "<strong>Server & core</strong>",
|
||
"tg.up": "<strong>Upstream & billing</strong>",
|
||
"tg.beh": "<strong>Behavior toggles</strong>",
|
||
"tg.mitm": "<strong>MITM lane</strong>",
|
||
"tg.proc": "<strong>Process blocks</strong>",
|
||
"tg.diag": "<strong>Diagnostics & updates</strong>",
|
||
"tg.adv": "<strong>Advanced scalars</strong>",
|
||
"tt.diag": "<code>diagnostics</code> — local troubleshooting knobs: <span class='mech'>dumpBody false · dumpReq true · rawDumpDir · dump4xx false (+MaxBytes 2 MiB) · renderNone/noInjectTool/noCompressPrompt false · countTokensPassthrough false · compressProtocol \"tools\"</span>.",
|
||
"tt.fake": "<code>fakeCompletion</code> — retry loop for truncated final chunks: <span class='mech'>retries 0 (opt-in) · bufCapBytes 16 MiB</span>.",
|
||
"tt.ccx": "<code>codexCompact</code> — intercept | pass (default intercept): handle Codex's compaction requests in bili or forward upstream — explicit forms plus the inline auto-compact transiting as an ordinary turn (prompt-form detection, #3008; overridden compact_prompt transits verbatim).",
|
||
"ttl.ttl": "<code>ccrRetrievalTtlMs</code> — lifetime of CCR retrieval pointers (default 600000; 0 disables retrieval).",
|
||
"ttl.tmp": "<code>decompressTmpCap</code> — size cap for temporary decompressed blocks (default 50).",
|
||
"tt.network": "<code>network</code> — transport timeouts & replays: <span class='mech'>upstreamTimeoutMs 720000 · requestWatchdogMs 2× · replayRetryMax 3 · replayRetryBaseMs 1500 · keepAliveTimeoutMs 5000 · clientErrorBackstopMs 30000 · exposureLogIntervalMs 3600000 · streamKeepAliveMs 15000 · preflightHoldMs 30000 · preflightDeadEndCooldownMs 300000 · proxyKeepAliveMaxMs 55000</span>.",
|
||
"tt.persist": "<code>persist</code> — session persistence to disk: <span class='mech'>enabled true · zstd false · debounceMs 500 · tailTokens 16384 · epermAlertThreshold 5 · epermAlertRepeatMs 0</span>.",
|
||
"tt.storage": "<code>storage</code> — unified storage sidecar: <span class='mech'>unified legacy</span> — file tier selects the lane-wide storage mode; env BILI_STORAGE_UNIFIED wins when set.",
|
||
"tt.sessions": "<code>sessions</code> — <span class='mech'>max 256 (LRU) · gc { enabled false, maxAgeDays 7, maxTokens 1000000, intervalMs 3600000 }</span> — GC is opt-in; user data is never pruned silently.",
|
||
"tt.snap": "<code>plugin.snapshotCapBytes</code> — fork API snapshot cap (default 100 MiB; 0 disables snapshots).",
|
||
"tt.rollout": "<code>rollout</code> — canary gating: features enable for a percent of installs, bucketed on a stable per-machine UUID; nested <span class='mech'>base</span> rolls B out only inside A's cohort.",
|
||
"tt.port": "<code>port</code> — listen port (default 8787).",
|
||
"tt.host": "<code>host</code> — bind address (default 127.0.0.1; \"::\" is dual-stack, 0.0.0.0 exposes outward).",
|
||
"tt.sessionheader": "<code>sessionHeader</code> — HTTP header carrying the session id (default x-acp-session).",
|
||
"tt.log": "<code>log</code> — file logging master switch (on by default).",
|
||
"tt.logfile": "<code>logFile</code> — explicit path for bili.log (env ACP_LOG_FILE wins).",
|
||
"tt.debug": "<code>debug</code> — verbose per-request logging.",
|
||
"tt.dumsse": "<code>dumpSse</code> — raw SSE stream dump level for debugging.",
|
||
"tt.pt3": "<code>passthrough</code> — global raw-relay switch (off by default; ACP_PASSTHROUGH / --passthrough win over the file).",
|
||
"tt.upstream": "<code>upstream</code> — fallback upstream base URL (ACP_UPSTREAM overrides).",
|
||
"tt.proxy": "<code>proxy</code> — 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": "<code>providersPath</code> — external routes file path (env ACP_PROVIDERS beats both it and inline providers).",
|
||
"tt.mcl2": "<code>modelContextLimit</code> — legacy global window ceiling (default 200000); prefer compress.modelContextLimit.",
|
||
"tt.ib2": "<code>imageBilling</code> — global image-token estimation: \"auto\" (default → pixels), \"pixels\" or \"bytes\" (explicit opt-in for byte relays).",
|
||
"tt.itc2": "<code>imageTokenCap</code> — global per-image token cap; unset = uncapped (BILI_IMAGE_TOKEN_CAP wins, read live).",
|
||
"tt.mask": "<code>maskHosts</code> — mask non-public host names in logs as <private-host> (on by default; credentials are always masked).",
|
||
"tt.subagent": "<code>subagentSplit</code> — Claude subagents get their own session namespace (on by default).",
|
||
"tt.fork": "<code>forkAdoption</code> — adopt anonymous forks into their parent session (off by default).",
|
||
"tt.autoforge": "<code>autoModeForge.enabled</code> — answer Claude Code auto-mode classifier calls locally with a forged allow verdict (on by default; <code>BILI_AUTO_MODE_FORGE=0</code> = pure passthrough).",
|
||
"tt.simhash": "<code>affinitySimhash</code> — simhash chain-alignment re-attaches sessions after pervasive client rewrites (on by default).",
|
||
"tt.resinherit": "<code>resumeInheritance</code> — inherited refs/blocks on resume (cc --resume) (on by default).",
|
||
"tt.chain": "<code>chainContentDetection</code> — recognize bili-owned traffic by body content (off; false-positive risk).",
|
||
"tt.stamp": "<code>chainEgressStamp</code> — model-visible stamp on egress messages (off; burns tokens).",
|
||
"tt.anchor": "<code>stableSystemAnchor</code> — best-effort wire-layer prefix-cache anchor (off; plain-proxy lanes).",
|
||
"tt.compat": "<code>compat</code> — wire-compatibility block: role remaps, stream error shape, strict-schema field drops, cache-control handling.",
|
||
"tt.nat": "<code>native.attachExternal</code> — let launcher-less native plugins attach to an external daemon (off by default).",
|
||
"tt.mitm": "<code>mitm.enabled</code> / <code>mitm.domains</code> — HTTPS interception switch and whitelist domains for login clients.",
|
||
"tt.mitm2": "<code>mitm.handshakeTimeoutMs</code> — TLS handshake timeout (default 10000).",
|
||
"tt.aupd": "<code>autoUpdate</code> — automatic version checks (on by default; disable via ACP_AUTO_UPDATE=0 or --no-auto-update).",
|
||
"tt.arst": "<code>autoRestartOnUpdate</code> — restart the daemon automatically once a newer version is installed (opt-in).",
|
||
"tt.utag": "<code>updateTag</code> — npm dist-tag channel: latest (default), dev, or pr.",
|
||
"tt.update": "<code>update</code> — self-update channel: <span class='mech'>registry \"npmjs\" · checkIntervalMs 180000</span>.",
|
||
"tt.advisory": "<code>advisoryCheck</code> / <code>advisoryUrl</code> — critical-defect advisory watcher (on by default; force-installs the recommended fix when your version is affected).",
|
||
"tt.rnotes": "<code>releaseNotesCheck</code> / <code>releaseNotesUrl</code> — release-notes feed for the panel (on by default; fetch + cache only, never installs).",
|
||
/* /bili:gen */
|
||
"d.wu.access": "Access: open <a href=\"http://127.0.0.1:8787/__bili/\">http://127.0.0.1:8787/__bili/</a> once the proxy is up — every instance serves this same built-in dashboard on its own loopback address (ACP_PORT overrides). Or just type <code>/acp</code> 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 (<code>bili doctor</code>) and the port isn't changed (default 8787 for the standalone daemon; launcher lanes start at 18787). The dashboard binds <code>127.0.0.1</code> only — from another machine or phone you need an SSH port-forward or an explicit ACP_HOST setting.",
|
||
"d.toc_ref": "Full parameter reference",
|
||
"d.qs.next": "Next stop: the panel below — configuration, session stats, and live logs all live there.",
|
||
"d.ref.intro": "Every knob in detail. Generated from the same seed as the repository's CONFIGURATION.md (CI drift-guarded), so the site and the repo docs stay one copy.",
|
||
"d.cf.panel_cta": "Configure it in the panel instead of by hand: the <a href=\"http://127.0.0.1:8787/__bili/#/config\">configuration page</a> (<a href=\"http://127.0.0.1:18787/__bili/#/config\">here</a> on a launcher agent's instance) validates every edit, offers quick-config controls, and writes this same file — environment variables still win over it when set.",
|
||
"fa.cache.q": "How do I check my cache hit rate?",
|
||
"fa.cache.a": "Don't dig through logs — type <code>/acp-cache</code> in your client: a summary report prints in the terminal headed by a clickable Web UI link (the session page adds the hit-rate chart plus per-break attribution). Rule of thumb: a healthy session sits at <strong>95–97%</strong>; compression itself costs ≤2%. When lower, the usual suspects in order: ① upstream cache-TTL expiry, ② a mid-session model switch (re-bills the whole stable prefix), ③ a bili bug — report it with the page attached. <code>/acp-cache full</code> lists every fold & line item; HTTP equivalent: <code>GET /__bili/cache-report</code>.",
|
||
"fa.acp.q": "What does /acp show?",
|
||
"fa.acp.a": "In clients with the native plugin (opencode, dsh), <code>/acp</code> renders the ACP status panel of the current conversation straight from the proxy — session, blocks, compressible ranges, usage; before the first model request it shows an idle notice. <code>/acp-cache [full]</code> prints the cache report above.",
|
||
"fa.webq.q": "Can I query sessions and config over the web?",
|
||
"fa.webq.a": "Yes — open <a href=\"http://localhost:8787\">http://localhost:8787</a>: overview dashboard, session list with per-session detail, live logs, a config editor, and an upstream connectivity test. Everything is also plain JSON for scripting (<code>/__bili/stats</code>, <code>/__bili/sessions</code>, <code>/__bili/config</code>, …).",
|
||
"fa.when.q": "When does compression happen?",
|
||
"fa.when.a": "It is model-driven: the injected context tools are called by the model as context grows, growth nudges (~50K-token steps by design, adjustable via <code>compress.nudgeGrowthTokens</code>) prompt it along the way, and preflight fires as a hard backstop when the input alone exceeds the window. Watch it live with <code>/acp</code> or the web UI.",
|
||
"fa.fc.q": "Why does the first compaction wait until ~200k?",
|
||
"fa.fc.a": "Compaction triggers on growth intervals, not absolute window position: by default the first soft compaction fires 50k tokens past the boot content (<code>compress.nudgeGrowthTokens</code>, flat and window-independent) — with a ~100k boot it may wait until ~200k. To make it fire earlier: trim the system prompt / disable unneeded tools / prune skills, lower <code>compress.nudgeGrowthTokens</code> to ~50k, or enable lean mode.",
|
||
"fa.transp.q": "Is bili transparent? How do I turn it off?",
|
||
"fa.transp.a": "Unrecognized endpoints forward unchanged, and every mode reverses cleanly: <code>bili plugin remove <client></code> for native installs; stop using the launcher command / env vars / <code>/bili/</code> prefix for the other two — traffic goes direct again immediately. Per-client mechanics: <a href=\"https://github.com/ranxianglei/billion-context/blob/master/CLIENTS.md\">CLIENTS.md</a>.",
|
||
"fa.paths.q": "Where are logs and session data stored?",
|
||
"fa.paths.a": "Log: <code>~/.local/state/billion-context/bili.log</code> (also mirrored to stderr); session state: <code>~/.local/share/billion-context/</code> (XDG-overridable). Full paths: <a href=\"https://github.com/ranxianglei/billion-context/blob/master/CONFIGURATION.md\">CONFIGURATION.md</a>.",
|
||
"doc.page_title": "billion-context · Docs",
|
||
"d.h1": "Documentation",
|
||
"d.sub": "Everything you need to run billion-context locally and connect your agents. Exhaustive references live in the repository: CONFIGURATION.md, TECHNICAL-NOTES.md, PLUGIN.md, SESSION-IDENTITY.md.",
|
||
"d.toc_qs": "Quickstart",
|
||
"d.toc_connect": "Connect clients",
|
||
"d.toc_commands": "Commands",
|
||
"d.toc_config": "Configuration",
|
||
"d.toc_how": "How compression works",
|
||
"d.toc_webui": "Web UI",
|
||
"d.toc_privacy": "Privacy",
|
||
"d.toc_faq": "FAQ",
|
||
"d.toc_links": "Resources",
|
||
"d.qs.p": "One npm package, Node 22+. Install it, then start the local compression proxy:",
|
||
"d.qs.p2": "Everything binds loopback only — nothing is exposed externally. Every instance serves the same built-in dashboard under its own address:",
|
||
"d.cn.p": "Three ways to put the proxy between your agent and the model. Pick whichever fits your client:",
|
||
"d.cn.m1": "Installs a thin plugin straight into the client (the original file is backed up once); deepest integration, with native in-conversation tools. Covers pi · omp · claude · codex · opencode · dsh · kimi · hermes · zcode:",
|
||
"d.cn.m2": "Zero config edits: wraps any CLI agent and injects the proxy + compression state automatically. Each launch brings up a fresh throwaway proxy instance:",
|
||
"d.cn.m3": "Any client that accepts a custom endpoint works out of the box: point its base URL at the prefix below, keeping the original upstream address as the tail:",
|
||
"d.cn.table_note": "Per-client integration detail:",
|
||
"d.th_client": "Client",
|
||
"d.th_method": "Methods",
|
||
"d.th_mech": "Key mechanism",
|
||
"d.cn.mitm": "Clients that hard-code HTTPS upstreams are handled by an automatic certificate: domains the client reaches are whitelisted on first sight. Need another host? Add it explicitly:",
|
||
"cmd.daemon": "Start the standalone proxy daemon (default port 8787).",
|
||
"cmd.launch": "Bring up a throwaway proxy + launch the chosen client against it — no config edits.",
|
||
"cmd.plugin": "Manage the per-client plugins and their update lanes.",
|
||
"cmd.test": "Non-polluting smoke test through the proxy.",
|
||
"cmd.export": "List sessions, or export one as a Markdown handoff document (--full restores original messages).",
|
||
"cmd.doctor": "Audit every install lane: versions, owners, running proxies (read-only).",
|
||
"cmd.update": "Check for and install a newer version now.",
|
||
"cmd.acp": "Live context panel inside your agent — includes this session's web-dashboard link.",
|
||
"cmd.acpcache": "Token economics report for the session: new content vs cache hits vs compression repay.",
|
||
"d.cf.p": "Everything lives in one JSON file, created automatically on first run and hot-reloaded while you edit:",
|
||
"d.cf.env": "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:",
|
||
"d.how.p": "The same four mechanisms as the front page, condensed:",
|
||
"d.how.paper": "The full treatment, with numbers: <a href=\"https://github.com/ranxianglei/billion-context/blob/master/paper/model-driven-incremental-hierarchical-compression-training-free-multi-generational-context-management-for-long-lived-coding-agents.md\" target=\"_blank\" rel=\"noopener\">read the preprint</a>.",
|
||
"d.wu.p": "Every running instance serves a built-in dashboard at <code>/__bili/</code>:",
|
||
"d.wu.ov": "Overview — total sessions and requests, gross and net savings, global hit rate with miss breakdown, protocol distribution.",
|
||
"d.wu.se": "Sessions — usage cards, context trajectory chart, cache economics with fold detail, compression blocks, and the Markdown handoff document (copy or download).",
|
||
"d.wu.cf": "Configuration — view and edit the JSON config; changes apply immediately.",
|
||
"d.wu.cn": "Connect — per-instance wiring guide with copyable commands.",
|
||
"d.wu.lo": "Logs — live tail of the daemon log, filterable by session id or keyword, downloadable as plain text.",
|
||
"d.pr.p1": "billion-context runs only on your machine and binds loopback by default. It forwards model traffic — OAuth tokens pass through untouched, unauthenticated probes aside — and uploads nothing.",
|
||
"d.pr.p2": "Session records stay local (<code>~/.local/share/billion-context/sessions</code>); the log sits beside the state dir. Export any session with <code>bili export</code>, delete files whenever you like.",
|
||
"fa.node.q": "Which Node version?",
|
||
"fa.node.a": "Node 22 or newer — required by the npm package.",
|
||
"fa.win.q": "Does it work on Windows?",
|
||
"fa.win.a": "Recommended: WSL2. Inside WSL everything uses 127.0.0.1 as usual; a Windows-side client should reach the proxy via the WSL host IP, or simply run the client inside WSL too.",
|
||
"fa.cost.q": "Do I pay for the proxy itself?",
|
||
"fa.cost.a": "No — it's free and open source (MIT plus an attribution clause). Token savings come from smaller contexts and your provider's prompt caching; the economics panel shows the real per-session numbers.",
|
||
"fa.up.q": "How do I upgrade?",
|
||
"fa.up.a": "Run <code>bili update</code> (or reinstall via npm). Use <code>bili doctor</code> before and after to audit every install lane.",
|
||
"paper.kicker": "Peer-reviewable by anyone",
|
||
"paper.t": "Model-driven incremental hierarchical compression: training-free multi-generational context management for long-lived coding agents",
|
||
"paper.b": "The method behind the product, open-sourced under MIT inside the repository and updated as a living document. A 4.5-month production study across three hosts: 174,327 model calls, 18.76B cumulative input tokens, zero window violations.",
|
||
"paper.cta": "Read the preprint",
|
||
"foot.note": "MIT-licensed plus one attribution term: products built on it say so publicly. Built with open source; runs entirely on your machine."
|
||
},
|
||
zh: {
|
||
"doc.title": "billion-context — 在 100K 窗口上跑月级编码会话",
|
||
"nav.how": "工作原理",
|
||
"nav.agents": "支持客户端",
|
||
"nav.install": "安装",
|
||
"nav.paper": "论文",
|
||
"nav.docs": "文档",
|
||
"nav.blog": "博客",
|
||
"hero.kicker_live": "运行在你自己的机器上,不碰其他数据",
|
||
"hero.t1": "月级长会话,",
|
||
"hero.t2": "百 K 窗口就够。",
|
||
"hero.lede": "<strong>billion-context</strong> 是面向 AI 编码代理的本地上下文压缩代理 —— <em>billion-context is all you need.</em> 小窗口足够用:让 100K 窗口的模型连续工作数天,token 消耗最高省 5 倍,并且对移走的每个 token 都有账可查。",
|
||
"hero.cta1": "立即开始",
|
||
"hero.cta2": "阅读源码",
|
||
"bullet1": "提示词缓存感知的压缩 —— 重写的代价几乎为零",
|
||
"bullet2": "逐请求账本:新增内容 vs 复付成本,终端内直接可见",
|
||
"bullet3": "透明代理接入 —— 无需修改任何客户端源码",
|
||
"stat1": "单任务 token 消耗降低倍数",
|
||
"stat2": "纵向研究覆盖的模型调用次数",
|
||
"stat3": "累计被压缩的输入 token(B)",
|
||
"stat4": "次窗口越界(204,800-token 模型上)",
|
||
"stats.src": "数据来自开源的实证研究(4.5 个月、3 台主机、最长单会话 8,584–12,049 次调用)——见下方论文。",
|
||
"wall.label": "支持你已在使用的编码代理",
|
||
"how.title": "工作原理",
|
||
"how.sub": "不是更大的窗口,而是更好的结构。四个机制把数月的工程量收进普通上下文上限:",
|
||
"m1.t": "折叠,而不是重写",
|
||
"m1.b": "历史超出预算时,只有新消耗的增量被折叠进紧凑的摘要块——每块一生只折一次。窗口在有限区间内起伏,而不是无限增长:生产会话跑过数月、上万次调用。需要细节时,任何一块都能展开回完整原文。",
|
||
"m2.t": "服务商的缓存保持温热",
|
||
"m2.b": "折叠只停用旧区段、不动对话开头,提示词缓存前缀因此轮轮存活——研究中活跃流量 94.2% 的输入来自缓存读取。重写式压缩会作废整个前缀、重新计费;这里不会。",
|
||
"m3.t": "由模型决定忘记什么",
|
||
"m3.b": "一份可版本化的压缩原则常驻系统提示词,增长门槛提醒告诉它何时折叠划算。模型自行判断当前任务还需要什么,有权拒绝,只在步骤之间压缩——绝不打断步骤。",
|
||
"m4.t": "每个 token 都有账",
|
||
"m4.b": "每次请求采样进逐会话账本——新增内容、缓存命中、压缩复付、TTL 过期——以百分点绘成轨迹图。终端里敲 <code>/acp</code>,或打开内置 Web UI <code>/__bili/</code>,审计真实节省。",
|
||
"install.title": "不到一分钟即可上手",
|
||
"install.intro": "<strong>一个 npm 包,Node 22+。</strong>然后选择接入方式:",
|
||
"im1.t": "原生插件 —— 推荐",
|
||
"im1.b": "直接装进客户端、集成最深:<code>bili plugin install pi</code>。覆盖 pi · omp · claude · codex · opencode · dsh · kimi · hermes · zcode。",
|
||
"im2.t": "启动器 —— 任意代理都可用",
|
||
"im2.b": "包住你的客户端命令、自动注入 bili,零配置改动:<code>bili pi</code>、<code>bili codex</code>、<code>bili claude</code> —— 约二十个代理。",
|
||
"im3.t": "通用代理",
|
||
"im3.b": "任何支持自定义接入地址的客户端开箱即用:把它的 base URL 指向 <code>http://localhost:8787/bili/<原上游地址></code>。",
|
||
"codebox.file": "终端",
|
||
"common.copy": "复制",
|
||
"common.copied": "已复制 ✓",
|
||
"install.after": "接好了?在 Agent 里输入 <code>/acp</code> 看实时面板、<code>/acp-cache</code> 看 token 经济学。各客户端细节、MITM 模式与排障:<a href=\"docs/#connect\">接入指南</a>。",
|
||
"d.cn.chip_copy": "点击上方任意命令即可复制。",
|
||
"d.cn.mcp_note": "opencode 用 <code>bili plugin install opencode --with-mcp</code> 可同时注册其 MCP 工具。",
|
||
"d.cn.launcher_args": "自己的参数直接跟在后面:<code>bili pi -r</code>。",
|
||
"d.cn.url_hint": "把尾部 https://api.openai.com/v1 换成各客户端原来的上游地址——具体放哪见下表。",
|
||
"d.th_cmd": "命令(点击复制)",
|
||
"d.cf.t_compress": "compress —— 逐项说明",
|
||
"d.cf.t_routes": "providers —— 路由表字段",
|
||
"d.cf.t_top": "其他顶层字段",
|
||
"d.cf.th_param": "参数",
|
||
"d.cf.th_type": "类型",
|
||
"d.cf.th_desc": "作用",
|
||
"d.cf.routes_intro": "键是上游 URL 前缀——最长前缀优先、边界安全。<code>https://</code> 键匹配 /bili/ 流量,<code>mitm://</code> 键匹配 MITM 通道的登录客户端流量。不带任何字段的条目仍是普通压缩通道。",
|
||
/* bili:gen site-dict-zh */
|
||
"cw.mcl": "有效上下文窗口(token 数或 \"N%\"):使用率的分母,也是硬性 preflight 墙。窗口来源中优先级最高——覆盖路由/模型声明与顶层默认值。",
|
||
"cw.mxcl": "强制压缩提醒阈值(默认 \"75%\"):历史超过窗口的该占比时提醒立即触发,绕过增长门槛。不是硬上限。",
|
||
"cw.etc": "默认 \"95%\":历史超过窗口该占比时,对超大工具输出做紧急截断(必须 ≥ maxContextLimit)。",
|
||
"cw.ohmp": "max_tokens 输出预留占窗口的最大比例(0–1,默认 0.25)。",
|
||
"cw.ngt": "增长门槛(默认 50000):可折叠片段超出基线增长达到该 token 数才发提醒。",
|
||
"cw.tnt": "T1/T2/T3 路径的分层 token 质量触发阈值;未设置的子字段保持派生值(T1=增长步长,T2/T3=步长 × 1.5)。",
|
||
"cw.mpbt": "压力带 nudge 触发所需的最小可回收 token 数(默认 max(5000, 上限×1%));显式 0 恢复老的任意 pending 行为(#3211)。",
|
||
"cw.nmd": "模型自决的压缩时机(默认关闭):tier-1 提醒触发时,先通过会话缓存前缀上的短 side call 问模型现在压缩是否划算;严格 JSON 的 yes 注入带程序最终确定范围的指令,其余情况本轮不注入。",
|
||
"cw.ndmt": "模型决策 side call 的输出预算(token,默认 200)。必须 > 0。",
|
||
"cw.ssm": "强制摘要从首次起走流式(SSE)——要求流式的上游现在通过任何非流式 400 上的一次性 SSE 探测自愈(#2494);保留作为会掐断长非流式调用的网关(如 Cloudflare 524)的逃生通道(自学习无法感知该场景),也可用于省去一次探测往返。",
|
||
"cw.prm": "内核默认 3(5 → 3,#3058):最近消息软保护、免于折叠。",
|
||
"cw.prt": "内核默认约 5000:最近的 token 软保护、免于折叠。",
|
||
"cw.mrc": "可折叠片段的最小字符数(内核默认约 5000),更短的永不折叠。",
|
||
"cw.rec": "\"off\" | \"warn\" | \"repair\"(默认 repair):客户端在轮次之间回退或改写历史时校准已折叠状态。",
|
||
"cw.ppk": "压缩提示词包,按 项目包 → 用户包 → 内置 解析。内置:\"default\" 与 \"lean\"(单行工具描述)。不受 acknowledgePromptsRisk 门控。",
|
||
"cw.tiers": "默认开:T1→T3 分级蒸馏,把折叠成本摊到多代。",
|
||
"ct.pt": "全历史硬排除:列出工具的结果永不折叠(慎用)。",
|
||
"ct.plt": "只保护累积快照类工具的「最新一次」实例(新结果覆盖旧结果的工具,如 todo 列表)。",
|
||
"ct.nprt": "从近期保护区排除(立即可压);默认 [\"decompress\", \"search_context\", \"read\", \"bash\"]。空数组合法=不排除任何工具(最大保护)。",
|
||
"ct.prt2": "减法形式:近期区工具减去本列表得到完全保护;此处空数组按笔误拒绝。",
|
||
"ct.vm": "在 compress/decompress/search_context/acp_status 结果后追加 📦/❌ 可见性标记(默认开;关闭可抑制模型模仿叙述)。",
|
||
"ct.rules": "默认关:通过注入的 acp_rule 工具提供持久模型提醒——对折叠硬保护。pi/omp 提供 /acp-rule 命令。",
|
||
"ct.it": "向客户端注册 acp_compress 工具(默认开;仅全局层级生效)。",
|
||
"ct.in": "窗口填满过程中发送增长提醒(默认开;仅全局层级生效)。",
|
||
"ct.rz": "{ drop?, threshold? }——丢弃超过 2048 字符的已结束轮次推理块(drop 默认 true);严格推理上游需设 drop:false。",
|
||
"co.absorb": "<code>absorb</code> —— 可选即时蒸馏:把大段工具结果蒸馏成短摘要,原文进内容库(<span class='mech'>enabled, minToolTokens(默认 1000), contextThresholdPct, excludeTools, toolName \"absorb\"</span>)。",
|
||
"co.ccr": "<code>ccr</code> —— 内容缓存与回取:大输出无损存到会话旁、替换为首段摘录+指针,模型用 <code>acp_retrieve</code> 取回原文;无上限、永不清除;自 v2 起代理模式默认开(<span class='mech'>enabled, minToolTokens(~4000), excludeTools, toolName \"acp_retrieve\", maxHeadChars</span>)。",
|
||
"co.searchRoot": "<code>search</code> —— search_context 的检索行为设置;当前含 <code>planAware</code>。",
|
||
"co.search": "<code>search.planAware</code> —— 默认关:开启后 search_context 候选按当前计划状态重排(todo 最新优先 + 上一轮用户消息);关闭时结果逐字节不变。",
|
||
"co.prompts": "<code>prompts</code> —— 覆盖内核教条文本(<span class='mech'>compressPhilosophy, howToCompressRules, tier2DistillRules, tier3CondenseRules</span>);对压缩质量承重要——受 acknowledgePromptsRisk 门控。",
|
||
"co.rg": "<code>reasoningGuard</code> —— gpt-5.x/6.x 推理格截断自动修复(≤3 轮继续提示,标记 \"Continue thinking...\")(<span class='mech'>enabled, maxContinue, maxTierN, markerText, base, offset, debugLog</span>)。",
|
||
"co.os": "<code>outputSteering</code> —— <span class='mech'>{ enabled? false, verbosityLevel? 2 (0–4), effortRouting? }</span>:向系统提示词尾部附加简洁度指令;只收紧机械延续请求。",
|
||
"co.pp": "<code>priceProfile</code> —— <span class='mech'>w / r / q</span> 相对输入价的比率(写入/缓存读/输出);未设置 ⇒ 取 models.dev $/Mtok 注册表行,内核兜底 {1, 0.1, 4}。仅供报告,不影响触发条件或线上行为。",
|
||
"co.apr": "<code>acknowledgePromptsRisk</code> —— 必须先置 true,自定义 prompts 才会生效。",
|
||
"cr.models": "模型名 → <span class='mech'>{context?, output?, compress?, benefit?}</span> 的记录:声明每个模型的上下文窗口、输出上限与逐模型压缩覆盖(benefit 标记免费额度计费)。不是流量过滤器。",
|
||
"cr.proxy": "本路由出站代理地址;空字符串 = 显式直连。",
|
||
"cr.cp": "本通道的 ACP 注入面:原生工具(默认)或提示词标记。",
|
||
"cr.proto": "声明本通道的线上协议。客户端侧 /bili/<protocol>/ URL 标记优先级更高;不可解析的请求体原样转发。",
|
||
"cr.compress": "任意 compress 字段可在此覆盖——全局→provider→模型三级合并的第 2 级(逐字段、最深层胜出)。",
|
||
"cr.compat": "{ roles?, dropFields? } —— 重写上游拒收的角色(如 developer→system);provider 条目按键级覆盖全局;dropFields 剔除严格 schema 拒收的字段(加法并集)。",
|
||
"cr.direct": "客户端侧豁免:该上游流量完全不指向 bili——与 passthrough 不同,连终结都不经过它。",
|
||
"cr.pt": "路由级逐字节透传、无会话状态——面向反作弊上游。",
|
||
"cr.ib": "本路由图片 token 计费口径:auto(默认→pixels)、pixels 或 bytes(字节中继需显式指定)。",
|
||
"cr.itc": "本路由单张图片 token 成本上限;未设置 = 不限制。",
|
||
"cr.resign": "按路由覆盖全局 resign 映射(第 2 级,最深层胜出)。",
|
||
"cr.bind": "具名(非 URL)条目:加载配置时深合并到所绑定的 URL 通道作为别名;无 bind 的具名条目不参与路由。",
|
||
"cr.lanekey": "通道凭据覆盖(#2336):经该通道转发的请求使用此环境变量的值取代客户端自带凭据——x-api-key / x-goog-api-key 直接替换、Bearer authorization 替换、缺失时注入。每个条目与 credentialRef 二选一。",
|
||
"cr.lanecred": "经私有摘要凭据存储的通道凭据覆盖(`secret:NAME` 语义);每个条目与 apiKeyEnv 二选一。",
|
||
"cr.calib": "按路由的 k̂ 校准策略(#3211):`disabled` 在该线路禁用学习系数;`max` 钳制学习系数(0 < max ≤ 4)。作用于发布环节——学习环保持原始值。",
|
||
"cr.optin": "仅命名条目:把非 http(s) baseUrl 供应商纳入压缩所有权(pi/omp 车道);与 env BILI_NON_HTTP_PROVIDERS 取并集。",
|
||
"tg.core": "<strong>服务与核心</strong>",
|
||
"tg.up": "<strong>上游与计费</strong>",
|
||
"tg.beh": "<strong>行为开关</strong>",
|
||
"tg.mitm": "<strong>MITM 通道</strong>",
|
||
"tg.proc": "<strong>进程级块</strong>",
|
||
"tg.diag": "<strong>诊断与更新</strong>",
|
||
"tg.adv": "<strong>高级标量</strong>",
|
||
"tt.diag": "<code>diagnostics</code> —— 本地排障旋钮:<span class='mech'>dumpBody false · dumpReq true · rawDumpDir · dump4xx false (+MaxBytes 2 MiB) · renderNone/noInjectTool/noCompressPrompt false · countTokensPassthrough false · compressProtocol \"tools\"</span>。",
|
||
"tt.fake": "<code>fakeCompletion</code> —— 被截断末块的补完成重试环:<span class='mech'>retries 0 (可选) · bufCapBytes 16 MiB</span>。",
|
||
"tt.ccx": "<code>codexCompact</code> —— intercept | pass(默认 intercept):在 bili 内处理 Codex 压缩请求或转给上游 —— 显式形态 + 以普通请求形态过线的内联自动压缩(prompt 文本检测,#3008;自定义 compact_prompt 按原样转发)。",
|
||
"ttl.ttl": "<code>ccrRetrievalTtlMs</code> —— CCR 回取指针有效期(默认 600000;0 禁用回取)。",
|
||
"ttl.tmp": "<code>decompressTmpCap</code> —— 临时展开块的大小上限(默认 50)。",
|
||
"tt.network": "<code>network</code> —— 传输超时与重放:<span class='mech'>upstreamTimeoutMs 720000 · requestWatchdogMs 2× · replayRetryMax 3 · replayRetryBaseMs 1500 · keepAliveTimeoutMs 5000 · clientErrorBackstopMs 30000 · exposureLogIntervalMs 3600000 · streamKeepAliveMs 15000 · preflightHoldMs 30000 · preflightDeadEndCooldownMs 300000 · proxyKeepAliveMaxMs 55000</span>。",
|
||
"tt.persist": "<code>persist</code> —— 会话落盘持久化:<span class='mech'>enabled true · zstd false · debounceMs 500 · tailTokens 16384 · epermAlertThreshold 5 · epermAlertRepeatMs 0</span>。",
|
||
"tt.storage": "<code>storage</code> —— 统一存储边车:<span class='mech'>unified legacy</span> —— 文件层选定全 lane 存储模式;设置了 BILI_STORAGE_UNIFIED 时环境变量优先。",
|
||
"tt.sessions": "<code>sessions</code> —— <span class='mech'>max 256 (LRU) · gc { enabled false, maxAgeDays 7, maxTokens 1000000, intervalMs 3600000 }</span> —— GC 为可选:用户数据不会被悄悄清理。",
|
||
"tt.snap": "<code>plugin.snapshotCapBytes</code> —— fork API 快照上限(默认 100 MiB;0 禁用快照)。",
|
||
"tt.rollout": "<code>rollout</code> —— 灰度门控:特性按安装百分比启用,以每台机器稳定的 UUID 分桶;嵌套 <span class='mech'>base</span> 使 B 只在 A 的入组人群内放量。",
|
||
"tt.port": "<code>port</code> —— 监听端口(默认 8787)。",
|
||
"tt.host": "<code>host</code> —— 绑定地址(默认 127.0.0.1;\"::\" 双栈,0.0.0.0 对外暴露)。",
|
||
"tt.sessionheader": "<code>sessionHeader</code> —— 携带会话 id 的请求头(默认 x-acp-session)。",
|
||
"tt.log": "<code>log</code> —— 文件日志总开关(默认开)。",
|
||
"tt.logfile": "<code>logFile</code> —— bili.log 显式路径(环境变量 ACP_LOG_FILE 优先)。",
|
||
"tt.debug": "<code>debug</code> —— 逐请求详细日志。",
|
||
"tt.dumsse": "<code>dumpSse</code> —— 原始 SSE 流转储级别(排障用)。",
|
||
"tt.pt3": "<code>passthrough</code> —— 全局裸转发开关(默认关;ACP_PASSTHROUGH / --passthrough 优先于文件)。",
|
||
"tt.upstream": "<code>upstream</code> —— 兜底上游基础地址(ACP_UPSTREAM 覆盖)。",
|
||
"tt.proxy": "<code>proxy</code> —— 全局出站代理。解析顺序:按路由 → BILI_UPSTREAM_PROXY → Web UI → 本值 → HTTP(S)_PROXY 环境变量 → Windows 系统代理 → 直连。空字符串 = 显式直连;不支持 SOCKS5。",
|
||
"tt.ppath": "<code>providersPath</code> —— 外部路由文件路径(环境变量 ACP_PROVIDERS 优先于它与内联 providers)。",
|
||
"tt.mcl2": "<code>modelContextLimit</code> —— 旧版全局窗口上限(默认 200000);建议改用 compress.modelContextLimit。",
|
||
"tt.ib2": "<code>imageBilling</code> —— 全局图片 token 估算口径:\"auto\"(默认→pixels)、\"pixels\" 或 \"bytes\"(字节中继需显式指定)。",
|
||
"tt.itc2": "<code>imageTokenCap</code> —— 全局单图 token 上限;未设置 = 不限(BILI_IMAGE_TOKEN_CAP 优先且实时读取)。",
|
||
"tt.mask": "<code>maskHosts</code> —— 日志中把非公开主机名遮成 <private-host>(默认开;凭据总是遮盖)。",
|
||
"tt.subagent": "<code>subagentSplit</code> —— Claude 子代理拥有独立会话命名空间(默认开)。",
|
||
"tt.fork": "<code>forkAdoption</code> —— 匿名 fork 会话并入父会话(默认关)。",
|
||
"tt.autoforge": "<code>autoModeForge.enabled</code> —— Claude Code auto mode 分类器请求本地代答放行判定(默认开;<code>BILI_AUTO_MODE_FORGE=0</code> 纯透传)。",
|
||
"tt.simhash": "<code>affinitySimhash</code> —— 大面积客户端改写后按 simhash 链对齐重新挂回会话(默认开)。",
|
||
"tt.resinherit": "<code>resumeInheritance</code> —— resume(cc --resume)继承引用与区块(默认开)。",
|
||
"tt.chain": "<code>chainContentDetection</code> —— 按请求体内容识别 bili 自有流量(默认关;有误报风险)。",
|
||
"tt.stamp": "<code>chainEgressStamp</code> —— 在出口消息上打模型可见的标记(默认关;消耗 token)。",
|
||
"tt.anchor": "<code>stableSystemAnchor</code> —— 线路层尽力而为的前缀缓存锚点(默认关;纯代理通道)。",
|
||
"tt.compat": "<code>compat</code> —— 线上兼容块:角色映射、流式错误形态、严格 schema 字段剔除、缓存控制处理。",
|
||
"tt.nat": "<code>native.attachExternal</code> —— 允许无启动器的原生插件挂到外部守护进程(默认关)。",
|
||
"tt.mitm": "<code>mitm.enabled</code> / <code>mitm.domains</code> —— 登录客户端 HTTPS 拦截开关与白名单域名。",
|
||
"tt.mitm2": "<code>mitm.handshakeTimeoutMs</code> —— TLS 握手超时(默认 10000)。",
|
||
"tt.aupd": "<code>autoUpdate</code> —— 自动版本检查(默认开;ACP_AUTO_UPDATE=0 或 --no-auto-update 关闭)。",
|
||
"tt.arst": "<code>autoRestartOnUpdate</code> —— 新版本装好后自动重启守护进程(可选开启)。",
|
||
"tt.utag": "<code>updateTag</code> —— npm dist-tag 通道:latest(默认)、dev 或 pr。",
|
||
"tt.update": "<code>update</code> —— 自更新通道:<span class='mech'>registry \"npmjs\" · checkIntervalMs 180000</span>。",
|
||
"tt.advisory": "<code>advisoryCheck</code> / <code>advisoryUrl</code> —— 关键缺陷公告监视器(默认开;本机版本命中受影响范围时装填推荐修复版本)。",
|
||
"tt.rnotes": "<code>releaseNotesCheck</code> / <code>releaseNotesUrl</code> —— 面板里的发布说明源(默认开;只抓取缓存、从不安装)。",
|
||
/* /bili:gen */
|
||
"d.wu.access": "访问方式:代理起来后打开 <a href=\"http://127.0.0.1:8787/__bili/\">http://127.0.0.1:8787/__bili/</a>——每个实例都在自己的回环地址上提供同一套内置面板(可用 ACP_PORT 覆盖)。也可以直接在 agent 里输入 <code>/acp</code>——面板底部有当前会话的直达链接。",
|
||
"fa.panel.q": "打不开面板怎么办?",
|
||
"fa.panel.a": "先确认守护进程在跑(<code>bili doctor</code>)、端口没被改(独立守护进程默认 8787;启动器 lane 从 18787 起)。面板只绑定 <code>127.0.0.1</code>——在别的机器或手机上看需要 SSH 端口转发,或显式设置 ACP_HOST。",
|
||
"d.toc_ref": "参数全参考",
|
||
"d.qs.next": "下一步:下面的 Web 面板——配置、会话统计、实时日志都在这里。",
|
||
"d.ref.intro": "全部参数事无巨细。与仓库里 CONFIGURATION.md 由同一份种子生成(CI 防漂移),网站和仓库文档永远是同一份。",
|
||
"d.cf.panel_cta": "配置尽量在面板里做:<a href=\"http://127.0.0.1:8787/__bili/#/config\">配置页</a>(启动器代理的实例在 <a href=\"http://127.0.0.1:18787/__bili/#/config\">这里</a>)会校验每一处修改、提供快捷控件,并直接写回这个文件——设置了环境变量时环境变量优先。",
|
||
"fa.cache.q": "怎么查缓存命中率?",
|
||
"fa.cache.a": "别翻日志——在客户端输入 <code>/acp-cache</code>:终端直接打印摘要报告,开头带 Web UI 链接(会话页另有命中率曲线和逐段归因)。经验值:健康会话命中率在 <strong>95–97%</strong>;压缩本身开销 ≤2%。低了按顺序查:① 上游缓存 TTL 过期,② 会话中途换模型(整个稳定前缀重新计费),③ bili 的 bug——把页面截图提 issue。<code>/acp-cache full</code> 列出每条折块与明细行;HTTP 等价:<code>GET /__bili/cache-report</code>。",
|
||
"fa.acp.q": "/acp 显示什么?",
|
||
"fa.acp.a": "在带原生插件的客户端(opencode、dsh)里,<code>/acp</code> 直接从代理渲染当前会话的 ACP 状态面板——会话、块、可折叠区、用量;首个模型请求之前显示空闲提示。<code>/acp-cache [full]</code> 打印上面的缓存报告。",
|
||
"fa.webq.q": "能在网页上查会话和配置吗?",
|
||
"fa.webq.a": "可以——打开 <a href=\"http://localhost:8787\">http://localhost:8787</a>:总览面板、会话列表与单会话详情、实时日志、配置编辑器、上游连通性测试。一切同时也是纯 JSON 接口(<code>/__bili/stats</code>、<code>/__bili/sessions</code>、<code>/__bili/config</code> …),方便脚本使用。",
|
||
"fa.when.q": "压缩什么时候发生?",
|
||
"fa.when.a": "由模型驱动:注入的上下文工具由模型在上下文增长时调用,沿途有增长提醒(设计上约每 50K token 一步,可用 <code>compress.nudgeGrowthTokens</code> 调整),单条输入就超窗口时 preflight 兜底硬触发。用 <code>/acp</code> 或 Web 面板实时观察。",
|
||
"fa.fc.q": "为什么第一次压缩要等到 ~200k?",
|
||
"fa.fc.a": "压缩按增长间隔触发,不按窗口绝对位置:默认首次软压缩发生在启动内容之外再长 50k token 时(<code>compress.nudgeGrowthTokens</code>,固定值、与窗口大小无关)——启动内容若已有 ~100k,可能要等到 ~200k。想提前:精简系统提示词 / 关掉不用的工具 / 清理 skills,把 <code>compress.nudgeGrowthTokens</code> 降到 ~50k,或开 lean 模式。",
|
||
"fa.transp.q": "bili 是透明的吗?怎么关?",
|
||
"fa.transp.a": "无法识别的端点原样转发,每种接法都能干净退出:原生插件用 <code>bili plugin remove <client></code>;其余两种停掉启动器命令 / 环境变量 / <code>/bili/</code> 前缀即可——流量立刻恢复直连。各客户端细节见 <a href=\"https://github.com/ranxianglei/billion-context/blob/master/CLIENTS.md\">CLIENTS.md</a>。",
|
||
"fa.paths.q": "日志和会话数据存在哪?",
|
||
"fa.paths.a": "日志:<code>~/.local/state/billion-context/bili.log</code>(同时镜像到 stderr);会话状态:<code>~/.local/share/billion-context/</code>(XDG 变量可覆盖)。完整路径见仓库内 <a href=\"https://github.com/ranxianglei/billion-context/blob/master/CONFIGURATION.md\">CONFIGURATION.md</a>。",
|
||
"doc.page_title": "billion-context · 文档",
|
||
"d.h1": "使用文档",
|
||
"d.sub": "本地运行 billion-context 并接入客户端所需的全部内容。更详尽的参考在仓库里:CONFIGURATION.md、TECHNICAL-NOTES.md、PLUGIN.md、SESSION-IDENTITY.md。",
|
||
"d.toc_qs": "快速开始",
|
||
"d.toc_connect": "接入客户端",
|
||
"d.toc_commands": "常用命令",
|
||
"d.toc_config": "配置",
|
||
"d.toc_how": "压缩原理",
|
||
"d.toc_webui": "Web 面板",
|
||
"d.toc_privacy": "隐私安全",
|
||
"d.toc_faq": "常见问题",
|
||
"d.toc_links": "资源链接",
|
||
"d.qs.p": "一个 npm 包,需要 Node 22+。装好之后启动本地压缩代理:",
|
||
"d.qs.p2": "一切只绑定回环地址,不对外暴露。每个实例都在自己的地址上提供同一套内置仪表盘:",
|
||
"d.cn.p": "把代理放进你的 Agent 与模型之间,有三种方式——任选适合你客户端的:",
|
||
"d.cn.m1": "把轻量插件直接装进客户端(原文件自动备份一次),集成最深、会话内提供原生工具。覆盖 pi · omp · claude · codex · opencode · dsh · kimi · hermes · zcode:",
|
||
"d.cn.m2": "零配置改动:包住任意 CLI agent,自动注入代理与压缩状态;每次启动都是一次性的独立代理实例:",
|
||
"d.cn.m3": "支持自定义端点的客户端开箱即用:把它的 base URL 指向前缀地址,原上游地址作为尾部保留:",
|
||
"d.cn.table_note": "各客户端接入细节:",
|
||
"d.th_client": "客户端",
|
||
"d.th_method": "方式",
|
||
"d.th_mech": "关键机制",
|
||
"d.cn.mitm": "对写死 HTTPS 上游的客户端自动签发证书:客户端访问到的域名首次发现即自动加入白名单。需要其它主机?显式指定:",
|
||
"cmd.daemon": "单独启动代理守护进程(默认端口 8787)。",
|
||
"cmd.launch": "临时拉起一个代理并用它启动指定客户端——不改任何配置。",
|
||
"cmd.plugin": "管理各客户端插件及其更新通道。",
|
||
"cmd.test": "不污染真实配置的代理冒烟测试。",
|
||
"cmd.export": "列出会话,或导出某个会话为 Markdown 交接文档(--full 还原原始消息)。",
|
||
"cmd.doctor": "审计所有安装通道:版本、归属、运行中的代理进程(只读)。",
|
||
"cmd.update": "立即检查并安装新版本。",
|
||
"cmd.acp": "Agent 内的实时上下文面板——附带该会话的 Web 面板链接。",
|
||
"cmd.acpcache": "本会话的 token 经济学报告:新增内容 vs 缓存命中 vs 压缩复付。",
|
||
"d.cf.p": "全部配置在这一个 JSON 文件里,首次运行自动生成,编辑后热加载生效:",
|
||
"d.cf.env": "环境变量优先于配置文件——优先级:环境变量 > 文件 > 内置默认;且变量一旦设置就由它说了算(即使取值看起来不合法)。常用项:",
|
||
"d.how.p": "首页四个机制的简版:",
|
||
"d.how.paper": "完整论述与全部数据见论文:<a href=\"https://github.com/ranxianglei/billion-context/blob/master/paper/model-driven-incremental-hierarchical-compression-training-free-multi-generational-context-management-for-long-lived-coding-agents.md\" target=\"_blank\" rel=\"noopener\">阅读预印本</a>。",
|
||
"d.wu.p": "每个运行中的实例都在 <code>/__bili/</code> 提供内置仪表盘:",
|
||
"d.wu.ov": "总览 —— 会话与请求总数、累计节省与净节省、全局命中率及未命中分解、协议分布。",
|
||
"d.wu.se": "会话 —— 用量统计、上下文轨迹图、缓存经济学(含折叠明细)、压缩块与会话交接文档(可复制/下载)。",
|
||
"d.wu.cf": "配置 —— 查看并编辑 JSON 配置,保存即时生效。",
|
||
"d.wu.cn": "接入 —— 针对当前实例端口的接线指引,命令可直接复制。",
|
||
"d.wu.lo": "日志 —— 守护进程日志实时尾部,可按会话 id 或关键字过滤,支持下载纯文本。",
|
||
"d.pr.p1": "billion-context 只运行在你自己的机器上,默认绑定回环地址。它只是转发模型流量——OAuth token 原样透传,不上传任何数据。",
|
||
"d.pr.p2": "会话记录保存在本地(<code>~/.local/share/billion-context/sessions</code>),日志在 state 目录旁。用 <code>bili export</code> 随时导出,文件想删就删。",
|
||
"fa.node.q": "需要什么 Node 版本?",
|
||
"fa.node.a": "Node 22 或更新版本(npm 包的要求)。",
|
||
"fa.win.q": "Windows 上能用吗?",
|
||
"fa.win.a": "推荐在 WSL2 中运行。WSL 内一切照常用 127.0.0.1;Windows 侧客户端可改用 WSL 主机 IP 访问代理,或干脆把客户端也跑在 WSL 里。",
|
||
"fa.cost.q": "代理本身要付费吗?",
|
||
"fa.cost.a": "不要——免费开源(MIT 加一条署名条款)。token 节省来自更小的上下文和你所在服务商的提示词缓存;经济学面板展示每个会话的真实数字。",
|
||
"fa.up.q": "怎么升级?",
|
||
"fa.up.a": "运行 <code>bili update</code>(或重新 npm 安装);升级前后用 <code>bili doctor</code> 审计各安装通道。",
|
||
"paper.kicker": "方法完全公开可审",
|
||
"paper.t": "Model-driven incremental hierarchical compression:免训练的多代际上下文管理,面向长生命周期编码代理",
|
||
"paper.b": "产品背后的方法已随仓库以 MIT 协议开源,并以活文档形式持续更新。4.5 个月的生产实测横跨三台主机:174,327 次模型调用、187.6 亿累计输入 token、零窗口越界。",
|
||
"paper.cta": "阅读论文(英文)",
|
||
"foot.note": "MIT 许可加一条署名条款:基于它的产品需公开说明出处。完全开源构建;只在你自己的机器上运行。"
|
||
}
|
||
};
|
||
|
||
var KEY = "bc-lang";
|
||
|
||
function initLang() {
|
||
var h = location.hash.slice(1);
|
||
var s = new URLSearchParams(location.search);
|
||
var l = s.get("lang") || (h === "zh" || h === "en" ? h : null);
|
||
if (l) { try { localStorage.setItem(KEY, l); } catch (e) {}
|
||
history.replaceState(null, "", location.pathname); }
|
||
try {
|
||
var saved = localStorage.getItem(KEY);
|
||
if (saved === "zh" || saved === "en") return saved;
|
||
var nav = (navigator.languages && navigator.languages[0]) || navigator.language || "";
|
||
return nav.indexOf("zh") === 0 ? "zh" : "en";
|
||
} catch (e) { return "en"; }
|
||
}
|
||
|
||
function apply(lang) {
|
||
var dict = I18N[lang] || I18N.en;
|
||
document.documentElement.lang = lang === "zh" ? "zh-CN" : "en";
|
||
document.querySelectorAll("[data-i18n]").forEach(function (el) {
|
||
var k = el.getAttribute("data-i18n");
|
||
if (dict[k] != null) el.textContent = dict[k];
|
||
});
|
||
document.querySelectorAll("[data-i18n-html]").forEach(function (el) {
|
||
var k = el.getAttribute("data-i18n-html");
|
||
if (dict[k] != null) el.innerHTML = dict[k];
|
||
});
|
||
document.title = dict["doc.title"];
|
||
var desc = document.querySelector('meta[name="description"]');
|
||
if (desc) desc.setAttribute("content", lang === "zh" ? "billion-context:AI 编码代理的上下文压缩代理 —— 小窗口足够用,token 最高省 5 倍,月级单会话,每个 token 都有账可查。" : "billion-context is a context-compression proxy for AI coding agents: small context windows are enough, 5x fewer tokens, month-long single sessions, and a token-level ledger for every request.");
|
||
var btn = document.getElementById("lang-toggle");
|
||
if (btn) btn.textContent = lang === "zh" ? "English" : "中文";
|
||
}
|
||
|
||
apply(initLang());
|
||
window.addEventListener("hashchange", function () {
|
||
var h = location.hash.slice(1);
|
||
if (h === "zh" || h === "en") apply(h);
|
||
});
|
||
|
||
var toggle = document.getElementById("lang-toggle");
|
||
if (toggle) toggle.addEventListener("click", function () {
|
||
var next = document.documentElement.lang.indexOf("zh") === 0 ? "en" : "zh";
|
||
try { localStorage.setItem(KEY, next); } catch (e) {}
|
||
apply(next);
|
||
});
|
||
|
||
/* copy buttons */
|
||
function doCopy(text, btn, done) {
|
||
var fallback = function () {
|
||
var ta = document.createElement("textarea");
|
||
ta.value = text;
|
||
ta.style.position = "fixed";
|
||
ta.style.opacity = "0";
|
||
document.body.appendChild(ta);
|
||
ta.select();
|
||
try { document.execCommand("copy"); done(); } catch (e) {}
|
||
document.body.removeChild(ta);
|
||
};
|
||
if (navigator.clipboard && navigator.clipboard.writeText) {
|
||
navigator.clipboard.writeText(text).then(done, fallback);
|
||
} else fallback();
|
||
}
|
||
document.addEventListener("click", function (ev) {
|
||
var btn = ev.target.closest(".copy-btn");
|
||
if (!btn) return;
|
||
var text = btn.getAttribute("data-copy") || "";
|
||
var label = btn.textContent;
|
||
doCopy(text, btn, function () {
|
||
btn.textContent = I18N[document.documentElement.lang.indexOf("zh") === 0 ? "zh" : "en"]["common.copied"];
|
||
setTimeout(function () { btn.textContent = label; }, 1600);
|
||
});
|
||
});
|
||
|
||
/* scroll reveal */
|
||
var nodes = document.querySelectorAll("[data-reveal]");
|
||
if ("IntersectionObserver" in window) {
|
||
nodes.forEach(function (n) {
|
||
var d = n.getAttribute("data-delay");
|
||
if (d) n.style.setProperty("--rd", d + "ms");
|
||
});
|
||
var io = new IntersectionObserver(function (entries) {
|
||
entries.forEach(function (e) {
|
||
if (e.isIntersecting) { e.target.classList.add("in"); io.unobserve(e.target); }
|
||
});
|
||
}, { threshold: 0.12 });
|
||
nodes.forEach(function (n) { io.observe(n); });
|
||
} else {
|
||
nodes.forEach(function (n) { n.classList.add("in"); });
|
||
}
|
||
// fail-safe: never leave content hidden (IO quirks / headless / print)
|
||
setTimeout(function () { nodes.forEach(function (n) { n.classList.add("in"); }); }, 1600);
|
||
})();
|