Skip to navigation

Generated from cargo doc --no-deps -p nemo-relay-builtins -p nemo-relay-diagnostics -p nemo-relay-logging -p nemo-relay-plugin-host -p nemo-relay-codecs -p nemo-relay -p nemo-relay-runtime -p nemo-relay-model-pricing -p nemo-relay-resource-metrics -p nemo-relay-observability -p nemo-relay-adaptive -p nemo-relay-pii-redaction -p nemo-relay-ffi -p nemo-relay-types -p nemo-relay-plugin -p nemo-relay-worker-proto -p nemo-relay-worker.

pub struct PluginContext<'a> { /* private fields */ }

Registration context supplied to Plugin::register for one native component.

Use its registration methods to install component-owned callbacks and Self::runtime to obtain the host’s runtime capabilities.

Implementations

impl PluginContext<'_>

impl PluginContext<'_>

Referenced types: PluginContext

runtime

pub fn runtime(&self) -> PluginRuntime

Referenced types: PluginRuntime

Clone the runtime capabilities available to this native component.

task_spawner

pub fn task_spawner(&self) -> PluginTaskSpawner

Referenced types: PluginTaskSpawner

Obtain a cloneable task spawner for use inside registered middleware.

spawn

pub fn spawn<F, T>(&self, future: F) -> Result<JoinHandle<Result<T>>>where
F: Future<Output = Result<T>> + Send + 'static,
T: Send + 'static,

Referenced types: Future, Send

Spawn background work whose scope, cancellation, and cleanup belong to this component.

register_subscriber

pub fn register_subscriber<F: Fn(&Event) + Send + Sync + 'static>(
&mut self,
name: &str,
callback: F,
) -> Result<()>

Referenced types: Fn, Event, Send, Sync, str, ()

Register a synchronous event subscriber owned by this component.

register_conditional_middleware_guardrail

pub fn register_conditional_middleware_guardrail<F>(
&mut self,
name: &str,
kinds: &BTreeSet<RuntimeRegistrationKind>,
registration_name: &str,
callback: F,
) -> Result<()>where
F: Fn(&BTreeSet<RuntimeRegistrationKind>, &str) -> Option<String> + Send + Sync + 'static,

Referenced types: str, BTreeSet, RuntimeRegistrationKind, (), Fn, Option, String, Send, Sync

Register a synchronous gate that can disable selected middleware registrations.

impl PluginContext<'_>

impl PluginContext<'_>

Referenced types: PluginContext

register_event_metadata_injector

pub fn register_event_metadata_injector<F, Fut>(
&mut self,
name: &str,
priority: i32,
callback: F,
) -> Result<()>where
F: Fn(Arc<Event>) -> Fut + Send + Sync + 'static,
Fut: Future<Output = Result<BTreeMap<String, Json>>> + Send + 'static,

Referenced types: str, i32, (), Fn, Arc, Event, Send, Sync, Future, BTreeMap, String, Json

Register an async callback that adds metadata to emitted events.

register_mark_sanitize_guardrail

pub fn register_mark_sanitize_guardrail<F, Fut>(
&mut self,
name: &str,
priority: i32,
callback: F,
) -> Result<()>where
F: Fn(Arc<Event>, EventSanitizeFields) -> Fut + Send + Sync + 'static,
Fut: Future<Output = Result<EventSanitizeFields>> + Send + 'static,

Referenced types: str, i32, (), Fn, Arc, Event, EventSanitizeFields, Send, Sync, Future

Register an async sanitizer for observable fields on mark events.

register_scope_sanitize_start_guardrail

pub fn register_scope_sanitize_start_guardrail<F, Fut>(
&mut self,
name: &str,
priority: i32,
callback: F,
) -> Result<()>where
F: Fn(Arc<Event>, EventSanitizeFields) -> Fut + Send + Sync + 'static,
Fut: Future<Output = Result<EventSanitizeFields>> + Send + 'static,

Referenced types: str, i32, (), Fn, Arc, Event, EventSanitizeFields, Send, Sync, Future

Register an async sanitizer for observable fields on scope-start events.

register_scope_sanitize_end_guardrail

pub fn register_scope_sanitize_end_guardrail<F, Fut>(
&mut self,
name: &str,
priority: i32,
callback: F,
) -> Result<()>where
F: Fn(Arc<Event>, EventSanitizeFields) -> Fut + Send + Sync + 'static,
Fut: Future<Output = Result<EventSanitizeFields>> + Send + 'static,

Referenced types: str, i32, (), Fn, Arc, Event, EventSanitizeFields, Send, Sync, Future

Register an async sanitizer for observable fields on scope-end events.

register_tool_sanitize_request_guardrail

pub fn register_tool_sanitize_request_guardrail<F, Fut>(
&mut self,
name: &str,
priority: i32,
callback: F,
) -> Result<()>where
F: Fn(String, Json) -> Fut + Send + Sync + 'static,
Fut: Future<Output = Result<Json>> + Send + 'static,

Referenced types: str, i32, (), Fn, String, Json, Send, Sync, Future

Register an async sanitizer for tool request data recorded in events.

register_tool_sanitize_response_guardrail

pub fn register_tool_sanitize_response_guardrail<F, Fut>(
&mut self,
name: &str,
priority: i32,
callback: F,
) -> Result<()>where
F: Fn(String, Json) -> Fut + Send + Sync + 'static,
Fut: Future<Output = Result<Json>> + Send + 'static,

Referenced types: str, i32, (), Fn, String, Json, Send, Sync, Future

Register an async sanitizer for tool response data recorded in events.

register_tool_conditional_execution_guardrail

pub fn register_tool_conditional_execution_guardrail<F, Fut>(
&mut self,
name: &str,
priority: i32,
callback: F,
) -> Result<()>where
F: Fn(String, Json) -> Fut + Send + Sync + 'static,
Fut: Future<Output = Result<Option<String>>> + Send + 'static,

Referenced types: str, i32, (), Fn, String, Json, Send, Sync, Future, Option

Register an async guardrail that allows or blocks a tool call.

register_tool_request_intercept

pub fn register_tool_request_intercept<F, Fut>(
&mut self,
name: &str,
priority: i32,
break_chain: bool,
callback: F,
) -> Result<()>where
F: Fn(String, Json) -> Fut + Send + Sync + 'static,
Fut: Future<Output = Result<Json>> + Send + 'static,

Referenced types: str, i32, bool, (), Fn, String, Json, Send, Sync, Future

Register an async intercept that can rewrite a tool’s execution arguments.

register_tool_execution_intercept

pub fn register_tool_execution_intercept<F, Fut>(
&mut self,
name: &str,
priority: i32,
callback: F,
) -> Result<()>where
F: Fn(ToolExecutionContext, ToolNext) -> Fut + Send + Sync + 'static,
Fut: Future<Output = Result<ToolExecutionInterceptOutcome>> + Send + 'static,

Referenced types: str, i32, (), Fn, ToolExecutionContext, ToolNext, Send, Sync, Future, ToolExecutionInterceptOutcome

Register an async tool execution wrapper with repeatable downstream continuations.

register_llm_conditional_execution_guardrail

pub fn register_llm_conditional_execution_guardrail<F, Fut>(
&mut self,
name: &str,
priority: i32,
callback: F,
) -> Result<()>where
F: Fn(LlmRequest) -> Fut + Send + Sync + 'static,
Fut: Future<Output = Result<Option<String>>> + Send + 'static,

Referenced types: str, i32, (), Fn, LlmRequest, Send, Sync, Future, Option, String

Register an async guardrail that allows or blocks an LLM call.

register_llm_request_intercept

pub fn register_llm_request_intercept<F, Fut>(
&mut self,
name: &str,
priority: i32,
break_chain: bool,
callback: F,
) -> Result<()>where
F: Fn(String, LlmRequest, Option<AnnotatedLlmRequest>) -> Fut + Send + Sync + 'static,
Fut: Future<Output = Result<LlmRequestInterceptOutcome>> + Send + 'static,

Referenced types: str, i32, bool, (), Fn, String, LlmRequest, Option, AnnotatedLlmRequest, Send, Sync, Future, LlmRequestInterceptOutcome

Register an async intercept that can rewrite or complete an LLM request.

register_llm_sanitize_request_guardrail

pub fn register_llm_sanitize_request_guardrail<F, Fut>(
&mut self,
name: &str,
priority: i32,
callback: F,
) -> Result<()>where
F: Fn(LlmRequest, LlmSanitizeRequestContext<'static>) -> Fut + Send + Sync + 'static,
Fut: Future<Output = Result<Option<LlmRequest>>> + Send + 'static,

Referenced types: str, i32, (), Fn, LlmRequest, LlmSanitizeRequestContext, Send, Sync, Future, Option

Register an async sanitizer for observable LLM request data with its request codec context.

register_llm_sanitize_response_guardrail

pub fn register_llm_sanitize_response_guardrail<F, Fut>(
&mut self,
name: &str,
priority: i32,
callback: F,
) -> Result<()>where
F: Fn(Json, LlmSanitizeResponseContext<'static>) -> Fut + Send + Sync + 'static,
Fut: Future<Output = Result<Option<Json>>> + Send + 'static,

Referenced types: str, i32, (), Fn, Json, LlmSanitizeResponseContext, Send, Sync, Future, Option

Register an async sanitizer for observable LLM responses with their response codec context.

register_llm_execution_intercept

pub fn register_llm_execution_intercept<F, Fut>(
&mut self,
name: &str,
priority: i32,
callback: F,
) -> Result<()>where
F: Fn(String, LlmRequest, LlmExecutionContext, LlmNext) -> Fut + Send + Sync + 'static,
Fut: Future<Output = Result<Json>> + Send + 'static,

Referenced types: str, i32, (), Fn, String, LlmRequest, LlmExecutionContext, LlmNext, Send, Sync, Future, Json

Register an async LLM execution wrapper with live codec capabilities and downstream continuation.

register_llm_stream_execution_intercept

pub fn register_llm_stream_execution_intercept<F, Fut>(
&mut self,
name: &str,
priority: i32,
callback: F,
) -> Result<()>where
F: Fn(String, LlmRequest, LlmExecutionContext, LlmStreamNext) -> Fut + Send + Sync + 'static,
Fut: Future<Output = Result<LlmJsonAsyncStream>> + Send + 'static,

Referenced types: str, i32, (), Fn, String, LlmRequest, LlmExecutionContext, LlmStreamNext, Send, Sync, Future, LlmJsonAsyncStream

Register an async LLM stream wrapper whose streams close with the owning component.

impl PluginContext<'_>

impl PluginContext<'_>

Referenced types: PluginContext

register_synchronous_callback

pub fn register_synchronous_callback<F>(
&mut self,
name: &str,
surface: Surface,
priority: i32,
break_chain: bool,
callback: F,
) -> Result<()>where
F: Fn(Invocation, Option<ContinuationBox>) -> Result<Json> + Send + Sync + 'static,

Referenced types: str, i32, bool, (), Fn, Option, Send, Sync

Register a synchronous callback using only checked ABI invocation values. The Rust callback and its captured state remain in the originating SDK. Subscribers run inline; synchronous middleware uses blocking offload.

impl PluginContext<'_>

impl PluginContext<'_>

Referenced types: PluginContext

register_synchronous_stream_callback

pub fn register_synchronous_stream_callback<F>(
&mut self,
name: &str,
priority: i32,
callback: F,
) -> Result<()>where
F: Fn(Invocation, ContinuationBox) -> Result<StreamBox> + Send + Sync + 'static,

Referenced types: str, i32, (), Fn, Send, Sync

Register a synchronous stream factory returning a checked stream descriptor. Offload construction; poll returned stream futures under component scope and runtime context.