91 Commits
Author SHA1 Message Date
ranxianglei df266780c1 config surface: seed compress.degenerateRetry in website/config-reference, regenerate docs
Fixes config-surface-guard + docs-sync CI failures: the docs index tables
are generated from website/config-reference/*.yaml (tools/gen-config-docs.mjs
generate), not hand-edited. Adds the compress.degenerateRetry object entry
(co.degenerateRetry) plus the two leaf seeds (maxAttempts, nudges) with
en/zh/ja descriptions, and regenerates all generated artifacts (docs tables
in all three languages, website nav).
2026-11-24 23:08:20 +08:00
ranxianglei 8c86a0e809 [PR] feat(compress): protect host-marked current-task prompts from folding
Opt-in compress.protectedUserPatterns (literal substring protection for host-marked current-task prompts against folding); default off, byte-identical when unconfigured; includes the plugin tool path restore fix.

Co-authored-by: 赵瑞哲 <229347043+zhaoruizhe81@users.noreply.github.com>
Source-PR: #7559
(cherry picked from commit 0380d0c11a31dc3203e9abd82ab79aecec1045b6)
(cherry picked from commit c1177b7771065f80dc06fb0efc03d425ecfd4e2f)
2026-11-24 22:05:59 +08:00
ework-agent 0fc364a1f3 Merge remote-tracking branch 'origin/master' into 2026-11-15_msgid-snapshot-unified 2026-11-22 10:57:01 +08:00
ranxianglei 99ff869fdd docs: regenerate config docs for the 429 governor default flip
gen-config-docs generate: throttle429Enabled default true -> false in the
generated tables + website artifacts (seed wording updated for the
#6639/#5853 passthrough posture).
2026-11-21 23:10:09 +08:00
ework-agent 1f4bd580be docs: seed the sessions/plugin/snapshot config surface + egress-lane-io file map
The PR's snapshot-plane commits added config fields (sessions.*, plugin.snapshotCapBytes, snapshot.shadow) and src/server/egress-lane-io.ts without doc seeds, so three CI gates went red on head 02fc8f4c2:

- config-surface-guard: 11 leaf fields lacked website/config-reference seed entries
- docs-coverage: 11 env vars + 2 top-level keys (sessions, plugin) undocumented (BILI_SESSION_CONTENT_STORE_PIN is env-only)
- architecture-docs: reference/architecture.md missing src/server/egress-lane-io.ts

Added the seeds (process.yaml: sessions block + 9 leaves; server.yaml: plugin.snapshotCapBytes + snapshot.shadow; env-only.yaml: BILI_SESSION_CONTENT_STORE_PIN), the file-map line, and the regenerated docs/configuration.{md,zh-CN.md,ja.md} + website artifacts.

Verified locally: all three gates green, generate idempotent, typecheck clean.

PR #6785 CI fix.
2026-11-21 17:20:04 +08:00
ranxianglei bc51c94453 refactor(egress): retire the fold-journal / egress-snapshot / scope-rev plane (7439 ruling)
Every v12 table that never entered master is deleted except the ones the
ruling keeps (l1_world, orphan_blocks, state_fields, egress_state,
egress_flow). The #5874 v2 snapshot-base plane (fold_journal +
egress_snapshot + egress_scope_rev) shipped no behavior yet — its D-lane
byte cache was bypassed on the plugin lane and its sole write consumer
was this PR — so it is removed wholesale:

- schema.ts: three DDL consts + all probes (incl. the covered_ids /
  ids_json DROP-column and scope_rev ADD-column migrations); v12 keeps
  l1_world / orphan_blocks / state_fields / egress_state+flow
  (probe-first, unchanged).
- snap.ts: fold-journal + egress-snapshot functions deleted; the L1
  world / R3 latch functions (stage-0 identity + pf pin) are kept.
- store.ts / shadow.ts / persist.ts: egressCut / egressReadView /
  appendFoldJournal / appendEgressSnapshot / bumpEgressScopeRev and all
  seven per-write rev-bump sites gone; delete/archive cascades trimmed.
- snapshot-render.ts: the splice (warm serve) and cut blocks gone — the
  D-lane reverts to live derive, pre-#5874 behavior.
- config surface: storage.snapBase (enabled/cohorts/cutEveryKUserTurns)
  removed from config.ts, knobs.ts, process.yaml + regenerated docs —
  the plane never shipped, so there is no compat story to keep.
- tests: the three plane-only suites retired; 111/111 battery +
  108/108 lane suites green, typecheck clean.

The byte-level prefix-cache gain the plane would have given is superseded
by the self-contained egress op-log, which serves the FULL rendered view
from the flow tables on every lane.
2026-11-21 15:54:55 +08:00
ework-agent d401a28ea7 fix: make the compress receipt's 'fold more' recommendation opt-in (default off)
⚠️ MODEL-FACING TEXT CHANGE — the success compress receipt changes what the
model reads: with the new default (compress.postComPressTail off, the
pre-existing behavior is NOT the default), the receipt no longer re-advises
the remaining foldable ranges after every successful fold, and no longer
emits the 'Uncovered history remains' audit note. With it on (explicit opt-in),
the range list is restored and the uncovered note fires at most once per
nudge-injection cycle (fresh injection re-opens it). The verbatim
context-minimum stop signal is unchanged in both modes.

Consumption-chain reasoning (#6855 discipline): the removed text carried the
only forward-pointing refs the model propagated into its NEXT compress call
(startId/endId copied from the 'Current compressible ranges' list). Removing
it removes the propagation anchor entirely — no phantom-value class possible.
Nothing else in the receipt is altered byte-wise; the stop-signal sentence
(#1387) is preserved verbatim, so models that key on it see identical text.
The per-turn growth nudge (KDD #8) is a separate channel and untouched.

Why: per-receipt re-recommendation drove models into endless fold loops
against explicit user stop requests (#7318: 200+ folds in one night on a
0.1.216 build; #6522 '不要连续推荐' and #5872 are the same family — the
receipt footer drives single-message retry folds). Each fold rewrites the
context prefix and re-bills the prompt cache.

config surface (#1437 discipline, owner decision in-thread 2026-11-20):
adds compress.postComPressTail (boolean, default off) to the existing three-
level compress hierarchy (global/provider/model via mergeCompress); boolean
only (non-boolean rejects the whole block like the sibling requireNudge /
requireRecommendation); no new env var (knob goes through the existing
compress file hierarchy, env-discipline #2030). Docs: config-reference seed
entry + regenerated configuration.md en/zh/ja + website.

Plumbing: the flag is stamped per round on session.transient next to the
existing nudge gate (src/unprompted-gate.ts) and read at the tail decision
point in src/stream.ts — off by default when a session has no stamp
(defensive: never recommend on an unknown posture). The #6522 at-most-once
latch rides on an in-memory Session field (uncoveredReceiptNoted), re-opened
only by an actual nudge injection.

Fixes #7318 (design: default off); implements #6526's at-most-once note (that
PR is superseded — its change was unconditional, this one is gated).
Supersedes: https://github.com/ranxianglei/billion-context/pull/6526
2026-11-20 23:07:03 +08:00
ework-agent 3ea2ba186a compress.reasoning.tail: also drop reasoning of any closed round in the protected window
(#7144 follow-up) The #651 pass drops oversized reasoning attached to closed
compress turns only. With tail:true (default off) it extends to ANY closed
round — a tool call whose result arrived with at least one message after it,
or an assistant text turn that is no longer the view's last message. Those
rounds leave the protected window at the next fold anyway, so dropping early
reclaims the tokens now; the in-flight round is never touched.

Strict-echo upstreams are unaffected: #762/#2169 blank-echo normalization
runs after the drop, and planReasoningDrop still disables the whole pass
there. Config knob compress.reasoning.tail (three-level field-wise merge),
docs + website reference regenerated.
2026-11-19 11:42:52 +08:00
ework-agent efa3df7857 chore: merge master ahead of the #5765 blockOps gate (kernel 0.0.195)
Conflicts: kernel version files (master 0.0.193 from the #6132 fold-point
removal + this branch's 0.0.194 -> 0.0.195) and one relay.ts import line
(master dropped relocateCompressCarriers; this branch adds
buildBlockOpsSystemPrompt — the resolved import carries only the latter;
no fold-point call sites survive in the merged relay).

Re-verified on the merged tree: kernel 1631/1631, host targeted 201/201 +
surface/config 374/374, typecheck + build green.
2026-11-11 11:17:42 +08:00
ework-agent 6b33fd21a9 feat: gate the #5765 block-lifecycle tools behind compress.blockOps (default off)
Owner ruling (review of this PR): acp_retire / acp_restore / acp_rewrite
must sit behind ONE switch, default OFF, injected only when ON — the
always-on surface costs ~0.7k estimated tokens per request on every
session of an enabled proxy.

Follows the absorb opt-in pattern end to end:
- kernel: definitions + name consts stay exported, but the 3 tools leave
  the default arrays (ACP_TOOLS_{OPENAI,ANTHROPIC,RESPONSES,GOOGLE},
  ACP_READONLY_TOOLS_RESPONSES, ACP_TOOL_NAMES); they stay in
  ACP_MUTATING_TOOLS (dispatch must drive the compress loop when enabled).
  New BLOCK_OP_TOOL_NAMES set + buildBlockOpsSystemPrompt(lane) section
  builder; the default prompts are back to "four context-management
  tools". New Config.blockOps { enabled } (off by default); absorb/ccr
  tool-name predicates include the block ops.
- host: compress.blockOps config (3-level merge like absorb);
  blockOpsEnabled / effectiveBlockOpsConfig / storeEffectiveBlockOps
  (per-session, plugin tool API parity); isProxyToolFor, the proxy-lane
  inject* extras, the responses hybrid lane, the round-2 cache seam, the
  plugin manifest + tool API, the MCP dialect note and the system prompt
  all inject/advertise the 3 only while enabled; the MCP note, prompt
  and per-session metadata stay byte-identical to pre-#5765 while off
  (zero footprint: no metadata key written while off — the storage-render
  goldens match master byte-for-byte).
- dispatch: enabled calls run the kernel ops exactly as before; a stray
  call while disabled gets a model-facing "not enabled on this bili proxy
  (compress.blockOps.enabled is not true)" receipt and never touches state.
- wire-contract goldens revert to the master shapes (the default surface
  is unchanged), and this commit supersedes the three earlier fix commits
  on this branch (test-pin updates + storage-render regen + payload
  retunes): with the default surface back to the master shape, those
  test files return to the master versions and the 27 red CI tests are
  green again without any calibration changes.
- docs: compress.blockOps in configuration.md/.zh-CN.md + website seed;
  kernel 0.0.194.

Verified: kernel 1656/1656; host targeted 201/201 (the 15 previously
red CI files + block-ops/snapshot/wire-contract), 348/348 + 63/63
surface/config invariant files; typecheck + build green.
2026-11-11 11:12:54 +08:00
ework-agent e2e05d1b6e remove compressAtFoldPoint from host, web, docs and site (#6132)
Companion to the kernel removal: strip the experimental fold-point
relocation feature (v1 #5471 + unreleased v2 #5949) from everything else.

- env knobs BILI_COMPRESS_AT_FOLD_POINT(_CLEAR_THINKING) + resolvers
  (knobs.ts), file keys compress.compressAtFoldPoint(_ClearThinking)
  (config.ts: CompressSettings fields, COMPRESS_SETTING_FIELDS, parser
  loop), compress-settings.ts cascade/pass-through/reachability,
  relay.ts round-2 mirror + drop-predicate install, the four prepare*
  install sites, plugin-render.ts S4 mirror, makeFoldPointReasoningDroppable
  (server.ts), the v2 already-folded-echo ack in stream.ts
- stale configs: one-shot INERT deprecation warning extended to the two
  removed keys (every level incl. top-level), values ignored
- web config row + i18n strings (en/zh), config-reference yaml, site docs,
  site i18n strings, blog post + article entries deleted (owner instruction)
- docs configuration en/zh + lifecycle ledger (rows removed, §5 note),
  CHANGELOG entry
- tests: delete tests/compress-at-fold-point.test.ts, drop the echo test
  from compress-reject-reasons.test.ts, extend removed-compress-keys-inert
  with the removed fold-point keys

Closes #6132
2026-11-10 23:47:46 +08:00
ranxianglei 2a9ebe871e Merge pull request #5903 from ranxianglei/2026-11-08_batch-summary-floor
[PR] fix: judge summary floor at batch level for multi-range compressions; expose minSummaryLength in panel
2026-11-10 21:25:27 +08:00
ranxianglei e1e33a974c Merge pull request #6032 from suyeku1/2026-11-09_merge-master-into-1444
[PR] Rebase #1444 onto master: declarable model endpoints + commandcode wire family
2026-11-10 21:17:52 +08:00
ci-check 52d287add1 Merge branch 'master' into 2026-11-08_batch-summary-floor
Resolve conflicts after master advanced (PR #5903):
- acp-kernel version -> 0.0.192 (master 0.0.191 + 1 for this PR's kernel/src change); synced kernel/package.json, root package-lock.json, kernel/package-lock.json
- CONFIGURATION.md/.zh-CN.md are redirect stubs now (docs moved to docs/ on master); regenerated docs/configuration*.md so compress.minSummaryLength carries the batch-total wording (#5894)
2026-11-10 16:24:51 +08:00
ci-check b326380431 Merge remote-tracking branch 'origin/master' into pr6066-cifx 2026-11-10 09:44:07 +08:00
ci-check b74bcc6682 Merge remote-tracking branch 'origin/master' into pr6066-cifx
# Conflicts:
#	src/affinity-persist.ts
#	src/order-persist.ts
2026-11-10 09:43:37 +08:00
ranxianglei 658499ae19 Merge pull request #5945 from ranxianglei/2026-11-08_nudge-credit-window
[PR] fix(#5943): requireNudge judges a nudge credit window, not this-round arm
2026-11-10 09:41:30 +08:00
ci-check 9914dcae91 Merge origin/master into PR #6032 head — resolve handle.ts import split (logRequestCost → request-cost.js; keep declPinConflictWarned) 2026-11-10 09:32:20 +08:00
ci-check 73f222e54c feat: user-registerable egress request-body rewrite pipeline (#6003)
Add a config-declared egressTransforms[] pipeline that runs user ESM plugins
on every outbound model-request body after all session processing (shed /
compress-loop rewrites) and before transport (re-sign / v1Wrap / fetch), so
body-covering signatures always cover the final shipped bytes. Covers the
relay main send + every recovery re-send and the compress-loop lane; each
plugin is fail-open; hot-reloadable without restart.

- src/egress-transforms.ts: entry parsing, mtime-busted module cache,
  fail-open runner (per-plugin timeout, illegal-output skip, content-length
  drop on byte change), urlPrefix/provider match
- config.ts: top-level egressTransforms (file-only) + KNOWN_TOP_LEVEL_KEYS
- admin.ts: POST /__bili/config/reload re-reads entries + resets module cache
- relay.ts: pipeline before applyResign on the main send; finalizeEgress now
  async and applies the pipeline to all recovery re-sends; the thinking-strip
  resend routes through finalizeEgress (completes the unified egress path)
- loop/core.ts + compress-loop-{responses,anthropic}.ts: an egress option on
  RequestOptions, applied between shed and resign
- docs/configuration.md en+zh + website config-reference seed
2026-11-10 03:27:39 +08:00
ci-check 14a6d860e5 docs: regenerate config docs from seed for persist.maxDelayMs (docs-sync drift) 2026-11-10 02:50:57 +08:00
ci-check 0f502f46a7 Merge remote-tracking branch 'origin/master' into 2026-09-26_model-endpoint-patterns 2026-11-09 21:54:33 +08:00
ci-check ea2b895047 ci(#5947): sync requireNudge seed wording with credit-window change; un-export internal gate types
- website/config-reference/compress.yaml: desc_en/desc_zh/site_en/site_zh for
  compress.requireNudge now describe the 20-model-round nudge credit window
  (#5943) instead of the retired current-turn arm — the PR hand-edited the
  generated docs/configuration.{md,zh-CN.md} without updating the single
  source of truth, which is what the #2107 docs-sync drift guard caught.
  Regenerated website/main.js + website/docs/index.html from the updated seed.
- src/unprompted-gate.ts: UnpromptedGate / UnpromptedGateStamp are referenced
  only inside unprompted-gate.ts — drop the leading export per the unused-exports
  gate (#1440 P6); UnpromptedGateState stays exported (imported by session.ts).
2026-11-09 10:08:53 +08:00
ework-agent 2078758674 Merge remote-tracking branch 'origin/master' into fix/issue5904-first-byte-budget
# Conflicts:
#	CONFIGURATION.md
#	CONFIGURATION.zh-CN.md
#	LIFECYCLE.md
2026-11-08 16:47:11 +08:00
ranxianglei 05bb1dc948 docs: centralize 14 root docs under docs/ with hub index + redirect stubs (owner request 2026-11-08) 2026-11-08 13:33:45 +08:00
ranxianglei 3e063eb7fe docs(website): add missing bili sessions / storage gc command rows (PR #4565, closes #4562) 2026-11-08 11:31:54 +08:00
ework-agent b4a4026482 docs(#5904): regenerate config artifacts for upstreamFirstByteMs + ledger entry
docs-sync and lifecycle-ledger-guard reds on #5917: the new
network.upstreamFirstByteMs / BILI_UPSTREAM_FIRST_BYTE_MS knob needs its
generated artifacts (CONFIGURATION tables, website i18n tt.network summary)
regenerated via tools/gen-config-docs.mjs, and the env var registered in
LIFECYCLE.md §2.3 (permanent network-tuning family, default = full idle
budget, release gate sets 120000).
2026-11-08 11:13:44 +08:00
ci-check 8173fd4cf6 Merge origin/master into fix/review-batch-5898 (#5905)
Resolve the single textual conflict in src/storage/store.ts, where both
sides independently replaced the O(B^2) Array.some() stale-block sweep
with an O(1) Set lookup (master via #5744, this branch via #5755).
Kept master's incomingBlockIds form: behaviorally byte-identical, already
shipped and reviewed on master, so the merged hunk matches what v0.1.213
already carries. All other files auto-merged cleanly.
2026-11-08 10:06:15 +08:00
ci-check 3d2b5b47df docs: state last-resort fallback semantics for top-level modelContextLimit / ACP_MODEL_CONTEXT_LIMIT (#5908) 2026-11-08 03:07:08 +08:00
ci-check 2829344bdc fix(docs): sync config-reference seed with batch-total minSummaryLength semantics (#5894)
The PR updated the generated CONFIGURATION.md table rows directly but left
website/config-reference/compress.yaml at the old per-range wording, so the
CI docs-sync job (generate + git diff --exit-code) reverts the rows and goes
red. Update desc_en/desc_zh/site_en/site_zh in the seed and regenerate.
2026-11-08 02:10:32 +08:00
ework-agent 81619f3dfe fix: #5898 review batch — 429-hold saturation warn + scope-value guard, media-refs carry-forward filter & cloud prefix families, oversize refusal messages that name the real fix, dsh durable lines with readable numbers, website streamKeepAliveMs typo, 5755 ord-crossing guard kept with regression tests
- upstream-throttle: a saturated hold map (64/64 account-wide, no model-scoped
  hold to evict) silently dropped the next model-scoped 429 — now it warns
  once and the send is documented as ungoverned (#5199/#5889)
- knobs: network.throttle429Scope matches its value EXACTLY; a typo now warns
  once and falls back to credential instead of silently doing so (#5199)
- kernel media-refs: block summaries written by older builds can carry refs
  looksEphemeralSignedUrl would reject today; the carry-forward into merged
  blocks now applies the same filter so a dead signed URL cannot survive
  forever (#5865 review). EPHEMERAL_QUERY_PARAM also gains the Huawei OBS
  x-obs-*, Tencent COS x-cos-* and Baidu BCE x-bce-* prefix families.
- native-intercept/dsh-native oversize refusals now say what to DO (restart
  host / fix the model window declaration), and dsh durable lines format
  numbers with thousands separators (#2924/#4068)
- website: streamKeepaliveMs → streamKeepAliveMs (the real knob name) across
  main.js, docs/index.html, config-reference/process.yaml
- CONFIGURATION.md/.zh-CN.md: throttle429Scope exact-match + model-string
  aliasing caveat documented
- store/persist: #5755 refs ord-crossing guard (touching rows stay in the
  old-refs set until the new-refs commit lands) kept as defense-in-depth
  with a regression test

kernel-change: 0.0.186 → 0.0.187 (media-refs carry-forward filter + cloud
prefix families; compress.ts starvation-bound comment corrected)
2026-11-08 01:28:42 +08:00
ranxianglei 6945a354d4 Merge pull request #5889 from ranxianglei/2026-11-07_throttle429-scope-knob
[PR] fix(#5199): network.throttle429Scope — model-scoped 429 holds for marker-less gateway bodies
2026-11-07 22:35:55 +08:00
ranxianglei eb8bd3ccb1 fix(#5199): network.throttle429Scope — model-scoped holds for marker-less gateway 429s
Implements #5853 decision 1 option A (recommended); decision 2 unchanged
(streak-1 arming kept). Default "credential" preserves #5696 semantics —
zero behavior change without opt-in.

- knobs: BILI_THROTTLE_429_SCOPE > network.throttle429Scope > "credential",
  read per settlement (hot flip)
- upstream-throttle: throttle429ModelScope() — recognized KeyRing/bili-relay
  markers win as before; scope=model settles marker-less 429s (RPM/quota
  text, opaque relay rewrites) on the request model; model-less sends stay
  credential-wide
- relay/loop/degenerate-retry lanes settle through the wrapper
- docs: CONFIGURATION en/zh + website seed regenerated, LIFECYCLE env row
- tests: tests/issue5199-throttle429-scope.test.ts (6 rows, both directions)
2026-11-07 21:18:51 +08:00
ranxianglei bd1c732298 docs: regenerate config doc artifacts for maxEstimateHoldRounds (gen-config-docs) 2026-11-07 19:39:33 +08:00
ework-agent 521de31f4c docs: regenerate config docs from seed (gen-config-docs drift — docs-sync) 2026-11-07 15:42:51 +08:00
ci-check bbe8ceaa49 docs: seed config-reference yaml for the #5683 policy gates and regenerate artifacts (agent review fix, PR #5685)
The feature hand-edited the generated param-ref block in CONFIGURATION.md /
CONFIGURATION.zh-CN.md without touching the declared single source of truth
(website/config-reference/compress.yaml, #2107), which reds two CI jobs:
docs-sync (regenerate-then-diff over CONFIGURATION*.md, website/main.js,
website/docs/index.html) and config-surface-guard (#2643: every nested leaf
field needs a seed key entry). Add the two seed entries with desc text
identical to the merged table rows — regeneration now reproduces the
committed md byte-for-byte (verified: zero drift) — plus the website
main.js site-dict keys and docs table rows the generator owns.
2026-11-04 23:57:38 +08:00
awork 27b262d94d Merge remote-tracking branch 'origin/master' into pr5453-review-fixups
# Conflicts:
#	CONFIGURATION.md
#	CONFIGURATION.zh-CN.md
2026-11-03 22:38:19 +08:00
ranxianglei aeeb430f77 fix(compress): keep fold-point switches opt-in (default off); close env-only opt-in reachability gap (#5470) 2026-11-01 23:34:11 +08:00
ranxianglei 4f91175bdf feat(compress): promote compressAtFoldPoint to default-on (#5470)
Real-model verification (pi lane, qwen3.8-27b via sglang): the relocated
pair sits at [folded region]-[pair]-[protected messages] in the round-2
re-request and stays pinned there across steady turns; thinking untouched
(switch B still off). Flips resolver/config-doc/LIFECYCLE defaults and
closes the resolveRequestConfig short-circuit hole so the ON default and
an explicit env=off both reach lanes with zero configured compress
settings.
2026-11-01 23:23:02 +08:00
ranxianglei 38b1f71e2e docs: regenerate config-doc artifacts for #5470 fold-point switches (docs-sync gate) 2026-11-01 22:46:27 +08:00
pr 3578597f47 fix: sync personaSplit docs + LIFECYCLE ledger
Commit generated CONFIGURATION / website rows for personaSplit and
register BILI_PERSONA_SPLIT in LIFECYCLE.md §1 next to BILI_SUBAGENT_SPLIT
so docs-sync and lifecycle-ledger-guard pass.
2026-11-01 07:44:00 -04:00
ranxianglei 4721275c82 feat(config): render message timestamps by default — opt-out keeps pre-#4313 bytes (#4313)
The #4313 stamps are deterministic render inputs: minted once per message at
first sight, rendered from stored values never wall clock, prompt variants
resolved once per instance. A live-session cache audit on this session's own
proxy showed identical hit rates (95.0%) with rendering on vs off — the only
non-fold low hits were upstream TTL-eviction fingerprints that fully recovered
on the next turn. So the leak-audit follow-up flips the display gate ON by
default: resolveMessageTimestamps() unset now means `!== false` instead of
`=== true`. Opt-out stays an honest switch: file compress.messageTimestamps:
false or env BILI_MESSAGE_TIMESTAMPS="0" reproduces every pre-#4313 outbound
byte (no time= attribute, original prompt texts, no receipt span). Upgrading
users pay ONE frozen-prefix rewrite per active session at the first restart
that resolves true, then bytes are stable again; storage already recorded the
stamps unconditionally so full history surfaces immediately.

- src/config.ts: resolveMessageTimestamps flip + JSDoc (audit basis, one-time
  rewrite disclosure, opt-out paths) + CompressSettings field docs
- tests/preload-test-env.mjs: suite-level pin BILI_MESSAGE_TIMESTAMPS="0" so
  every byte-comparing baseline keeps its pre-feature shape (same discipline
  as the XDG roots pins); explicit-off and production-default paths are driven
  by the suites themselves
- tests/message-timestamps-default-on.test.ts (new): the production expression
  resolveMessageTimestamps(loadConfigFile().compress) resolves ON under a
  scrubbed env + realistic config without the key, at both exits (prompt
  variants + resolve), and file-false stays zero-divergence through it
- tests/issue4313-message-timestamp-toggle.test.ts: flipped to env > file >
  default TRUE; OFF cases retargeted to explicit env "0"; two PRODUCTION
  DEFAULT pins added (TIMESTAMPED variant selection + receipt span appended)
- docs: yaml seed default/desc/site EN+ZH, gen-config-docs regenerated,
  hand-maintained detail sections (CONFIGURATION.md/.zh-CN.md), CHANGELOG
2026-10-31 23:11:35 +08:00
ranxianglei 6fd9be5a99 feat(#4313): opt-in messageTimestamps toggle (default off) keeps pre-feature wire bytes
compress.messageTimestamps / BILI_MESSAGE_TIMESTAMPS gate the display
side end-to-end: core pipeline ports (per-instance), fingerprint-span
receipt lines at the single applyRanges site, and the timestamped prompt
variants selected at every host prompt exit via messageTimestampSections.
Off is the default and stays byte-identical to pre-feature master. Docs
(CONFIGURATION.md + zh, website seeds regenerated by the official script,
coverage ok), storage-render goldens regenerated off-default (shape equals
pre-feature master; only state digests drift), new host toggle suite, and
config-surface seeds for both this key and sessions.hardMaxBytes.
2026-10-30 23:57:03 +08:00
ranxianglei 18de1c1f5f feat: per-model USD billing prices + panel money views (#4899)
New billing.prices config block (USD/Mtok, per model) overrides the bundled
models.dev snapshot. Every settled usage report bills a running USD ledger on
the session (session.stats.costUsd: input/cacheRead/cacheWrite/output), the
panel Saved column converts fold savings into dollars (netSavedUsd), session
rows show spend + saved-$ subtitles, and a web editor at Configuration ->
Billing prices edits overrides with registry prefills (GET/PUT /__bili/pricing).

Resolution per model id: billing.prices -> models.dev snapshot -> unpriced
(tokens only, never fabricated dollars). Optional price fields bill at the
input rate. Invalid shapes reject the whole block at load.

Closes #4899
2026-10-27 11:57:30 +08:00
ranxianglei 8b394078fc feat: panel-embedded blog & articles view — bundled markdown rendered in the panel's own style (#4587)
Per owner feedback the panel does NOT serve the whole website; it renders a
few posts/articles with its own look instead:
- src/web/blogfeed.ts: GET /__bili/blog JSON feed (website/blog/posts/*.md +
  website/articles.json manifest, both EN/ZH) rendered server-side with
  web/markdown.ts; images ride guarded GET /__bili/blog-assets/<rel>
  (traversal/encoding/extension gates); fail-soft, no config surface
- web/markdown.ts gains image refs (http(s)/panel asset route only) and GFM
  pipe tables rendered with the panel's .data classes — additive, kernel
  handoff output unaffected
- panel gets a 博客/Blog page (card list, click to expand, bilingual via the
  existing language toggle which reloads) + nav entry + CSS
- package.json files ships only the needed markdown + figures (+~100KB,
  not the whole site)
2026-10-25 03:46:57 +08:00
ranxianglei 4d34abfafc fix(gates): repair the merge-ref casualties — config-surface guard locates the Set definition (master-red too, #3675 comment tripped indexOf), de-export 3 internal-only symbols, regenerate derived config docs 2026-10-24 23:56:10 +08:00
ci-check b7c9a02302 Merge remote-tracking branch 'origin/master' into 2026-09-26_model-endpoint-patterns 2026-10-24 23:02:13 +08:00
awork ed8323d28f docs(#3635): regenerate derived config docs from the seed so docs-sync passes
Review follow-up: the summary-length rows were hand-written into CONFIGURATION.md / CONFIGURATION.zh-CN.md with wording that drifted from website/config-reference/compress.yaml, and website/docs/index.html + website/main.js were never regenerated, so the docs-sync artifact-drift gate went red. Regenerated all four derived files from the seed (node tools/gen-config-docs.mjs generate); the seed wording is the canonical one.

(cherry picked from commit d475598039)
2026-10-24 21:45:32 +08:00
awork a2658496d7 fix: hold outbound sends after consecutive upstream 429s (#4204)
A concurrency-style provider limit (z.ai GLM coding plan: ~9-18 parallel,
dynamic, no Retry-After) plus hosts that re-drive a failed turn every few
seconds made bili's unconditional forwarding self-amplifying: the retry
stream itself occupied the provider slots and pinned the whole account at
the limit for minutes until the client was restarted.

Egress-side governor (src/upstream-throttle.ts): after consecutive 429s for
one origin+credential, further sends are answered locally with zero egress —
429 + Retry-After while under budget (exponential backoff x2 per consecutive
429, jittered [0.5x,1x], capped; upstream Retry-After wins when larger), then
a TERMINAL 424 outside every known SDK retry set ({408,409,429,>=500}) so
hosts give up and surface the error for manual resend. One probe per backoff
window keeps checking (auto-recovery without a restart); ANY resolved
non-429 response clears the hold immediately. State is in-memory per
origin+credential fingerprint (#2131), bounded at 64 keys; process restart
re-learns from live traffic.

Behavior change (default ON): the main forward path no longer forwards every
request verbatim once its origin+credential is held — previously every
re-driven request hit the upstream. Escape hatch: network.throttle429Enabled
= false (BILI_THROTTLE_429=0) restores legacy always-forward behavior.

New config surface (network section, env > file > default):
throttle429Enabled true / throttle429MaxConsecutive 5 /
throttle429BaseDelayMs 2000 / throttle429MaxDelayMs 30000.

Display: acp_status gains an UPSTREAM 429 HOLD block mirroring the #3148
circuit block. Deliberately separate from the #3148 circuit breaker
(pre-response transport deaths) and orthogonal to the approved-but-unshipped
#3606 A1 in-request retry (different layer: this observes the final verdict
per request and gates egress between requests).

Tests: tests/issue4204-throttle-governor.test.ts (10 rows, both-directions
gate discipline).

(cherry picked from commit 21521bdaa4)
2026-10-24 18:43:40 +08:00
awork cd554479e8 fix(#1444 merge): seed modelEndpointPatterns in config-reference + unexport internal ModelEndpointWire
Post-merge gate fixes on the merged tree:
- config-surface-guard (#2643, landed after this branch cut): the new
  top-level field needed a seed entry in website/config-reference/*.yaml;
  added to server.yaml (upstream group) and regenerated the marked doc
  blocks via tools/gen-config-docs.mjs (hand-written section prose kept).
- unused-exports: ModelEndpointWire is only used inside
  src/model-endpoints.ts — drop the leading export (INTERNAL_ONLY).
Local: both gates green, tsc clean.
2026-10-18 22:32:04 +08:00
ranxianglei 4c62d2a274 Merge pull request #3422 from ranxianglei/feat/absorb-revival-media-only
feat(absorb): revive absorb scoped to image results + fix plugin-lane tool visibility (#3402)
2026-10-17 14:09:26 +08:00