Repository navigation
feat(wire): add wire-format detection and transform-channel policy - #84
Merged
Merged
Conversation
- acp-kernel/wire: WIRE_FORMATS + detectWireFormat classify a provider request body by the codec that can parse it (anthropic / openai / responses); undefined means the body is unparseable and must pass through untransformed. Detection semantics ported from the field-proven billion-context-omp bridge, extended with the responses input-array shape. - resolveTransformChannel: the shared channel-selection policy - an explicit preference always wins; the default is the wire channel only when the caller reports it viable (body parseable AND the host applies the payload replacement). Adapters decide surgery at message level vs wire level from kernel data instead of hard-coding per-host tables (see ranxianglei/billion-context-omp issue #79).
ranxianglei
force-pushed
the
2026-08-16_wire-format-detection
branch
from
August 16, 2026 11:27
c35a517 to
19e6043
Compare
Merged
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.
What
Two small, pure additions that let adapters stop hard-coding per-host tables:
acp-kernel/wire—WIRE_FORMATS/detectWireFormatClassify a provider request body by the codec that can parse it (
anthropic/openai/responses).undefinedmeans no codec handles the body — the caller must pass it through untransformed. Detection semantics are ported from the field-proven billion-context-omp wire bridge (issue #52/#66 lineage), extended with the responsesinputshape the kernel codec already supports but no detector covered.resolveTransformChannelThe shared channel-selection policy: an explicit preference always wins; the default is the wire channel only when the caller reports it viable (body parseable AND the host applies the payload replacement). Keeps the policy in one place as more adapters adopt wire-level surgery.
Both are host-agnostic (no pi-ai / omp / proxy imports), zero runtime dependencies, pure functions.
Context
ranxianglei/billion-context-ompissue #79: with provider-mode as the blanket default, models on APIs whose host drops the wire-payload replacement (openai-completions & friends) received no compression injections and never compressed. The omp-side fix (PR ranxianglei/billion-context-omp#80) resolves the channel per API; this PR moves the capability half of that decision — which wire bodies the kernel can actually parse — into the kernel so all consumers (omp, proxy, future hosts) query one source. The host-side root fix is can1357/oh-my-pi#8717.Verification
npm run typecheckcleannpm test— 348 pass / 0 fail (12 new: detection routing incl. anthropic/openai/responses markers, unknown-shape rejection, channel policy truth table)npm run buildclean