Repository navigation
feat: 支持下载完整会话报告(Markdown + PNG 图片) - #3099
Conversation
📦 Built Package ArtifactBranch: Option A — Install this exact build (recommended)npm install -g billion-context@0.0.3611-pr.3099.3c8b773This exact version is immutable and reproducible. The rolling Option B — Download artifact
tar xzf billion-context-pr3099.tgz
npm install -g packageInstall instructions are refreshed on each push. |
The det.seam_events i18n strings already start with a warning glyph in both locales, so the hard-coded prefix rendered '⚠ ⚠ 缓存接缝事件' / '⚠ ⚠ Cache-seam events' in both the Markdown and SVG reports. Remove the prefix from both render paths and pin it with a regression assertion. Found while reviewing #3099.
(ai: vllm-qwen/qwen3.8-27b) PR 审核结论(独立重审,非复读 issue):方向与 owner 在 #3057 的拍板一致(路线 B 确定性渲染、md + png 两份),实现干净、纯增量、零新依赖。审核中发现 1 个外观缺陷已直接修掉并推到分支(见下)。整体判定:可合并(feat,按规矩由人合并)。 结构化八问
审核中发现并已修的小缺陷(小问题直接修):接缝事件板块标题渲染出重复警告符—— 顺带发现的小缺口(不拦,留你判断,未动代码):① 报告输出省略了 CI:原 head 1f2cc6c 上多车道此前在跑(e2e-pi-codex-ws / e2e-native-dsh / e2e-dsh-plugin-lane / e2e-local-registry 等);我推了修复 commit 后 CI 会对新 head 4c418db 全量重跑,最终绿红以远程 CI 为准。分支基于当前 master(8bcdb7f),0 落后。 |
The det.seam_events i18n strings already start with a warning glyph in both locales, so the hard-coded prefix rendered '⚠ ⚠ 缓存接缝事件' / '⚠ ⚠ Cache-seam events' in both the Markdown and SVG reports. Remove the prefix from both render paths and pin it with a regression assertion. Found while reviewing #3099.
4c418db to
4d53f46
Compare
The unused-exports gate (#1440 P6) fails on this branch: ReportOpts/ReportData/SvgReport in src/web/report.ts are only referenced within their own file yet declared as exports. Drop the leading 'export' per the gate's prescribed INTERNAL_ONLY fix. No behavior change: admin.ts and the tests import only the two buildSessionReport* functions. Branch also rebased onto current master (6887bbd, +#3094; no file overlap with this PR). Found while reviewing #3099.
(ai: vllm-qwen/qwen3.8-27b) CI 跟进(旧 head 4c418db 结果已到,红项已定位并修掉) 上一轮回复后 CI 跑完:25 车道中 24 绿(含全量 e2e、kernel-guard、config-surface-guard、各真实客户端 lane),唯一红项 根因(本 PR 引入,非既有问题): 修法:按门禁自身给定的 INTERNAL_ONLY 处置——删掉三个接口的前导 新 head |
Add one-click download of the complete session-detail report from the web UI detail page (基本信息 / 用量统计 / 上下文轨迹 / 缓存接缝事件 / 体稳定性 / 缓存经济学): - src/web/report.ts: pure, dependency-free, DOM-free builders rendering all sections as Markdown and as a closed-vector SVG (rasterizable to PNG by the browser without any new dependency). - src/server/admin.ts: new loopback-only GET /__bili/session-report (?session=&format=md|svg&mask=on|off&lang=zh|en), mirroring the existing /__bili/cache-report endpoint. Title/label (user PII) masked by default; upstream host + metrics kept for diagnosis. - src/web/client.ts: two buttons (Markdown / PNG) after the page header; fetches the server render and rasterizes SVG->PNG via native canvas. - i18n zh/en keys + tests/session-report.test.ts (8 tests). Closes #3057
The det.seam_events i18n strings already start with a warning glyph in both locales, so the hard-coded prefix rendered '⚠ ⚠ 缓存接缝事件' / '⚠ ⚠ Cache-seam events' in both the Markdown and SVG reports. Remove the prefix from both render paths and pin it with a regression assertion. Found while reviewing #3099.
The unused-exports gate (#1440 P6) fails on this branch: ReportOpts/ReportData/SvgReport in src/web/report.ts are only referenced within their own file yet declared as exports. Drop the leading 'export' per the gate's prescribed INTERNAL_ONLY fix. No behavior change: admin.ts and the tests import only the two buildSessionReport* functions. Branch also rebased onto current master (6887bbd, +#3094; no file overlap with this PR). Found while reviewing #3099.
… allowlist #3099 adds src/web/report.ts, which references i18n keys via t()/tr() that the dead-key scanner (page.ts+client.ts only) never sees, and slices line/fold arrays for table tails. Both are array/code-level constructs, not string cuts — same class as the existing client.ts/conflict-watch.ts allowlist entries.
4d53f46 to
7f81e54
Compare
[bot] 🏷 (ai: vllm-qwen/qwen3.8-27b) 第三轮:CI 红项全部定位,PR 侧已修完,另立项一个 master 既有问题上轮推送后 CI 的 3 个红 lane(test/ubuntu×2、windows)里共 6 个失败用例,逐一查证结论如下: ① 两个是 PR 引入的静态门禁违规(我静态审查漏掉,已在本分支修掉)
② 四个 storage-render golden 失败 = master 既有问题,与本 PR 无关(证据链完整)
③ 分支已 rebase 到当前 master(1fcfe5260,期间 #3041/#3051 合入):无冲突;当前 head CI 现状(写此回复时):29/33 绿——含 static-gates、unused-exports、全部 e2e lane;剩 4 条全量 test lane 仍在跑。本地已精确预测其结果:只会挂上述 ② 的 4 个既有用例,无其他失败。跑完我再补一条确认。 判定:PR 本体可合并(纯增量 web 功能,wire/存储零触碰;回归审查与上轮结论不变)。feat 类,合并留给你;若要一次看到全绿,建议先合 #3120。 |
[bot] 🏷 (ai: vllm-qwen/qwen3.8-27b) CI 跑完了,与本地预测一致:
最终判定不变:可合并。feat 类留给你合;想一次看到全绿就先合 #3120,否则这 4 个红与本 PR 无关。 |
[bot] 🏷 (ai: vllm-qwen/qwen3.8-27b) 收工总结(本 issue 全部动作一览)审核:独立复核通过——方向与 owner 拍板的路线 B 一致(确定性渲染,md + PNG 双格式);loopback-only 门禁、零新增依赖(build 本分支修掉的 3 个 PR 引入问题(独立标注 commit,均已推):
master 既有问题(与本 PR 无关,已单独处置):4 个 storage-render golden 失败,证据链完整(master worktree 与本分支 actual digest 逐字节相同;漂移仅限 metadata 段;根因 #3093 live-stamp 写入新字段未再生快照)。已立 #3118(来源标记 + [no-dispatch])+ 修复 PR #3120(再生快照,diff 限 4 文件 8 行),#3120 CI 已 31/31 全绿。 终态:分支已 rebase 到当前 master,head |
📦 Merged Build PublishedThis merge to master was published as npm install -g billion-context@0.0.410-master.2720571 # this exact build
npm install -g billion-context@master # always the newest merged build
|
背景
#3057:会话详情页目前只有「下载缓存报告 .md」(仅覆盖缓存账本),无法一键导出完整会话报告(基本信息 / 用量统计 / 上下文轨迹 / ⚠缓存接缝事件 / 体稳定性 / 缓存经济学)。诉求:一个按钮直接下载、掩码用户 title 等隐私、最好是一张网页图片、AI(含视觉模型)能识别。
方案(路线 B:确定性渲染,非 html2canvas 截图)
详情页头部新增两个按钮:下载报告 Markdown 与 下载报告 PNG,两种格式都产出(Markdown 供精确数字/AI 文本阅读,PNG 供人看与分享)。
src/web/report.ts(零依赖、无 DOM、可在单测中运行),把六个板块渲染成 Markdown 与闭合矢量 SVG;SVG 由浏览器原生Image+canvas栅格化为 PNG —— 不引入任何新依赖。GET /__bili/session-report?session=&format=md|svg&mask=on|off&lang=zh|en,与既有/__bili/cache-report同构(返回 JSON{md}/{svg,w,h})。隐私
title / label(用户 PII)默认掩码为「会话 <id>」;保留 upstream host、模型名与全部指标(诊断必需)。掩码默认开启,可用
?mask=off关闭。约束核对
report.ts仅 import./i18n.js;dist/index.js保持零依赖(build 输出dist-import-annotations: OK)。handleAdminRoute门禁)。验证
npm run typecheck✅、npm run build✅。tests/session-report.test.ts8/8 ✅(掩码开/关、两种格式、zh/en、确定性、空数据兜底、SVG 闭合矢量)。Closes #3057