Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/architecture/fastpaths.ja.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,4 @@

## 関連

[lanes](./lanes.md) · [pipeline](./pipeline.md) · [identity](./identity.md) · [#5643 進化: 4つすべてがスナップショットテーブル基盤に収束](https://github.com/ranxianglei/billion-context/issues/5643) · `tests/issue5403-watermark-fastpath.test.ts`
[lanes](./lanes.md) · [pipeline](./pipeline.md) · [identity](./identity.md) · [#5643 進化: 4つすべてがスナップショットテーブル基盤に収束](https://github.com/ranxianglei/billion-context/issues/5643) · [非推奨台帳](../deprecations.md)(D レーン / `l1_world` / `conversations` の退役ゲート) · `tests/issue5403-watermark-fastpath.test.ts`
2 changes: 1 addition & 1 deletion docs/architecture/fastpaths.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,4 @@ Skips: whole-body `JSON.parse` + `openaiToCore` (v5); `snapshotMessages` prefix

## Related

[lanes](./lanes.md) · [pipeline](./pipeline.md) · [identity](./identity.md) · [#5643 evolution: all four converge onto the snapshot-table foundation](https://github.com/ranxianglei/billion-context/issues/5643) · `tests/issue5403-watermark-fastpath.test.ts`
[lanes](./lanes.md) · [pipeline](./pipeline.md) · [identity](./identity.md) · [#5643 evolution: all four converge onto the snapshot-table foundation](https://github.com/ranxianglei/billion-context/issues/5643) · [deprecations register](../deprecations.md) (retirement gates for D-lane / `l1_world` / `conversations`) · `tests/issue5403-watermark-fastpath.test.ts`
2 changes: 1 addition & 1 deletion docs/architecture/fastpaths.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,4 @@

## 相关

[lanes](./lanes.zh-CN.md) · [pipeline](./pipeline.zh-CN.md) · [identity](./identity.zh-CN.md) · [#5643 演进:四条收敛到快照表底座](https://github.com/ranxianglei/billion-context/issues/5643) · `tests/issue5403-watermark-fastpath.test.ts`
[lanes](./lanes.zh-CN.md) · [pipeline](./pipeline.zh-CN.md) · [identity](./identity.zh-CN.md) · [#5643 演进:四条收敛到快照表底座](https://github.com/ranxianglei/billion-context/issues/5643) · [退役登记](../deprecations.zh-CN.md)(D-lane / `l1_world` / `conversations` 的退役门) · `tests/issue5403-watermark-fastpath.test.ts`
2 changes: 1 addition & 1 deletion docs/architecture/identity.ja.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

**セッションアイデンティティ。** クライアントのセッション ID はそのまま使用される(ネイティブの安定 ID が優先される、#280 — 漂移する派生ハッシュからアイデンティティを構築しないこと)。匿名トラフィックは `pfa-*` プレフィックスアフィニティ ID に解決される(simhash チェーン、初回書き込み者の出所 #2879/#2265)。ペルソナのフォーク: `subagentNamespace(id, systemText)` はホスト由来のペルソナを `|sub:<fp>` にフォークする — 証拠パーミットリスト(現在は dsh、#1104/#2156)、ID 下で最初に確認されたシステムが生キーをアンカーし、サイドリクエストはそれを主張できない。

**メッセージアイデンティティ。** プラグインレーンは、bili のエンベロープ内で要素ごとのホスト msgid を保持する(`POST /__bili/plugin/turn` の `msgIds`)— インジェスト時に除去され、モデルワイヤー上には決して載らない(#4491/#4834/#5842)。台帳キーは `(session_id, msg_id, content_hash)` のトリプルである: msgid が決定し、ハッシュは誤った結合に対する安全帯として機能する。レガシーの全量再送信セッションは、順序中心の調整ラダーを実行する: セルごとのフィンガープリントゲートを伴う位置ベースの主張、ID/コンテンツは補助証拠として使用され、各階層はソフトに失敗し、同一インデックスの合意の連続(MIN_RESYNC_RUN)で再同期する。「基盤の破壊」へのエスカレーションは、すべてのパスが失敗した後、または完全展開のドゥームループ(#2821)の場合のみ行われる。
**メッセージアイデンティティ。** プラグインレーンは、bili のエンベロープ内で要素ごとのホスト msgid を保持する(`POST /__bili/plugin/turn` の `msgIds`)— インジェスト時に除去され、モデルワイヤー上には決して載らない(#4491/#4834/#5842)。台帳キーは `(session_id, msg_id, content_hash)` のトリプルである: msgid が決定し、ハッシュは誤った結合に対する安全帯として機能する。レガシーの全量再送信セッションは、順序中心の調整ラダーを実行する: セルごとのフィンガープリントゲートを伴う位置ベースの主張、ID/コンテンツは補助証拠として使用され、各階層はソフトに失敗し、同一インデックスの合意の連続(MIN_RESYNC_RUN)で再同期する。「基盤の破壊」へのエスカレーションは、すべてのパスが失敗した後、または完全展開のドゥームループ(#2821)の場合のみ行われる。**egress 武装済みのプラグインセッションでは op ログがこのチャネルを引継ぐ:** その I 行(`egress_flow.msgid` + `log_seq`、再発行なし)が正規のメッセージアイデンティティであり、stage-0 は状態なし(フロンティアは `MAX(op_seq)` / 最新 base の高水位から、台帳なし・再同期なし、#7617)、R3 障害ラッチは `sessions.r3_latched_at`(二重キャリアの読み/クリア)にある — [egress-plane.md](../egress-plane.md) を参照。

**サーバーサイドレンダリング(D レーン、#3756)。** 読み取り可能な統合ストレージにバインドされたセッションでは、送信 PREFIX はサーバートランスクリプトからレンダリングされる — 行の `seq` がメッセージアイデンティティであり、署名/ハッシュはチェーンのバックトレースのみである。末尾はプレフィックスキャッシュの安定性のためにクライアント由来のまま保持される。観察(`reconcileFoldCoverage`)とレンダリングは意図的に分離されている。

Expand Down
2 changes: 1 addition & 1 deletion docs/architecture/identity.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Decide which session a request belongs to, which of its messages are new versus

**Session identity.** The client's session id is used verbatim (native stable ids preferred, #280 — never build identity from derived hashes that drift). Anonymous traffic resolves to `pfa-*` prefix-affinity ids (simhash chain, first-writer provenance #2879/#2265). Persona forking: `subagentNamespace(id, systemText)` forks a host-proven persona onto `|sub:<fp>` — an evidence permitlist (dsh today, #1104/#2156), the first system seen under an id anchors the raw key, side requests never claim it.

**Message identity.** Plugin lanes carry per-element host msgids in bili's envelope (`msgIds` on `POST /__bili/plugin/turn`) — stripped at ingest, never on the model wire (#4491/#4834/#5842). The ledger key is the triple `(session_id, msg_id, content_hash)`: msgid decides, hash is the safety belt against mis-binding. Legacy full-resend sessions run the order-centric reconcile ladder: positional claims with per-cell fingerprint gates, id/content as auxiliary evidence, each rung failing soft, resync at runs of same-index agreements (MIN_RESYNC_RUN); escalation to "substrate destroyed" only after every pass, or the total-unfold doom loop (#2821).
**Message identity.** Plugin lanes carry per-element host msgids in bili's envelope (`msgIds` on `POST /__bili/plugin/turn`) — stripped at ingest, never on the model wire (#4491/#4834/#5842). The ledger key is the triple `(session_id, msg_id, content_hash)`: msgid decides, hash is the safety belt against mis-binding. Legacy full-resend sessions run the order-centric reconcile ladder: positional claims with per-cell fingerprint gates, id/content as auxiliary evidence, each rung failing soft, resync at runs of same-index agreements (MIN_RESYNC_RUN); escalation to "substrate destroyed" only after every pass, or the total-unfold doom loop (#2821). **For egress-armed plugin sessions the op log takes over this channel:** its I rows (`egress_flow.msgid` + `log_seq`, never re-issued) are the canonical message identity, stage-0 is stateless (frontiers from `MAX(op_seq)` / newest-base high water — no ledger, no resync, #7617), and the R3 fault latch lives in `sessions.r3_latched_at` (dual-carrier read/clear) — [egress-plane.md](../egress-plane.md).

**Server-side render (D-lane, #3756).** For sessions bound to a readable unified store, the outbound PREFIX is rendered from the server transcript — row `seq` IS the message identity, signatures/hash are chain back-trace only; the tail stays client-verbatim for prefix-cache stability. Observing (`reconcileFoldCoverage`) and rendering are deliberately separate.

Expand Down
2 changes: 1 addition & 1 deletion docs/architecture/identity.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

**会话身份。** 客户端 session id 逐字使用(优先原生稳定 id,#280——永不从会漂移的派生哈希构造身份)。匿名流量解析为 `pfa-*` 前缀亲和 id(simhash 链、首写者出处 #2879/#2265)。persona 分叉:`subagentNamespace(id, systemText)` 把宿主被证明的 persona 分叉到 `|sub:<fp>`——证据白名单(今天是 dsh,#1104/#2156);某 id 下首个 system 锚定原始键,side 请求永不锚定。

**消息身份。** 插件车道把逐元素宿主 msgid 装在 bili 信封里上行(`POST /__bili/plugin/turn` 的 `msgIds`)——入站即剥、永不出现在模型线上(#4491/#4834/#5842)。账本键是三元组 `(session_id, msg_id, content_hash)`:msgid 定身份,hash 是防错绑的安全带。legacy 全量重发会话跑顺序为中心的 reconcile 阶梯:位置认领带逐格指纹门,id/内容为辅助证据,每一档软失败,在同索引连续命中(MIN_RESYNC_RUN)处重新同步;只有所有通道都空了才升级「substrate destroyed」,否则就是 total-unfold 死循环(#2821)。
**消息身份。** 插件车道把逐元素宿主 msgid 装在 bili 信封里上行(`POST /__bili/plugin/turn` 的 `msgIds`)——入站即剥、永不出现在模型线上(#4491/#4834/#5842)。账本键是三元组 `(session_id, msg_id, content_hash)`:msgid 定身份,hash 是防错绑的安全带。legacy 全量重发会话跑顺序为中心的 reconcile 阶梯:位置认领带逐格指纹门,id/内容为辅助证据,每一档软失败,在同索引连续命中(MIN_RESYNC_RUN)处重新同步;只有所有通道都空了才升级「substrate destroyed」,否则就是 total-unfold 死循环(#2821)。**对 egress-armed 的插件会话,op log 接管这条通道:**它的 I 行(`egress_flow.msgid` + `log_seq`,永不复用)就是规范消息身份,stage-0 无状态(水位取自 `MAX(op_seq)` / 最新 base 的 high water——无账本、无 resync,#7617),R3 故障 latch 落在 `sessions.r3_latched_at`(双载体读/清)——见 [egress-plane.md](../egress-plane.zh-CN.md)。

**服务端渲染(D-lane,#3756)。** 对绑定了可读统一存储的会话,出站**前缀**由服务端正史行渲染——行 `seq` 就是消息身份,签名/hash 只做链回溯兜底;尾巴保持客户端逐字以稳住前缀缓存。观察(`reconcileFoldCoverage`)与渲染刻意分离。

Expand Down
2 changes: 2 additions & 0 deletions docs/architecture/lanes.ja.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@

**解決器。** `lane-decisions.ts` はリクエスト形状 × セッションスティッキーバインディング(#5643 基盤レーン用の計画行1つ、負+正のペア)をマッチングし、以下を選択する:増分プラグインターンレーン / v5 ウォーターマーク / Dレーンスナップショットレンダリング / レガシー完全再送。

**egress プレーン(KDD #23、[egress-plane.md](../egress-plane.md))。** 武装済みのプラグインセッション(`egressPlane` 有効 + ピン確定済み + サイドリクエスト以外)は上記4レーンでは走らない: op ログ(`egress_flow`)が送信権威となり、ピンチャネルはその I 行を解決し、stage-0 アイデンティティは状態なし(台帳なし・再同期なし、#7617)。未武装のセッションはレーン上で処理される。

**処理レーン。** 3つのファストレーンについては [fastpaths モジュール](./fastpaths.md) を参照。レガシー完全再送はすべての形状のデフォルトであり、それらすべてのフォールバックセーフティネットである。

## 主要エントリ
Expand Down
2 changes: 2 additions & 0 deletions docs/architecture/lanes.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ This module answers three questions per request: who carried it in (which host,

**The resolver.** `lane-decisions.ts` matches request shape × session sticky binding (+ one planned row for the #5643 foundation lane, negative+positive pair) and picks: incremental plugin-turn lane / v5 watermark / D-lane snapshot render / legacy full-resend.

**Egress plane (KDD #23, [egress-plane.md](../egress-plane.md)).** Armed plugin sessions — `egressPlane` on + a pin has landed + not a side request — do NOT run on the four lanes above: the op log (`egress_flow`) is their outbound authority, the pin channel resolves its I rows, and stage-0 identity is stateless (no ledger, no resync, #7617). Everything that is not armed runs on the lanes.

**Processing lanes.** See the [fastpaths module](./fastpaths.md) for the three fast lanes; legacy full-resend is the default for every shape and the fallback safety net for all of them.

## Key entries
Expand Down
2 changes: 2 additions & 0 deletions docs/architecture/lanes.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@

**裁决器。** `lane-decisions.ts` 匹配请求形状 × 会话粘滞绑定(外加 #5643 底座车道的一行,正负成对),逐请求选出:增量 plugin-turn / v5 水位 / D-lane 快照渲染 / legacy 全量重发。

**egress 平面(KDD #23,[egress-plane.md](../egress-plane.zh-CN.md))。** 已 armed 的插件会话(`egressPlane` 开 + pin 已落 + 非 side 请求)**不走**上面四条车道:op log(`egress_flow`)就是它的出站正史、pin 通道解析它的 I 行、stage-0 身份无状态(无账本、无 resync,#7617)。未 armed 的会话照常走车道。

**处理车道。** 三条快车道见 [fastpaths 模块](./fastpaths.zh-CN.md);legacy 全量重发是所有形状的默认、也是所有快车道的兜底安全网。

## 关键入口
Expand Down
2 changes: 1 addition & 1 deletion docs/architecture/pipeline.ja.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

**統一ループ (`src/loop`)。** 4つのワイヤーアダプタを持つプロトコル非依存のコアが、ツール裁定と散文タグエコーフィルタ (`tag-echo-filter.ts` — 散文のみ、引数は変更なし) を実行します。ここが2つの圧縮モードが同じコードパスを維持する場所です (KDD #7): プラグインモードではエージェントが圧縮を所有するためツール+ナッジ注入が抑制され、プロキシモードでは `acp_summary` キャリアを出力し、厳格なバックエンドが安定したプレフィックスを維持できるようユーザーメッセージとして再表現されます。

**送信 (Egress)。** `stream-*` はワイヤーごとにアップストリームの SSE を書き換えます(チャンクフレーミング、キャッシュコントロールブレークポイント #1637、`wire-body` トレーリングユーザーターン追加)。リクエスト側では、ユーザー登録可能な `egressTransforms[]` パイプライン (`src/egress-transforms.ts`, #6003) が、セッション処理の後で再署名/v1Wrap の前に、すべての送信モデルリクエストボディに対して ESM プラグインを実行します — プラグインごとにフェイルオープン、`/__bili/config/reload` によるホットリロード可能、未設定時は完全な何もしません (no-op)。プロトコルヘッダー (pf-*/envelope) はプロキシから決して外に出ません — アップストリームのホップヘッダーリストがそれらを除去します。
**送信 (Egress)。** `stream-*` はワイヤーごとにアップストリームの SSE を書き換えます(チャンクフレーミング、キャッシュコントロールブレークポイント #1637、`wire-body` トレーリングユーザーターン追加)。リクエスト側では、ユーザー登録可能な `egressTransforms[]` パイプライン (`src/egress-transforms.ts`, #6003) が、セッション処理の後で再署名/v1Wrap の前に、すべての送信モデルリクエストボディに対して ESM プラグインを実行します — プラグインごとにフェイルオープン、`/__bili/config/reload` によるホットリロード可能、未設定時は完全な何もしません (no-op)。プロトコルヘッダー (pf-*/envelope) はプロキシから決して外に出ません — アップストリームのホップヘッダーリストがそれらを除去します。(命名注: この節の「Egress」はユーザーの `egressTransforms` プラグイン面と SSE 書き換えであり、egress プレーン(武装済みプラグインセッションの op ログ権威)とは別物。そちらは [egress-plane.md](../egress-plane.md) に記載。)

**ゲートとリカバリ。** `preflight.ts` (ホールドグレース、デッドエンドクールダウン)、`reasoning-guard` (署名済みペイロードは決してフォールド入力にならない)、`request-body-budget` (受信/デコード/送信バイト上限、パフォーマンスより可用性 #3128)、`content-encoding` (デコンプレッションボムガード、413)。エラー形状: `stream-error` (最小限の SSE エラー + 終了)、`fake-completion` (オプトインのリトライヒント)、`degenerate-turn` / `degenerate-retry`、および `exit-matrix` (ワイヤー終了 × 懸念事項、#588)。

Expand Down
2 changes: 1 addition & 1 deletion docs/architecture/pipeline.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ Every model-traffic request that reaches the proxy passes through this module: i

**Unified loop (`src/loop`).** A protocol-neutral core with four wire adapters performs tool adjudication and the prose tag-echo filter (`tag-echo-filter.ts` — prose only, arguments untouched). This is where the two compression modes keep the same code path (KDD #7): plugin mode suppresses tool + nudge injection because the agent owns compression; proxy mode emits the `acp_summary` carrier, re-voiced as a user message so strict backends keep a stable prefix.

**Egress.** `stream-*` rewrites the upstream SSE per wire (chunk framing, cache-control breakpoints #1637, `wire-body` trailing-user-turn append). On the request side, a user-registerable `egressTransforms[]` pipeline (`src/egress-transforms.ts`, #6003) runs ESM plugins over every outbound model-request body after session processing and before re-sign/v1Wrap — fail-open per plugin, hot-reloadable via `/__bili/config/reload`, an exact no-op when unconfigured. Protocol headers (pf-*/envelope) never leave the proxy — the upstream hop-header list strips them.
**Egress.** `stream-*` rewrites the upstream SSE per wire (chunk framing, cache-control breakpoints #1637, `wire-body` trailing-user-turn append). On the request side, a user-registerable `egressTransforms[]` pipeline (`src/egress-transforms.ts`, #6003) runs ESM plugins over every outbound model-request body after session processing and before re-sign/v1Wrap — fail-open per plugin, hot-reloadable via `/__bili/config/reload`, an exact no-op when unconfigured. Protocol headers (pf-*/envelope) never leave the proxy — the upstream hop-header list strips them. (Naming note: this section's "egress" is the user `egressTransforms` plugin surface and the SSE rewrites — NOT the egress PLANE, the op-log authority for armed plugin sessions; that one is documented in [egress-plane.md](../egress-plane.md).)

**Gates & recovery.** `preflight.ts` (hold grace, dead-end cooldown), `reasoning-guard` (signed payloads are never fold inputs), `request-body-budget` (receive/decode/send byte caps, availability over performance #3128), `content-encoding` (decompression-bomb guard, 413). Error shapes: `stream-error` (minimal SSE error + finish), `fake-completion` (opt-in retry hint), `degenerate-turn` / `degenerate-retry`, and `exit-matrix` (wire-exit × concerns, #588).

Expand Down
Loading
Loading