Files
OmniRoute/open-sse/services/ccWireImageBuiltins.ts
Diego Rodrigues de Sa e Souza 5531fc7f05 feat(providers): route built-in agentrouter through dynamic CC wire image (#6056) (#6255)
feat(providers): route built-in agentrouter through dynamic CC wire image (#6056). TDD-covered (agentrouter-cc-wire-image.test.ts). Base-reds only. Integrated into release/v3.8.45.
2026-07-05 07:41:15 -03:00

27 lines
1.2 KiB
TypeScript

/**
* Built-in provider ids that must adopt the dynamic Claude-Code wire image
* (fingerprint headers/order + system transforms + `?beta=true` chat path)
* WITHOUT inheriting the Claude-Code-Compatible family's default anthropic
* baseUrl / Bearer auth.
*
* These providers keep their own registry `baseUrl` and auth scheme
* (e.g. `agentrouter` → `https://agentrouter.org/v1/messages` + `x-api-key`),
* while the two CC predicates (`isClaudeCodeCompatible` /
* `isClaudeCodeCompatibleProvider`) and `applyFingerprint` treat them as CC
* for the wire-image concerns only. The CC-baseUrl / CC-Bearer branches in
* `buildProviderUrl` / `buildProviderHeaders` are guarded so the registry
* baseUrl + auth are preserved.
*
* Single source of truth — imported by both predicates so they never diverge.
* See issue #6056.
*/
export const CC_WIRE_IMAGE_BUILTINS: ReadonlySet<string> = new Set(["agentrouter"]);
/**
* True when `provider` is a built-in that adopts the dynamic Claude-Code wire
* image while keeping its own registry baseUrl + auth.
*/
export function usesCcWireImage(provider: unknown): boolean {
return typeof provider === "string" && CC_WIRE_IMAGE_BUILTINS.has(provider);
}