Repository navigation
feat: content-addressed message store + acp_retrieve (built-in CCR) - #1099
Conversation
📦 Built Package ArtifactBranch: Option A — Install from npm PR tag (recommended)npm install -g billion-context@pr-1099Each push to this PR publishes a new version under the Option B — Download artifact
tar xzf billion-context-pr1099.tgz
npm install -g packageInstall instructions are refreshed on each push. |
PR #1099 review: on the responses text/marker protocol (route compressProtocol 'marker' or ACP_COMPRESS_PROTOCOL=text) only the readonly ACP tools are declared and the text-trigger parser knows no acp_retrieve trigger; ACP_NO_INJECT_TOOL disables all injection on that wire. applyStoreView still emitted placeholders there — unretrievable by construction, i.e. the silent loss #1097 explicitly guards against everywhere else. Gate the policy stamping site (single source for all four prepare fns + plugin-tool path + acp_status) on channel availability, mirroring how absorb/rules strip themselves in text mode. Adds tests/store-marker-gate.test.ts (marker wire keeps the original verbatim; native-tool wire emits placeholder + declaration — fails on unfixed code). Also documents compress.store.{enabled,minTokens,maxStoreBytes} + BILI_STORE_DIR in CONFIGURATION/README (en+zh) and normalizes a mis-indent introduced at the stamping site.
Review complete. Pre-flight verified locally at the PR head (typecheck clean, One real bug found — fixed directly on the branch (commit
Fix: the policy-stamping site in Minor findings (report-only, non-blocking):
Post-fix pre-flight: typecheck clean, 修复了内容存储在 responses marker/文本协议及 |
|
冲突 |
PR #1099 review: on the responses text/marker protocol (route compressProtocol 'marker' or ACP_COMPRESS_PROTOCOL=text) only the readonly ACP tools are declared and the text-trigger parser knows no acp_retrieve trigger; ACP_NO_INJECT_TOOL disables all injection on that wire. applyStoreView still emitted placeholders there — unretrievable by construction, i.e. the silent loss #1097 explicitly guards against everywhere else. Gate the policy stamping site (single source for all four prepare fns + plugin-tool path + acp_status) on channel availability, mirroring how absorb/rules strip themselves in text mode. Adds tests/store-marker-gate.test.ts (marker wire keeps the original verbatim; native-tool wire emits placeholder + declaration — fails on unfixed code). Also documents compress.store.{enabled,minTokens,maxStoreBytes} + BILI_STORE_DIR in CONFIGURATION/README (en+zh) and normalizes a mis-indent introduced at the stamping site.
329c636 to
aa30a8c
Compare
[bot] 🏷 冲突已解决 — 分支已 rebase 到当前 master ( What conflicted and how it was resolved (master had advanced ~88 commits since the PR's old base: session-GC feature #1082, zcode lanes #1145/#1157/#1164, acp-kernel → 0.0.84 (#1175), #1080 encryption/zstd split):
Post-rebase pre-flight on head
One process note for transparency: direct git push was failing on a TLS transport error in this environment, so I updated the branch through GitHub's Git Data API instead — each recreated commit's tree was verified byte-identical to the local one before the ref update (that's why all three commit SHAs match the local rebase exactly). CI is currently running on the new head (zero-token e2e + version-guard already green, remaining test/build jobs in progress). Merge stays with you once checks land. 中文摘要:把 PR 分支 rebase 到了最新 master,冲突均为文档新增段落的叠加(保留双方内容、server.ts 自动合并无损),rebase 后 typecheck/2325 项测试/构建全部通过,可以等 CI 绿了合并。 |
…1097) Oversized tool results (>= minTokens, within the per-session budget) are now ID-referenced at arrival in proxy mode: the wire keeps a byte-stable, deterministic placeholder carrying ref/tool/size/head-preview metadata, and the original goes into a per-session content store (hash-keyed sidecar files, index persisted alongside blockContents), retrievable via an injected acp_retrieve tool on all four wires. Lossless by default: a retrieve not made costs one cheap tool call; a detail distilled away is gone for good. - store.* config (enabled/minTokens/maxStoreBytes): three-level merge, default off - file-backed lazy load: index = metadata only in session JSON; payloads in storeDir()/<sha256(id)>/<sha1(text)>, deduped by content hash, codec-aware (AES-256-GCM parity with session JSON when BILI_ENCRYPTION_KEY is set) - retrieve-rate + wire byte-savings surfaced in acp_status; per-retrieve log line - v1 gate is proxy-mode only (plugin mode needs acp_retrieve in its manifest) - reversible-absorb (the digest half) deferred to a follow-up
PR #1099 review: on the responses text/marker protocol (route compressProtocol 'marker' or ACP_COMPRESS_PROTOCOL=text) only the readonly ACP tools are declared and the text-trigger parser knows no acp_retrieve trigger; ACP_NO_INJECT_TOOL disables all injection on that wire. applyStoreView still emitted placeholders there — unretrievable by construction, i.e. the silent loss #1097 explicitly guards against everywhere else. Gate the policy stamping site (single source for all four prepare fns + plugin-tool path + acp_status) on channel availability, mirroring how absorb/rules strip themselves in text mode. Adds tests/store-marker-gate.test.ts (marker wire keeps the original verbatim; native-tool wire emits placeholder + declaration — fails on unfixed code). Also documents compress.store.{enabled,minTokens,maxStoreBytes} + BILI_STORE_DIR in CONFIGURATION/README (en+zh) and normalizes a mis-indent introduced at the stamping site.
…l retrievable (#1097) The v1 content-addressed store already keeps oversized tool results lossless by default. This makes the two fidelities explicit so the model can pick gist-or-full: the wire placeholder now states that summarizing is reversible (the original persists under the same ref), and a regression test proves absorb (a model-written digest) and acp_retrieve (the full original) coexist under one ref. Pure composition of the existing store + absorb — no new tool, no model-call path.
aa30a8c to
41a9c67
Compare
[bot] 🏷 CI 全绿 ✅ — rebase 后的 head 中文摘要:冲突已解决(rebase 到最新 master,文档叠加、server.ts 自动合并无损),CI 8/8 全绿,可以合并。 |
Rework complete — kernel-native CCR (acp-kernel 0.0.84)Branch rebased onto
Pre-flight: typecheck clean · 2295 tests (2293 pass, 2 skipped E2E gates) · build ok. CI on 41a9c67: all 8 checks green. Known open items (documented, non-blocking):
Refs #1097. Full dev report: kernel API findings (injection role |
The rework onto acp-kernel 0.0.84 changed the config surface from the v1
host-side compress.store.{minTokens,maxStoreBytes} + BILI_STORE_DIR sidecars
to compress.ccr.{minToolTokens,excludeTools,toolName,maxHeadChars} with a
single .content-store.json envelope next to the session JSON, but the doc
sections still described the removed API — an operator following them would
set keys that silently keep the feature off. Rewrite both CONFIGURATION
sections and both README paragraphs to the implemented surface (kernel
defaults 4000/96, [acp-stored] placeholder format, no eviction yet), and
normalize one mis-indented comment line in server.ts.
[bot] 🏷 Re-reviewed the reworked branch (head Verdict: sound rework. The kernel-native split is the right shape — host keeps config mapping (
Fixed directly on the branch (commit
Pre-flight on the pushed head: typecheck clean · 2327 pass / 0 fail / 2 skipped · build ok. CI on Your three open items are all reasonable deferrals — (1) 重审了重构后的内核原生 CCR 实现(架构、持久化与回归检查均通过),修复了文档仍描述已删除的 v1 |
[bot] 🏷 CI update on CI 已全部转绿(8/8),分支可以合并,合并操作按仓库规范由你执行。 |
…xianglei#1097) PR ranxianglei#1099 review: on the responses text/marker protocol (route compressProtocol 'marker' or ACP_COMPRESS_PROTOCOL=text) only the readonly ACP tools are declared and the text-trigger parser knows no acp_retrieve trigger; ACP_NO_INJECT_TOOL disables all injection on that wire. applyStoreView still emitted placeholders there — unretrievable by construction, i.e. the silent loss ranxianglei#1097 explicitly guards against everywhere else. Gate the policy stamping site (single source for all four prepare fns + plugin-tool path + acp_status) on channel availability, mirroring how absorb/rules strip themselves in text mode. Adds tests/store-marker-gate.test.ts (marker wire keeps the original verbatim; native-tool wire emits placeholder + declaration — fails on unfixed code). Also documents compress.store.{enabled,minTokens,maxStoreBytes} + BILI_STORE_DIR in CONFIGURATION/README (en+zh) and normalizes a mis-indent introduced at the stamping site.
What
v1 of the content-addressed message store (built-in CCR): oversized tool results become ID-referenced at arrival instead of force-distilled. The wire keeps a byte-stable placeholder (
📦 [stored #m00423 · shell · 4213 tok] … → acp_retrieve("m00423")) and the original goes into a per-session content store, retrievable on demand. Lossless by default — a retrieve not made costs one cheap tool call; a detail distilled away is gone for good.Design
blockContents; payloads live in hash-keyed sidecar files understoreDir()(<sha256(id)>/<sha1(text)>.txt), deduped by content hash, lazy-read on retrieve. Sidecars are codec-aware — AES-256-GCM parity with the session file whenBILI_ENCRYPTION_KEYis set.toolresult shrinks; pairing with the assistanttool_callsis untouched (covered by tests).compress.store.{enabled,minTokens,maxStoreBytes}, three-level merge, default off.acp_status; each retrieve logs a[store] retrieve …line.acp_retrieveregistered in the agent's plugin manifest before a placeholder can be emitted (otherwise silent loss) — deferred.Out of scope (tracked separately, per the issue's phasing)
decompress,search_contextreturning IDs.image_fullreframed as retrieve over this store — depends on Feature: image pre-compression for screenshot-heavy tool results (resize/quality routing) #1095.Pre-flight
npm run typecheck— cleannpm test— 2168 pass / 0 fail / 2 skipped (6 new intests/store.test.ts)npm run build— tsup successtests/e2e/e2e-codex.test.ts): not runnable in the agent sandbox (local upstream127.0.0.1:8199unreachable — preflight confirmed codex CLI 0.147.0 + dist present). The change is dormant by default (compress.store.enabled=false⇒ no-op wire path), so the default path is byte-identical to master and covered by the unit suite; live E2E is available via manual CI dispatch if you want it before merge.Addresses #1097 (v1).