refactor(rust): group host hook modules under hooks/

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
Yujong Lee 2026-09-29 00:24:30 +00:00
parent db9c307e1a
commit e18e17c0f1
6 changed files with 9 additions and 4 deletions

View file

@ -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`

View file

@ -0,0 +1,5 @@
pub mod interceptors;
pub mod observation;
mod runtime;
pub use runtime::{CallHooks, HookRuntime, RuntimeCallEvent};

View file

@ -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;