Switchyard lets LLM applications route traffic across models and providers while preserving native OpenAI and Anthropic API compatibility - enabling flexible model selection, benchmarking, and cost/performance optimization.
Rust
docs(libsy): fix rustdoc intra-doc links, name Context fields (#163)
Elyas Mehtabuddina6c79ff9cb5d
diff --git a/crates/libsy/README.md b/crates/libsy/README.mdindex fd5f001f2..87c3a2aa9 100644--- a/crates/libsy/README.md+++ b/crates/libsy/README.md@@ -325,5 +325,5 @@ agents live in [`examples`](examples/) folder.## Not yet built- **`Signals` events** — `process_signals` / `Signals` exist but carry nothing yet.-- **`Context` fields** — carries the algorithm telemetry label today; correlation ids, budgets, and deadlines still to come.+- **`Context` fields** — `values: HashMap<String, String>` carries the algorithm telemetry label and `state: S` the caller's per-session state; correlation ids, budgets, and deadlines still to come.- **Config-driven construction**.diff --git a/crates/libsy/src/algorithms/fall_through.rs b/crates/libsy/src/algorithms/fall_through.rsindex 40c302a04..1d8de108c 100644--- a/crates/libsy/src/algorithms/fall_through.rs+++ b/crates/libsy/src/algorithms/fall_through.rs@@ -4,13 +4,13 @@//! Fall-through classifier routing: a stateful [`Algorithm`] that routes each turn//! through a processor chain and a classifier cascade.//!-//! Each turn: request-side [`Processor`]s fold facts into the session [`State`]; the+//! Each turn: request-side [`Processor`]s fold facts into the session [`State`](crate::State); the//! [`Classifier`] cascade is consulted in order and the first to score decides the target//! (its `argmax`); the [`Decision`] is published and then replayed to the processors so//! stateful ones (latch, affinity) can bind it.//!//! [`FallThrough`] itself is stateless — one shared instance serves every session. The-//! per-session [`State`] rides in the threaded [`Context<SharedState>`] the caller passes into+//! per-session [`State`](crate::State) rides in the threaded [`Context<SharedState>`] the caller passes into//! each turn, so routing can depend on accumulated history rather than the current request//! alone. The state is held under a lock, so concurrent turns of the same session serialize//! on it.@@ -46,7 +46,7 @@ impl Decision for FallThroughDecision {/// Processor chain → classifier cascade → routed model call. See the [module docs](self).///-/// Stateless: the per-session [`State`] lives in the threaded [`Context<SharedState>`], so one+/// Stateless: the per-session [`State`](crate::State) lives in the threaded [`Context<SharedState>`], so one/// shared instance serves every session (see the module docs).pub struct FallThrough {processors: Vec<Arc<dyn Processor>>,diff --git a/crates/libsy/src/algorithms/util/tool_signals.rs b/crates/libsy/src/algorithms/util/tool_signals.rsindex 570af5fa2..143d1044c 100644--- a/crates/libsy/src/algorithms/util/tool_signals.rs+++ b/crates/libsy/src/algorithms/util/tool_signals.rs@@ -185,14 +185,14 @@ static NUMERIC_FAILURE_KEYWORDS: &[&str] = &["failed", "failure", "failures", "e////// A short horizon captures "what is the agent doing right now" while keeping/// signals sticky — an error or stall persists a few recovery turns instead of-/// flickering off the moment one clean result lands. Override per-extractor by-/// calling [`extract_tool_signals_with_window`] directly.+/// flickering off the moment one clean result lands. Override per request by+/// passing a window to [`ToolSignals::from_request`].pub const DEFAULT_RECENT_WINDOW: usize = 3;// ─── output type ─────────────────────────────────────────────────────────────/// Tool-execution signals stamped on `ProxyContext`. Read by stage_router pickers-/// via [`crate::get_tool_result_signal`].+/// via the `get_tool_result_signal` binding.#[derive(Clone, Debug, Default)]pub struct ToolSignals {/// Max severity across the recent window (last `recent_window` tool results):@@ -209,13 +209,13 @@ pub struct ToolSignals {/// TodoWrite / planning tool calls. Investigative (non-producing) activity —/// recent todowrites distinguish `exploring` from `spinning` in the scorer.pub todowrite_count: u32,- /// Edit-type calls within the last [`RECENT_WINDOW`] tool calls.+ /// Edit-type calls within the configured recent window (default: [`DEFAULT_RECENT_WINDOW`]).pub recent_edit_count: u32,- /// Write-type calls within the last [`RECENT_WINDOW`] tool calls.+ /// Write-type calls within the configured recent window (default: [`DEFAULT_RECENT_WINDOW`]).pub recent_write_count: u32,- /// Read-type calls within the last [`RECENT_WINDOW`] tool calls.+ /// Read-type calls within the configured recent window (default: [`DEFAULT_RECENT_WINDOW`]).pub recent_read_count: u32,- /// TodoWrite calls within the last [`RECENT_WINDOW`] tool calls.+ /// TodoWrite calls within the configured recent window (default: [`DEFAULT_RECENT_WINDOW`]).pub recent_todowrite_count: u32,/// Consecutive trailing tool calls in the `Other` category (no Write/Edit/Read//// Plan match). Surfaced in the classifier state summary; not scored directly.diff --git a/crates/libsy/src/core/state.rs b/crates/libsy/src/core/state.rsindex 51d4812d7..58382c76d 100644--- a/crates/libsy/src/core/state.rs+++ b/crates/libsy/src/core/state.rs@@ -17,7 +17,7 @@ pub enum StateValue {Scalar(f32),}-/// State maitaineed by [`Algorithm`]s+/// State maintained by [`Algorithm`](crate::Algorithm)s#[derive(Debug, Clone, Default)]pub struct State {pub turn_count: u32,