feat(panel): optional localized labels for buildStatusPanel - #255
ranxianglei wants to merge 3 commits into
Conversation
📦 Built Package ArtifactBranch: Option A — Install from npm PR tag (recommended)In your adapter project: npm install acp-kernel@pr-255Each push to this PR publishes a new version under the Option B — Download artifact
tar xzf acp-kernel-pr255.tgz
npm install ./packageThis comment is automatically updated on each push. |
[bot] 🏷 Review started for PR #255 ( |
[bot] 🏷 Review complete — verdict: mergeable (merge itself is human-only per repo rules). What I verified independently (not just taken from the PR description)
Bug found & fixed directly on the PR branch (2 commits, pushed)Reproduced first:
Byte-identity re-verified after both commits. Both reviewers (me + independent agent, satisfying the 2-agent rule) verdict: mergeable, zero blockers/majors. Report-only findings (not blocking)
Ready for your merge when convenient: #255 中文摘要:修复了 labels 包中显式 undefined/null/未知键会冲掉英文默认值并导致渲染崩溃的问题(新增 resolvePanelLabels 归一化合并并补了回归测试),其余功能经双 agent 独立审查与逐字节差分验证均通过,可以合并。 |
Adds labels?: Partial<PanelLabels> to StatusPanelInput (per-key fallback to English defaults, display-only) plus exported helpers fill/displayWidth/padLabel/renderTitleBox. Default output stays byte-identical (verified by test). Prerequisite for ranxianglei/billion-context-pi#153.
A plain spread merge let an explicit undefined/null pack entry (e.g. from a config-driven language pack) blank out its English default and crash the display-width renderers with a TypeError. resolvePanelLabels() now copies only string entries over DEFAULT_PANEL_LABELS; exported from acp-kernel/panel.
resolvePanelLabels now ignores pack entries whose key is not part of PanelLabels (typo'd overrides from a runtime pack stay inert instead of leaking as stray properties on the resolved object), and the regression test pins number/String-object values and unknown keys to defaults.
f10f976 to
998f889
Compare
Problem
buildStatusPanelhardcodes every user-facing label in English. Adapters that want a localized /acp dashboard (ranxianglei/billion-context-pi#153) cannot translate the panel without patching kernel internals.Change
StatusPanelInputgains optionallabels?: Partial<PanelLabels>— 19 section-header keys (title, context, growth, sent, sentOfLimit, sessionOnly, breakdown, 5 category names, promptCache, nudgeActive/nudgeTierInfo/nudgeIdle, blocksHeader/blocksNone, tagVisibility), each substituting{placeholder}params.DEFAULT_PANEL_LABELS, exported). Omitlabelsentirely and output is byte-identical to before — verified by a dedicated test.acp-kernel/panel:DEFAULT_PANEL_LABELS,PanelLabels,fill,displayWidth,padLabel,renderTitleBox.fill()leaves unknown{placeholders}intact instead of crashing (typo in a pack stays visible).Verification
npm run typecheckclean;npm test678/678 pass (13 new tests: byte-identical default, legacy box verbatim, CJK box geometry, long-title widening, per-key fallback, full marker pack, idle nudge, sentOfLimit omission at limit=0, zero-active/none block branches, fill/pad/displayWidth units, key-list integrity);npm run buildOK.Release note
Additive only — safe for v0.0.65. Hosts not passing
labelssee zero behavior change (omp included). billion-context-pi P-B (language packs + config + detection chain) lands after this ships on npm.