Repository navigation
feat: /acp-cache command for all clients with a command seam (#1146) - #1156
Conversation
📦 Built Package ArtifactBranch: Option A — Install from npm PR tag (recommended)npm install -g billion-context@pr-1156Each push to this PR publishes a new version under the Option B — Download artifact
tar xzf billion-context-pr1156.tgz
npm install -g packageInstall instructions are refreshed on each push. |
[bot] 🏷 Review 完成 —— 结论:验证通过,无回归,可合并(按规则我不执行合并,请你合并)。 一句话摘要:给 opencode V1/V2、dsh 双 lane、claude(模型中介 markdown 命令)补上 查重
分支与 CI
回归审查(diff 触碰路径的既有行为 → 逐项结论)
行为变化(old→new,均已在 PR body 披露,本次逐项复核属实)
测试覆盖6 个测试文件新增 +672 行:opencode-acp-command(V1 单测含 full-flag 矩阵与 strip-wrap 断言)、opencode-v2(注册/渲染/truncation/disabled/no-proxy)、dsh-acp(5 例)、dsh-native(session-bound forward/latest fallback/unreachable)、opencode-native-v1(legacy notice + no /acp fall-through)、claude-native(installer ownership round-trip ×3)。 判定diff 干净(15 文件全部与本目标相关,无空白 churn、无 lockfile/version 漂移),单 commit,门禁在当前 master 上全绿,未审出无意回归。按 §7.4 属 feat 且触及 wire-adjacent 消息形态与 installer 副作用,必须人工合并。 PR: #1156 —— 等你合并。 |
Register the human entry point to the acp_cache prompt-cache reconciliation report on every client that has a user-typable command surface, in both native mode and bili launcher mode: - pi/omp: already covered via the shared factory (/acp-cache [full]) - opencode V1 (launcher + native): /acp-cache [full] in createAcpCommandHooks; report rendered as an ignored message wrapped in [acp-cache] markers, which the proxy strips from model context by content signature before it reaches the wire - opencode V2: /acp-cache [full] via ctx.command.transform; rendered as a synthetic message (inert body, report in the visible description, 8 KB cap vs the 1 KB panel cap because the report tail is payload) - dsh (launcher-injected + native profile): session-bound acp_cache forward (initiator session id, latest-conversation fallback); default detail only - the dsh command API passes no arguments - legacy opencode-acp sessions (#920): explicit unavailable notice instead of a raw 404 (their traffic bypasses this proxy's compression state) - Claude Code: no in-process command API; bili plugin install claude now also writes <configdir>/commands/acp-cache.md (model-mediated markdown command driving the acp_cache MCP tool), content-owned install/remove never clobbers foreign files - codex/kimi/hermes: no user-typable command seam exists - documented, acp_cache remains reachable model-side via the bili MCP server
dbbe51d to
def6d9e
Compare
Registers the human
/acp-cacheentry point (prompt-cache reconciliation report — identical output to theacp_cachetool, added in #800) on every client that has a user-typable command surface, in both native mode and bili launcher mode.Per-client coverage
/acp-cache [full](shared factory, both modes)/acp-cache [full]viacreateAcpCommandHooks; report rendered as an ignored message wrapped in[acp-cache]/[/acp-cache], which the proxy strips from model context by content signature before it reaches the wire/acp-cache [full]viactx.command.transform; synthetic message — inert model-facing body, report in the visible description (8 KB cap)acp_cacheforward (initiator session id, latest-conversation fallback); default detail onlybili plugin install claudenow also writes<configdir>/commands/acp-cache.md— a model-mediated markdown command whose prompt drives theacp_cacheMCP tool and pastes the report back verbatimacp_cacheremains reachable model-side through the bili MCP serverBehavior changes (old → new)
/acp-cache. No existing command's behavior changed anywhere.[acp-cache]…[/acp-cache]markers. This reuses the 给出缓存精确对账,增加新的命令/acp-开头 #800 strip contract — the proxy removes whole messages matching that signature from model context, so the model never sees the report (same as pi'sbili-acp-cachesendMessage). Error texts are deliberately not wrapped (they stay visible to the model like/acperrors do).V2_SYNTHETIC_VISIBLE_MAX). Deliberate deviation: the report's tail (per-line deltas) is the payload, unlike the status panel where the head matters.fullflag — the dsh command API passes no arguments to handlers, so only the default summary ledger is available (documented in CONFIGURATION.md/zh-CN and the command description)./acp-cacheused to fall through to the raw forward and surface a confusing unknown-conversation error; now an explicit notice explains why (traffic bypasses this proxy's compression state) and suggests a new session.bili plugin install claude: new side effect — writes<configdir>/commands/acp-cache.md(CLAUDE_CONFIG_DIR-aware). Install never clobbers a foreign file (content-ownership check, same precedent as the codex config block); removal deletes only an exact-template match. Uninstall notes when a foreign file was left untouched.cacheOutcomehandlers catches network throws and renders the friendly "proxy not reachable" message instead of rejecting withTypeError: fetch failed. Pre-existing/acppaths are untouched.Out of scope / documented instead
codex, kimi, and hermes expose no user-typable custom-command mechanism (checked their extension surfaces: hooks/MCP/tools only). Forcing a seam there would mean product changes in those hosts — out of scope. Their users can ask the model to call the
acp_cachetool directly (already exposed via the bili MCP server). Documented in README + CONFIGURATION.md (+ zh-CN).Pre-flight (on rebased head, base e28fdfa)
npm run typecheck— passnpm test— 2271 tests, 2269 pass, 0 fail, 2 skipped (default-gated E2E)npm run build(tsup) — successNew regression coverage: tests/opencode-acp-command.test.ts (V1 unit suite, 7 cases incl. full-flag matrix and strip-wrapping assertion), opencode-v2 (registration/render/truncation/disabled/no-proxy), dsh-acp (5 cache cases), dsh-native (session-bound forward, latest fallback, unreachable), opencode-native-v1 (legacy notice, no acp fall-through), claude-native (installer ownership round-trip ×3).
Fixes #1146