@juspay/neurolink
Version:
The pipe layer of an AI nervous system: one interface connecting provider neurons to your application, across three inference types — generate, stream and decide. `decide` returns typed, calibrated judgements from a non-generative model (~400ms, ~$0.00002
22 lines (21 loc) • 1.16 kB
JavaScript
/**
* Wire-neutral intermediate representation for proxy protocol translation.
*
* Translation between provider wire formats was previously pairwise and ad hoc:
* `codexFallback.ts` converts an Anthropic request into a Codex one and casts a
* role to reach Claude Code's inline-system convention inside a converter that is
* meant to be neutral. Adding the reverse direction pairwise would double that,
* and a third provider would square it.
*
* So each format gets a codec to and from this IR, and adding a provider is a new
* codec rather than new branching. The IR is deliberately not `ClaudeRequest`:
* that type is simultaneously the literal Anthropic wire shape, so using it as
* the hub makes every other provider's quirks leak into the Anthropic hot path.
* `ClaudeRequest` and `ClaudeResponse` stay untouched.
*
* Every union here is discriminated on a literal `kind`, `status` or `source`, so
* `assertProxyIRExhaustive` turns an unhandled variant into a compile error. That
* is the point of the IR: a field that cannot be represented must be stated, via
* `ProxyIRUnmappedPart`, rather than dropped silently.
*/
export {};