Public declaration syntax from forge-rs/crates/forge-core/src/topology.rs Original source SHA-256: a5bbd2942098277eadddf50734585f7c51d95aa10c8fb38300aff87cc0a97acd Function bodies and constant values are omitted. This is not the complete implementation. Source line 67 pub const DEFAULT_ROLE: &str; Source line 84 #[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)] #[serde(rename_all = "snake_case")] pub enum CostPreference { /// Prefer the cheapest model that satisfies requirements. Minimize, /// Accept moderate cost for better quality. Balanced, /// Ignore cost; select the best model regardless of price. Ignore, } Source line 108 #[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)] #[serde(rename_all = "snake_case")] pub enum LatencyPreference { /// Prefer the lowest-latency model. Low, /// Accept moderate latency for better quality. Balanced, /// Ignore latency; select the best model regardless of response time. Tolerant, } Source line 147 #[derive(Debug, Clone, Serialize, Deserialize)] pub struct ModelSlot { /// The role name for this slot (e.g., "planner", "coder", "default"). /// /// Role names are freeform strings. The reserved name "default" designates /// the slot used when no routing decision applies. Every topology must /// have exactly one slot with role "default". pub role: String, /// Primary model for this slot. pub primary: ProviderRef, /// Ordered fallback models. Tried in sequence when the primary is /// unavailable or fails negotiation. #[serde(default)] pub fallbacks: Vec, /// Runtime capabilities required for this slot. The router validates /// that the selected model satisfies these before returning a route. #[serde(default)] pub required_capabilities: Vec, /// Optional cost preference for the router. #[serde(default, skip_serializing_if = "Option::is_none")] pub cost_preference: Option, /// Optional latency preference for the router. #[serde(default, skip_serializing_if = "Option::is_none")] pub latency_preference: Option, /// Optional Arsenal scope narrowing applied when this slot is selected. /// If set, the agent's ACT is intersected with these scopes before /// the model call. The intersection can only narrow, never widen. #[serde(default, skip_serializing_if = "Option::is_none")] pub arsenal_scope_narrowing: Option> } Source line 219 #[derive(Debug, Clone, Serialize, Deserialize)] pub struct ModelTopology { } Source line 257 pub fn single(provider_ref: ProviderRef) -> Self; Source line 290 pub fn builder() -> TopologyBuilder; Source line 298 pub fn name(&self) -> &str; Source line 303 pub fn default_role(&self) -> &str; Source line 313 pub fn default_slot(&self) -> &ModelSlot; Source line 388 pub fn slot_for_role(&self, role: &str) -> &ModelSlot; Source line 395 pub fn slots(&self) -> &BTreeMap; Source line 404 pub fn all_provider_refs(&self) -> Vec<&ProviderRef>; Source line 418 pub fn has_role(&self, role: &str) -> bool; Source line 423 pub fn slot_count(&self) -> usize; Source line 452 #[derive(Debug)] pub struct TopologyBuilder { } Source line 469 pub fn name(mut self, name: impl Into) -> Self; Source line 496 pub fn slot(mut self, role: impl Into, primary: ProviderRef) -> Self; Source line 525 pub fn with_fallback(mut self, role: impl AsRef, fallback: ProviderRef) -> Self; Source line 544 pub fn with_required_capability( mut self, role: impl AsRef, cap: RuntimeCapability, ) -> Self; Source line 567 pub fn with_cost_preference(mut self, role: impl AsRef, pref: CostPreference) -> Self; Source line 586 pub fn with_latency_preference( mut self, role: impl AsRef, pref: LatencyPreference, ) -> Self; Source line 609 pub fn with_scope_narrowing(mut self, role: impl AsRef, scopes: Vec) -> Self; Source line 653 pub fn build(self) -> ForgeResult;