Skip to content

[PR] feat(web): compression-structure tab with tier tree, graph view and l… - #3924

Merged
ranxianglei merged 4 commits into
ranxianglei:masterfrom
vegetable86:2026-10-20_webui-compression-tree
Oct 20, 2026
Merged

ranxianglei merged 4 commits into
ranxianglei:masterfrom
vegetable86:2026-10-20_webui-compression-tree

Conversation

@vegetable86

Copy link
Copy Markdown

…azy leaves

Session detail gains a Structure sub-tab next to Overview/Handoff. It reads the kernel's own accounting: blocks nest by parentBlockId (who folded whom), each node shows tier, compressed->summary tokens with ratio, summary bytes, the mNNNNN span, message counts and age, plus the summary markdown and one leaf per folded message.

Two readings of the same data switch in place: the list (inspect concrete messages) and a layered tree map (overall shape, click a node to jump back to its row). Originals load on demand through two admin-gated endpoints (/block-content and /message, 2 MiB cap with honest truncation, unknown / pruned / no-snapshot answers instead of guesses).

…azy leaves

Session detail gains a Structure sub-tab next to Overview/Handoff. It reads the
kernel's own accounting: blocks nest by parentBlockId (who folded whom), each
node shows tier, compressed->summary tokens with ratio, summary bytes, the
mNNNNN span, message counts and age, plus the summary markdown and one leaf per
folded message.

Two readings of the same data switch in place: the list (inspect concrete
messages) and a layered tree map (overall shape, click a node to jump back to
its row). Originals load on demand through two admin-gated endpoints
(/block-content and /message, 2 MiB cap with honest truncation, unknown /
pruned / no-snapshot answers instead of guesses).
@ranxianglei ranxianglei changed the title feat(web): compression-structure tab with tier tree, graph view and l… [PR] feat(web): compression-structure tab with tier tree, graph view and l… Oct 20, 2026
@ranxianglei

Copy link
Copy Markdown
Owner

ework接单

@ranxianglei

Copy link
Copy Markdown
Owner

🤖 Powered by ework · qwen3.8-27b

(ai: vllm-qwen/qwen3.8-27b)

查重:不重复。 检索 open+closed 的 issue/PR(compression / structure / tree,含已关闭),仅本 PR 匹配这个 web 层级树视图;命中的 #1790/#571/#558/#1527/#1649 均无关。代码注释里引用的 #3917 是真实的 open 功能 issue(“session detail 压缩结构 tab”),本 PR 就是它的实现。

标签: scope/ui + p3 —— web 监控面板展示层的新增 tab;属功能而非缺陷故不打 bug,无既有行为破坏故取最低档 p3;不涉及具体客户端(pi/codex/dsh/opencode/claude-code 都不沾边)。


结构化八问

1. 是什么问题:功能请求(#3917),不是缺陷——给 web 面板会话详情页加一个「压缩结构」tab,把压缩块的层级树、SVG 图视图、以及懒加载的块正文和被折叠消息原文可视化出来。

2. 什么原因导致的:不适用(新功能)。原详情页只有块列表平铺,看不出折叠层级关系和整体结构,本 PR 补齐这一观测面。

3. 影响范围与严重程度:只影响 web 监控面板的展示层,不碰请求管道 / 压缩引擎 / wire。对现有用户零破坏,纯增量 UI。按最低档 p3 计:加法型 UI 功能,无既有行为回归。

4. 怎么修复的(实现思路):服务端在 sessions-data.ts 里从 CompressionBlock.directBlockIds / effectiveMessageIds / directMessageIds 反推父子关系,挂到 WebSessionDetail.blockDetails;客户端把这份结构渲染成可切换的「列表树 ⇄ SVG 图」,块的正文 / 消息叶子走两个新的只读懒加载端点(/__bili/sessions/:id/block-content、/…/message)。我逐条核对了它用到的每个字段都真实存在于 kernel/session 类型里(directBlockIds、defaultCountTokens、CoreMessage.id/role/text/toolName、BlockContent.one/full、LazyBlockContents.get()、messageRefs.byRaw/byRef),没有凭空的假设。

5. 是否有回归问题:审过的既有行为——

  • ① 详情页原来内联在 overview 里的块卡片,现在移到了独立 tab(默认停在 overview,要点一下才看得到块)。这是有意的 UX 变更、正是本功能的目的,OP 已描述,不算回归;
  • ② 未命名块的 topic 兜底现在会剥掉行首 markdown 标题/列表符号(# / - 之类)——外观微调,低风险。

除此之外没有触碰任何既有行为:无 config / env / persistence / kernel / wire 变更。两个新端点是只读、admin-gate、loopback-only,与既有 /__bili/ 路由纪律一致,安全面没扩大;所有动态值都过 escapeHtml(含引号转义 "/'),XSS 姿势安全;contentCache 限 2 条 + 60s TTL、递归深度封顶(图 40 / 列表 32),无内存增长或栈溢出风险。错误处理是诚实的 miss(unknown-session/unknown-block/no-content-snapshot/unknown-message),不猜、不伪造内容。

6. 是否破坏缓存:不涉及压缩缓存 / 重试 / 增量游标 / 去重键。新增的 contentCache 只是展示层对块正文做字节切片的临时缓存,上限 2 条,完全不碰 kernel 的 fold/cache 机制。

7. 是否改了设计方向:不改架构 / 边界 / 数据流。只是把 kernel 已经算好的折叠结构暴露到 web 展示层;读路径复用了现有的 unified-first 逻辑(抽成 loadSessionById helper,行为不变)。

8. 是否引入新配置:无新 env / config / 默认值。


质量判定(外部贡献者 PR)

质量达标,无需重构。命名达意、注释讲 why(带 issue 引用)、zh/en 双 locale 配对、测试有牙:字节级精确截断上限、honest-miss-not-guess、legacy 缺字段不崩也不误嵌套、i18n 占位符对齐、WEB_CLIENT 作为独立 vm.Script 可解析。

顺手修的一处小错(已在 PR 分支提交):reference/architecture.md 里这行引用了一个不存在的 #3936,应为功能 issue #3917(代码注释里用的都是 #3917)。已作为独立标注 commit 直接推到 PR 分支:docs: correct stale issue ref in architecture.md (#3936 -> #3917)(commit 49019ea1e)。全仓已确认无其它 3936 残留。

CI 状态

  • 功能代码 + 测试在 5985095ba 上全绿(各 guard + 测试 gate 全 success;真实客户端 e2e lane 按门控跳过)。
  • 我那笔一行文档修正 49019ea1e 触发了新一轮 CI(进行中)——纯文档改动,不影响功能/测试;之前排队的 version-guard 也会随这次重跑落定。

收工判定

建议可合(human merge):外部贡献者代码质量达标、无回归、测试有牙、安全姿势保持。它是 feat: 类,按 §7.4 本就不走 auto-merge,需人工合并。合并前请等 49019ea1e 这轮 CI 全绿(尤其 version-guard 落定)。两处有意的 UX 变更(块卡片进独立 tab、topic 兜底剥符号)已在第 5 问披露。

@ranxianglei

Copy link
Copy Markdown
Owner

🤖 Powered by ework · qwen3.8-27b

(ai: vllm-qwen/qwen3.8-27b)

复查(同一 PR,无新增人类评论需处理):上一轮的结构化八问审核已在上一条给出,结论不变。这里只补一个最新状态快照。

判定不变:外部贡献者代码质量达标、无回归、测试有牙、安全姿势保持 → 建议可合(human merge),等这轮 CI 全绿即可人工合并(feat: 类本就不走 auto-merge)。两处有意的 UX 变更(块卡片进独立 tab、topic 兜底剥符号)已在上一条第 5 问披露。

@ranxianglei
ranxianglei merged commit f064d8e into ranxianglei:master Oct 20, 2026
81 of 118 checks passed
@github-actions

Copy link
Copy Markdown
Contributor

📦 Merged Build Published

This merge to master was published as 0.0.693-master.f064d8e (rolling master tag).

npm install -g billion-context@0.0.693-master.f064d8e  # this exact build
npm install -g billion-context@master  # always the newest merged build

npm view billion-context@master prints the current version at any time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants