fix(agentrouter): support Claude and Codex protocols

This commit is contained in:
diegosouzapw
2026-08-01 12:18:09 -03:00
parent b38f3a4c02
commit 564c204efe
15 changed files with 286 additions and 69 deletions

View File

@@ -4,8 +4,8 @@
* Keep this leaf dependency-free so server executors, compatibility bridges,
* and client-facing identity presets can share one source of truth.
*/
export const CLAUDE_CODE_CLIENT_VERSION = "2.1.219";
export const CLAUDE_CODE_CLIENT_BUILD_REVISION = "250";
export const CLAUDE_CODE_CLIENT_VERSION = "2.1.220";
export const CLAUDE_CODE_CLIENT_BUILD_REVISION = "1f2";
export const CLAUDE_CODE_CLIENT_BILLING_VERSION = `${CLAUDE_CODE_CLIENT_VERSION}.${CLAUDE_CODE_CLIENT_BUILD_REVISION}`;
export const CLAUDE_CODE_SDK_PACKAGE_VERSION = "0.94.0";
export const CLAUDE_CODE_RUNTIME_VERSION = "v26.3.0";

View File

@@ -15,6 +15,7 @@
*/
import { getClaudeCodeUserAgent } from "./claudeCodeClient";
import { getCodexCliRsHeaders } from "./codexClient";
export interface ClientIdentityProfile {
readonly id: string;
@@ -40,10 +41,7 @@ const CLAUDE_CLI_PROFILE: ClientIdentityProfile = Object.freeze({
const CODEX_CLI_PROFILE: ClientIdentityProfile = Object.freeze({
id: "codex-cli",
label: "Codex CLI",
headers: Object.freeze({
"User-Agent": "codex_cli_rs/0.144.1",
originator: "codex_cli_rs",
}),
headers: Object.freeze(getCodexCliRsHeaders()),
});
const GEMINI_CLI_PROFILE: ClientIdentityProfile = Object.freeze({

View File

@@ -0,0 +1,11 @@
export const DEFAULT_CODEX_CLIENT_VERSION = "0.146.0";
export const CODEX_CLI_RS_ORIGINATOR = "codex_cli_rs";
export function getCodexCliRsHeaders(
version = DEFAULT_CODEX_CLIENT_VERSION
): Record<string, string> {
return {
"User-Agent": `${CODEX_CLI_RS_ORIGINATOR}/${version}`,
originator: CODEX_CLI_RS_ORIGINATOR,
};
}