Repository navigation
fix: emit /acp panel as persistent custom message and strip it from the proxy model context (#359) - #360
Conversation
📦 Built Package ArtifactBranch: Option A — Install from npm PR tag (recommended)npm install -g billion-context@pr-360Each push to this PR publishes a new version under the Option B — Download artifact
tar xzf billion-context-pr360.tgz
npm install -g packageThis comment is automatically updated on each push. |
[bot] Reviewed PR #360 ( Local verification (ran on the branch):
Cross-check against the real pi API (earendil-works/pi):
Minor notes (non-blocking):
Residual risk, for the record: the content-signature strip assumes pi projects custom-message content verbatim as the user message text (no prefix/marker). If a future pi version wraps it, the strip silently stops matching and the panel leaks to the model context. The two pinned signatures (real |
e6e2da2 to
3273a9c
Compare
|
冲突了 另外为啥新搞了一个acp panel? |
e9d7136 to
2e5898f
Compare
[bot] 🏷 两件事都处理了: 1. 冲突已解决 — rebase 到最新 master(v0.1.78,
2. 为什么单独搞了个
如果你更希望它并进 |
[bot] 🏷 更正上一条里的笔误:测试文件就是 |
|
又冲突了 麻烦解决下吧 |
2e5898f to
3befcbb
Compare
[bot] 🏷 又解决了:rebase 到最新 master(v0.1.84, 这次 master 侧动到了 PR 的三个文件(v0.1.78→v0.1.84 之间 ~30 个 merge),实际冲突只有一处:
rebase 后 pre-flight: 这个仓库现在基本每小时都有 release 落 master,合并前如果又冲突了喊我一声就行(或者我可以在你准备 merge 前再 rebase 一次保证干净)。E2E 老话重提:我这边没有本地 upstream 跑不了 e2e-codex,建议合并前走 manual-dispatch CI e2e。 |
…he proxy model context (#359) The pi plugin's /acp command rendered the status panel through ctx.ui.notify(), which web hosts like agegr/pi-web show as a transient toast instead of a persistent transcript entry (same class as billion-context-pi#255). Two-part fix: 1. Plugin (src/agent/pi.ts): /acp now emits pi.sendMessage({ customType: "bili-acp-status", content, display: true }) when sendMessage is available, falling back to ctx.ui.notify() for older pi. 2. Proxy (src/acp-panel.ts + the three prepare paths): strip panel user-messages from the request before the *ToCore conversion, so the panel never enters the compression state / recent zone and is never forwarded to the model. pi's convertToLlm projects every custom message as an ordinary user message and drops the customType, so the proxy matches its own content signature (the buildStatusPanel box or the renderAcpStatus fallback header) instead of the type. A plugin-only port would leak every panel into the model's context; the proxy-side strip is what makes the persistent custom message safe.
|
rebase 到当前 master(1502287,含 #540 reasoning_content + #542 SSE decoder + #543 内容落地),force-push a8c78a1。 本次唯一冲突仍是 预检:typecheck 干净;build 成功; |
3befcbb to
a8c78a1
Compare
[bot] 🏷 收到,我独立复核了一遍(不直接采信报告,对仓库实际状态做了验证):
合并前剩两件事:① CI checks 转绿;② 建议跑一次 manual-dispatch CI e2e(e2e-codex;我这边没有本地 upstream 跑不了,strip 对 codex 请求是 no-op 但这是 AGENTS.md 对 server.ts 改动的要求)。都齐了就可以 merge。 |
…hemeral range flake)
|
CI 之前那颗失败是既有 Windows 老鼠屎,与 PR 内容无关: 现在 6/6 全绿(ubuntu 22/24 + windows 22/24 + build-artifact + version-guard),可合并。 |
What
The pi plugin's
/acpcommand rendered the status panel throughctx.ui.notify(), which web hosts likeagegr/pi-webshow as a transient toast instead of a persistent transcript entry (same class as billion-context-pi#255, fixed there in PR #256).This is a two-part fix — a plugin-only port is not safe in proxy mode:
1. Plugin (
src/agent/pi.ts)/acpnow emitspi.sendMessage({ customType: "bili-acp-status", content, display: true })whensendMessageis available, falling back toctx.ui.notify()for older pi.sendMessageproduces a persistentcustom_messagesession entry that TUI and web hosts render in the transcript.2. Proxy (
src/acp-panel.ts+ the three prepare paths)Strip panel user-messages from the request before the
*ToCoreconversion, so the panel never enters the compression state / recent zone and is never forwarded to the model.Why the proxy side is required: in extension mode (billion-context-pi) the ACP transform runs inside pi and filters
acp-statuspanels out of the sent view bycustomType. In proxy mode pi'sconvertToLlmprojects every custom message as an ordinary user message and drops thecustomType— so the panel arrives as indistinguishable real conversation content and would sit in the recent zone, forwarded to the model on every turn. The proxy generates the panel itself (handlePluginStatus→buildStatusPanel), so it matches its own content signature (thebuildStatusPanelbox —╭border +ACP Context Analysistitle — or the plugin'srenderAcpStatusfallback header📊 ACP status) rather than the type. Applied inprepareAnthropic/prepareOpenai/prepareResponses.Files
src/acp-panel.ts(new):isAcpPanelText+stripAcpPanelMessages/stripAcpPanelResponsesInput. Plain-text-only matching — mixed/multimodal, assistant, and function-call items are never touched; a message that merely quotes a panel is preserved.src/server.ts: strip calls wired into the three prepare paths (before projection) + import.src/agent/pi.ts:sendMessageonExtensionAPI+/acphandler uses it withnotifyfallback.tests/acp-panel.test.ts(new): 10 tests against the realbuildStatusPaneloutput + fallback + edge cases.tests/plugin-agent.test.ts: 3 tests for thesendMessagepath (panel string,renderAcpStatusfallback,sendMessagethrows →notify).Pre-flight
npm run typecheck— cleannpm test— 842 pass, 0 failnpm run build— successCloses #359.