diff --git a/litellm-rust/crates/host/AGENTS.md b/litellm-rust/crates/host/AGENTS.md index 317a43516c7..37b6af13e77 100644 --- a/litellm-rust/crates/host/AGENTS.md +++ b/litellm-rust/crates/host/AGENTS.md @@ -14,9 +14,9 @@ Core route constructors prepare their dependencies and return a closure acceptin Each driver owns terminal dispatch. Hooks can change or fail execution; passive observers return no result. HTTP observes success after response conversion or stream exhaustion, failure on errors, and cancellation on body drop. Python preserves exception identity and maps native failures once. Explicit Python stream close reports success for delivered chunks; cancellation stops further callback dispatch -`interceptors.rs` owns `Interceptors` and its request/response payload types. `lifecycle.rs` owns `CallObserver`, `CallEvent`, `ExecutionEvent`, timing, failure origin, and the observation wrappers. Event payloads are generic so a runtime can retain its own response, exception and raw-response references without introducing a language dependency. `snapshot()` projects them into the owned observation contract without retaining runtime objects. Pass interceptors and observers separately at direct route and HTTP entrypoints. Routes publish execution events independently of interception +`hooks/interceptors.rs` owns `Interceptors` and its request/response payload types. `lifecycle.rs` owns `CallObserver`, `CallEvent`, `ExecutionEvent`, timing, failure origin, and the observation wrappers. Event payloads are generic so a runtime can retain its own response, exception and raw-response references without introducing a language dependency. `snapshot()` projects them into the owned observation contract without retaining runtime objects. Pass interceptors and observers separately at direct route and HTTP entrypoints. Routes publish execution events independently of interception -`hooks.rs` owns the call-stage interface and its runtime-associated types. It contains no Python types or legacy callback policy. A runtime supplies its context and continuation representation through `HookRuntime` +`hooks/runtime.rs` owns the runtime call-stage interface and its associated types. `hooks/observation.rs` owns the optional nonblocking observation channel. `hooks/mod.rs` exports these contracts; the root `interceptors` and `observation` module paths remain re-exports. It contains no Python types or legacy callback policy. A runtime supplies its context and continuation representation through `HookRuntime` `protocol.rs` owns `Protocol` and suspension messages, including `InterceptRequest` and `StreamDelivery`. `call.rs` owns route outputs and their adaptation into a hosted machine. Rust service handling belongs in `host-native::services`; coroutine channel handles stay in `machine/context.rs` diff --git a/litellm-rust/crates/host/src/interceptors.rs b/litellm-rust/crates/host/src/hooks/interceptors.rs similarity index 100% rename from litellm-rust/crates/host/src/interceptors.rs rename to litellm-rust/crates/host/src/hooks/interceptors.rs diff --git a/litellm-rust/crates/host/src/hooks/mod.rs b/litellm-rust/crates/host/src/hooks/mod.rs new file mode 100644 index 00000000000..9c5f9bcc810 --- /dev/null +++ b/litellm-rust/crates/host/src/hooks/mod.rs @@ -0,0 +1,5 @@ +pub mod interceptors; +pub mod observation; +mod runtime; + +pub use runtime::{CallHooks, HookRuntime, RuntimeCallEvent}; diff --git a/litellm-rust/crates/host/src/observation.rs b/litellm-rust/crates/host/src/hooks/observation.rs similarity index 100% rename from litellm-rust/crates/host/src/observation.rs rename to litellm-rust/crates/host/src/hooks/observation.rs diff --git a/litellm-rust/crates/host/src/hooks.rs b/litellm-rust/crates/host/src/hooks/runtime.rs similarity index 100% rename from litellm-rust/crates/host/src/hooks.rs rename to litellm-rust/crates/host/src/hooks/runtime.rs diff --git a/litellm-rust/crates/host/src/lib.rs b/litellm-rust/crates/host/src/lib.rs index 76fce582fb3..5ee16d6568c 100644 --- a/litellm-rust/crates/host/src/lib.rs +++ b/litellm-rust/crates/host/src/lib.rs @@ -8,8 +8,8 @@ pub mod call; pub mod hooks; -pub mod interceptors; +pub use hooks::interceptors; pub mod lifecycle; pub mod machine; -pub mod observation; +pub use hooks::observation; pub mod protocol;