Skip to main content

nemo_relay/api/
runtime.rs

1// SPDX-FileCopyrightText: Copyright (c) 2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
2// SPDX-License-Identifier: Apache-2.0
3
4//! Advanced runtime state, callbacks, and scope-stack helpers.
5
6pub mod callbacks;
7mod continuation_context;
8pub mod global;
9pub mod scope_stack;
10pub mod state;
11pub mod subscriber_dispatcher;
12
13pub use callbacks::{
14    BuiltinLlmCodec, EventSanitizeFn, EventSubscriberFn, LlmCodecIdentity, LlmCollectorFn,
15    LlmConditionalFn, LlmExecutionFn, LlmExecutionNextFn, LlmFinalizerFn, LlmJsonStream,
16    LlmRequestInterceptFn, LlmSanitizeRequestContext, LlmSanitizeRequestFn,
17    LlmSanitizeResponseContext, LlmSanitizeResponseFn, LlmStreamExecutionFn,
18    LlmStreamExecutionNextFn, LlmStreamInner, ToolConditionalFn, ToolExecutionFn,
19    ToolExecutionNextFn, ToolInterceptFn, ToolSanitizeFn,
20};
21#[doc(hidden)]
22pub use continuation_context::MiddlewareContinuationContext;
23#[cfg(test)]
24pub(crate) use continuation_context::MiddlewareContinuationLease;
25pub use global::global_context;
26pub use scope_stack::{
27    PropagationContext, ScopeStack, ScopeStackHandle, TASK_SCOPE_STACK, ThreadScopeStackBinding,
28    capture_propagation_context, capture_propagation_context_with_root, capture_thread_scope_stack,
29    create_scope_stack, create_scope_stack_from_propagation, current_scope_stack, fork_scope_stack,
30    propagate_scope_to_thread, restore_thread_scope_stack, scope_stack_active,
31    set_thread_scope_stack, sync_thread_scope_stack, task_scope_push, task_scope_remove,
32    task_scope_top, with_active_event_uuid, with_scope_stack,
33};
34pub use state::NemoRelayContextState;
35#[doc(hidden)]
36pub use subscriber_dispatcher::SubscriberDelivery;
37pub use subscriber_dispatcher::flush_subscribers;