feat(compress): opt-in wire-level strip of historical image payloads (closes #321) - #324
Open
ranxianglei wants to merge 2 commits into
Open
feat(compress): opt-in wire-level strip of historical image payloads (closes #321)#324ranxianglei wants to merge 2 commits into
ranxianglei wants to merge 2 commits into
Conversation
📦 Built Extension ArtifactBranch: Option A — Install from npm PR tag (recommended)pi install npm:billion-context-pi@pr-324Each push to this PR publishes a new version under the Option B — Download artifact
tar xzf billion-context-pi-pr324.tgz
pi install ./packageThis comment is automatically updated on each push. |
added 2 commits
September 7, 2026 22:37
…loses #321) compress.stripImages (default off) + compress.stripImagesKeepRecent (default 5), three-level deepest-wins merge. Hooks pi's before_provider_request (post-serialization, pre-HTTP) and calls acp-kernel stripHistoricalImages (>= 0.0.58). Protocol mapping: anthropic-messages / openai-completions / openai-responses (+azure/codex); unknown APIs untouched; stands down under the bili proxy; identity ref when nothing to strip.
ranxianglei
force-pushed
the
2026-09-07_issue321-strip-historical-images
branch
from
September 7, 2026 16:41
8fcbf56 to
decb5d0
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
概要
接入 acp-kernel 0.0.58 的
stripHistoricalImages(kernel #215,源自 billion-context#617):图像字节随每个上游请求逐字重发——codec 把图像移出 CoreMessage.text 到边车,压缩折叠了文本也照样转发原图。开启后历史图像载荷在上游请求体中被剥离。设计(对齐 billion-context 宿主侧约定)
compress.stripImages(默认关)+compress.stripImagesKeepRecent(默认 5),global/provider/model 三级最深优先合并before_provider_request钩子(pi-ai 在 HTTP 前以已解析的请求体对象触发onPayload,返回非 undefined 即整体替换 payload)——与 billion-context 代理同一 wire 点;纯函数改写原始 body"[image]"文本占位符,消息数/角色序稳定;无事可剥返回原引用(零重序列化)runtime.refused/ baseUrl 检测)时跳过——代理拥有 wire,扩展不碰注意事项(文档已注明)
测试(对已发布的 acp-kernel 0.0.58,
npm ci按 lockfile 安装)tsc --noEmit✅tests/strip-images.test.ts8 例:协议映射矩阵 / 禁用与未知协议 no-op / anthropic 剥离+近期保留 / openaiimage_url+ responsesinput_image占位折叠 / 三级配置合并 / e2e(开启剥离、默认关不动、代理 baseUrl 让位)acp-kernel/wire子路径已内联进 dist,零运行时依赖不变)分支说明(ework-daemon 复核后 force-push)
原分支 base 停在 #323(issue #322 in-memory state 修复)合入之前,直接开 PR 会回退 #322 的修复(state.ts cache 更新 + 两个测试文件约 90 行)。已将 feature 提交与 pin-bump 提交原样 cherry-pick 到当前 master(f2c5924)之上并 force-push 本分支(pin-bump 提交信息里的旧版本号笔误 0.0.57 已更正为实际值 0.0.56);上述验证均在重基后的分支上完成。
Fixes #321
关联:billion-context#617、billion-context#618、acp-kernel#215、acp-kernel#218