Repository navigation
[PR] feat: per-client compression status dashboard (#1920) - #1927
ranxianglei wants to merge 1 commit into
Conversation
[bot] 🏷 PR #1927 审查结论(feature #1920 · 每客户端压缩状态看板) 总体判定:代码与数据质量扎实、方向正确、测试有牙。唯一拦合并项 = 分支落后 master 且有合并冲突,需 rebase 到当前 master 并重跑 CI。未合并(合并仅人工)。 结构化七问
行为变更披露(policy 要求)
审查过程要点
待办 / 建议
需要的话我可以直接执行 rebase 到当前 master 并推回分支。 |
|
冲突 |
[bot] 🏷 收到。正在把分支 |
97f6ba0 to
3dda4df
Compare
📦 Built Package ArtifactBranch: Option A — Install this exact build (recommended)npm install -g billion-context@0.0.1939-pr.1927.690e25aThis exact version is immutable and reproducible. The rolling Option B — Download artifact
tar xzf billion-context-pr1927.tgz
npm install -g packageInstall instructions are refreshed on each push. |
[bot] 🏷 冲突已解决,分支已 rebase 到当前 master。
一处需你知晓的语义取舍(非纯机械 rebase):master 的 #1902 把 claude hook 命令的 node 从 CI(新 head |
[bot] 🏷 CI 全绿,冲突已消除,PR 现可人工合并。
按仓库规则合并仅人工操作,我不代合。请你在 #1927 点合并即可。 小结:本次仅 rebase + 解决 |
|
(ai: zhipuai-lb/glm-5.3) 陈旧票清理(第三批动作①):目标 issue #1920 已关。为避免重复劳动关闭本 PR;如判断有误请直接 reopen 并留言。 |
Closes #1920
What
Every client gets a compression status dashboard on its most roomy available surface, all reading ONE proxy-rendered line so numbers never drift between clients:
GET /__bili/plugin/statusgains an additivestatsobject plus pre-renderedstatusLine.{min,med}(newsrc/status-line.ts: single canonical renderer —compactTokens, dual-source MAX cache-hit pattern mirrored read-only from the web sessions table, ledger net P&L vs local estimate with~mark, nudge growth/step from the kernel decision). min format:bili 11% 96k/869k · saved 1.7M · 35blk · cache 96%(≈60 chars; segments drop out individually when data is absent). Full detail unchanged —/acppanel /acp_statustool / web session page.ctx.ui.setStatus("billion-context", …)(keyed slot, other extensions untouched), refreshed onturn_end/agent_endand after compaction, cleared synchronously on session start (gen-counter guards an in-flight refresh from resurrecting a stale line after a mid-fetch session switch); hosts withoutui.setStatusdegrade silently.bili statuslineCLI (src/statusline.ts, dispatched fromcli.ts) written into the claude managed settings block asstatusLine: {type:"command", command:"<node> <root>/dist/index.js statusline", padding:0}. Origin resolution: explicit--origin/BILI_MCP_PROXY>ANTHROPIC_BASE_URLunwrap (kill switch honored) > claude lane sticky zone port > default 8787. Contract: NEVER fail claude — any error prints an empty line, exit 0. Installer writesstatusLineonly when absent or bili-owned (isOurStatusLinerequires the path separator so lookalikes stay foreign); uninstall removes only bili's entry; a user's ownstatusLinesurvives install AND uninstall./acp+acp_status+ web UI; web-only where there is no plugin/MCP seam).Deviation from the triage plan (reported per policy)
The Phase-2 "opencode transient toast" was NOT implemented: the opencode plugin API exposes
tui.toast.showsubscribe-side only — no verified emission API in the V1/V2 plugin context, and the 2.x API surface is explicitly version-unstable (CLIENTS.md caveats). Shipping an unverified emission call would be guesswork; opencode keeps its existing surfaces (/acp,acp_status, web deep link). dsh remains documented-only for the same closed-source reason.Config surface
Zero new config fields. No new config.json keys, no new BILI_* env vars, no new CLI flags beyond the
statuslinesubcommand itself (which reuses the existing--origin/BILI_MCP_PROXYoverride channel). The claude managed block gains one machine-owned key (statusLine) under the existing #964 never-clobber-user-config rules; the pi footer uses the host's existing keyed status-slot API. Considered alternatives (per-client rendering, new status config section) rejected: per-client formatting drift is exactly what this issue asks to eliminate, and a new section would collide with the existing compress/providers hierarchy without expressing anything they cannot.Behavior changes (old → new)
/__bili/plugin/statusresponse: purely ADDITIVE (stats,statusLine.*); every pre-existing field byte-identical, phase branches (pre-first-request / chain-advisory / 404) untouched. Existing consumers (web UI, /acp commands, MCP tools) unaffected.bili statusline(stdout = one line or empty; always exit 0).bili plugin install/remove claudenow manages astatusLinekey in~/.claude/settings.json— foreign values are reported-and-skipped, never overwritten; removal drops only bili's own entry.turn_end,agent_end) — inert on hosts that don't emit them; no change to any request-path behavior.Tests
New:
tests/status-line.test.ts(renderer: exact formats, min ≤ 60 chars, dual-source MAX, net vs estimate, negative net, nudge breakdown),tests/statusline.test.ts(origin resolution incl. kill switch, runStatusline against a fake proxy, real-spawn CLI smoke: payload→line, no-payload→empty stdout exit 0, dead proxy→empty exit 0), 2 pi footer tests (setStatus called with proxy-rendered min line, dedup, synchronous clear on session start, inert-safe without ui/old proxy), 5 claude managed-block tests (write/absent/refresh/foreign-untouched/strip-ours-only +isOurStatusLineshape matching).Pre-flight
npm run typecheck— cleannpm run build— success (dist/index.js carries the new module via cli.ts; no tsup entry change needed)node --import tsx --test tests/status-line.test.ts tests/statusline.test.ts tests/plugin-agent.test.ts tests/claude-native.test.ts): 126 pass / 0 fail / 8 skipped (skips = live e2e gates, as always)omp identity register failure throttles and retries later(tests/plugin-agent.test.ts:2066) FAILED 4/4 locally early in development but passed on the final run and also fails intermittently on a STASHED clean master baseline — it is a pre-existing timing-sensitive test (500 ms throttle window vs per-iteration latency on this loaded shared machine), not introduced by this diff. CI is the arbiter.