Skip to main content

inferlab_proxy/
registry.rs

1//! The registry of built-in proxy implementations
2//! ([[RFC-0006:C-INTEGRATIONS]]): one entry per control-plane-rendered
3//! frontend, binding the plan-declaration wire name, the internal CLI
4//! subcommand spelling, the proxy-kind behavior identity, and the
5//! proxy-owned version and route facts to a single table so consumers never
6//! restate them.
7
8use crate::{sglang, trtllm, vllm_mooncake, vllm_nixl};
9
10/// Behavioral identity of a built-in proxy implementation. The control plane
11/// selects per-proxy CLI argument shapes from the kind.
12#[derive(Clone, Copy, Debug, Eq, PartialEq)]
13pub enum BuiltinProxyKind {
14    VllmMooncake,
15    VllmNixl,
16    Sglang,
17    Trtllm,
18}
19
20/// One built-in proxy implementation's identity and proxy-owned facts.
21pub struct BuiltinProxySpec {
22    pub kind: BuiltinProxyKind,
23    /// The plan-declaration vocabulary: the frontend `implementation` value an
24    /// adapter returns on the wire.
25    pub wire_name: &'static str,
26    pub command_name: &'static str,
27    /// Implementation version the proxy owns; the control plane rejects
28    /// adapter declarations whose `implementation_version` disagrees.
29    pub version: u32,
30    pub healthcheck_path: &'static str,
31    pub reset_prefix_cache_path: Option<&'static str>,
32    pub prime_prefix_cache_path: Option<&'static str>,
33    pub completions_path: &'static str,
34    pub chat_completions_path: &'static str,
35}
36
37pub const VLLM_MOONCAKE: BuiltinProxySpec = BuiltinProxySpec {
38    kind: BuiltinProxyKind::VllmMooncake,
39    wire_name: "vllm_mooncake",
40    command_name: "vllm-mooncake",
41    version: vllm_mooncake::VERSION,
42    healthcheck_path: vllm_mooncake::HEALTHCHECK_PATH,
43    reset_prefix_cache_path: Some(vllm_mooncake::RESET_PREFIX_CACHE_PATH),
44    prime_prefix_cache_path: Some(vllm_mooncake::PRIME_PREFIX_CACHE_PATH),
45    completions_path: vllm_mooncake::COMPLETIONS_PATH,
46    chat_completions_path: vllm_mooncake::CHAT_COMPLETIONS_PATH,
47};
48
49pub const VLLM_NIXL: BuiltinProxySpec = BuiltinProxySpec {
50    kind: BuiltinProxyKind::VllmNixl,
51    wire_name: "vllm_nixl",
52    command_name: "vllm-nixl",
53    version: vllm_nixl::VERSION,
54    healthcheck_path: vllm_nixl::HEALTHCHECK_PATH,
55    reset_prefix_cache_path: Some(vllm_nixl::RESET_PREFIX_CACHE_PATH),
56    prime_prefix_cache_path: Some(vllm_nixl::PRIME_PREFIX_CACHE_PATH),
57    completions_path: vllm_nixl::COMPLETIONS_PATH,
58    chat_completions_path: vllm_nixl::CHAT_COMPLETIONS_PATH,
59};
60
61pub const SGLANG: BuiltinProxySpec = BuiltinProxySpec {
62    kind: BuiltinProxyKind::Sglang,
63    wire_name: "sglang",
64    command_name: "sglang",
65    version: sglang::VERSION,
66    healthcheck_path: sglang::HEALTHCHECK_PATH,
67    reset_prefix_cache_path: Some(sglang::RESET_PREFIX_CACHE_PATH),
68    prime_prefix_cache_path: Some(sglang::PRIME_PREFIX_CACHE_PATH),
69    completions_path: sglang::COMPLETIONS_PATH,
70    chat_completions_path: sglang::CHAT_COMPLETIONS_PATH,
71};
72
73pub const TRTLLM: BuiltinProxySpec = BuiltinProxySpec {
74    kind: BuiltinProxyKind::Trtllm,
75    wire_name: "trtllm",
76    command_name: "trtllm",
77    version: trtllm::VERSION,
78    healthcheck_path: trtllm::HEALTHCHECK_PATH,
79    reset_prefix_cache_path: None,
80    prime_prefix_cache_path: None,
81    completions_path: trtllm::COMPLETIONS_PATH,
82    chat_completions_path: trtllm::CHAT_COMPLETIONS_PATH,
83};
84
85pub const BUILTIN_PROXIES: &[BuiltinProxySpec] = &[VLLM_MOONCAKE, VLLM_NIXL, SGLANG, TRTLLM];
86
87pub fn builtin_proxy_by_wire_name(name: &str) -> Option<&'static BuiltinProxySpec> {
88    BUILTIN_PROXIES.iter().find(|spec| spec.wire_name == name)
89}