fix: register /acp-cache command in the pi/omp thin plugin (#800) - #974
Conversation
📦 Built Package ArtifactBranch: Option A — Install from npm PR tag (recommended)npm install -g billion-context@pr-974Each push to this PR publishes a new version under the Option B — Download artifact
tar xzf billion-context-pr974.tgz
npm install -g packageInstall instructions are refreshed on each push. |
The cache-reconciliation feature shipped the model-side acp_cache tool
(manifest + wire) but never gave humans a command in the shared thin
plugin factory — so /acp-cache existed only in billion-context-pi
(unreleased), not in `bili pi` launcher mode or pi native mode.
- src/agent/pi.ts: registerCommand("acp-cache") next to /acp — forwards
acp_cache to the proxy (identical report on both sides), renders it as a
persistent custom message (customType bili-acp-cache), notify() fallback.
One registration covers launcher mode + native mode (pi-native.ts loads
the same factory) + omp. The #788 no-proxy warning is extracted into a
shared helper, wording unchanged.
- src/acp-panel.ts: wrapCacheReport() markers ([acp-cache] ... [/acp-cache])
+ isAcpPanelText recognition, so the persistent report is stripped from
model context like the /acp panel (whole-message match discipline; an
unwrapped report — e.g. one the model produced via the acp_cache tool —
is preserved).
- CONFIGURATION.md/.zh-CN.md: pi/omp launcher lines mention the new command.
- tests: strip signature cases (wrapped/unwrapped/suffix/whitespace/quote,
messages + responses shapes) and handler paths (forwarding, sendMessage,
raw notify fallback, no-proxy warning, proxy error).
Part of #800
0480651 to
224e81e
Compare
[bot] 🏷 Review complete — rebased onto current master, everything green, ready for a human merge. What I did
Code review findings (all claims verified against the tree)
One minor note (non-blocking): the marker-based predicate means a hand-typed message whose entire trimmed content starts with Per §7.4 this stays a human merge (wire/message-shape change — the strip predicate affects both modes' request pipeline). Nothing left for me to fix here. 中文摘要:已把分支 rebase 到最新 master(#973 之后)并重新跑完全部验证(typecheck/测试 1920 通过/构建/CI 8 项全绿),代码审查确认双端同走 handleAcpCache、三处剥离点全覆盖、整消息匹配纪律保持,无阻塞问题,可以合并。 |
What & why
Follow-up report on #800:
/acp-cacheworked for the model (theacp_cachetool) but not for humans in launcher mode (bili pi) or native mode (barepiwith the plugin installed) — the command was only ever built into billion-context-pi#449 (merged, unreleased), never into this repo's shared thin-plugin factory.Root cause:
createBiliPlugin()(src/agent/pi.ts) — which serves launcher mode AND native mode (src/agent/pi-native.tsloads the same factory) AND omp — registers the ACP tools from the proxy manifest (incl.acp_cache) but registered only the/acpcommand. No human entry point existed.Changes
src/agent/pi.ts: register/acp-cachenext to/acp. It forwardsacp_cacheover the existing/__bili/plugin/toolendpoint → identical report text on both sides (both paths hithandleAcpCache). Rendered as a persistent custom message (customType: bili-acp-cache, visible in TUI + pi-web) withui.notify()fallback for hosts withoutsendMessage. The pi plugin:bili plugin install pisilently drops thenpm:billion-context-pientry; /acp "no proxy detected" warning misleads non-proxy users #788 no-proxy warning wording is extracted into a shared helper (byte-identical strings, existing tests untouched).src/acp-panel.ts:wrapCacheReport()wraps the report in[acp-cache]…[/acp-cache]markers;isAcpPanelTextrecognizes them so the proxy strips the persisted report from model context like the/acppanel — at all three strip call sites (anthropic/openai messages + responses input). Whole-message-match discipline preserved: only the WRAPPED form is stripped; an unwrapped report (e.g. one the model produced via theacp_cachetool, or typed by a user) survives. Explicit markers were chosen because the report shape is kernel-owned and variable-length (LINE ITEMS table up to the 512-line sample cap) — anchoring on it would couple the strip predicate to acp-kernel renderer output.CONFIGURATION.md/CONFIGURATION.zh-CN.md: pi/omp launcher lines mention the new command (en/zh kept in sync).Out of scope (follow-ups, reported in #800)
/acp-cacheneeds a small proxy-side addition — separate change.acp_status/acp_cachetools).Pre-flight (base = current master b6c2ef3)
npm run typecheck— cleannpm test— 1910 pass / 0 fail (2 skipped = e2e gate)npm run build— success; verifieddist/agent/pi.jscontains theacp-cacheregistration + wrapper markersPart of #800