Skip to navigation

Struct Host Plugin Registration Context

View as Markdown

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 HostPluginRegistrationContext { /* private fields */ }

Host implementation of the shared PluginRegistrationContext interface.

Each register_* call both installs the middleware/subscriber into the NeMo Relay runtime and records the inverse deregistration closure so the host can roll back partial setup on failure.

Implementations

impl HostPluginRegistrationContext

impl HostPluginRegistrationContext

diagnostics

pub fn diagnostics(&self) -> &Diagnostics

Return the diagnostics context selected for this plugin activation.

new

pub fn new() -> Self

Creates an empty plugin registration context.

with_diagnostics

pub fn with_diagnostics(diagnostics: &Diagnostics) -> Self

Creates an activation context using the owner’s selected diagnostics context.

Diagnostic admission failure never prevents plugin registration. Disabled collection supplies the same inert recorder interface without producer checks.

with_namespace

pub fn with_namespace(namespace: impl Into<String>) -> Self

Creates a plugin registration context that namespaces all registration names.

with_child_namespace

pub fn with_child_namespace(&self, local_namespace: &str) -> Self

Creates a child context that extends this context’s namespace.

Child contexts preserve Relay-created plugin component qualification so their local namespace segments and registration names remain encoded as one effective component name.

qualify_name

pub fn qualify_name(&self, name: &str) -> String

Returns the runtime-qualified name for a plugin-local registration.

Plugin handlers should pass stable component-local names such as "tool" or "subscriber". The host applies the namespace so users do not have to provide component instance ids.

register_subscriber

pub fn register_subscriber(
    &mut self,
    name: &str,
    callback: EventSubscriberFn,
) -> Result<()>

Registers an event subscriber and records its rollback closure.

register_conditional_middleware_guardrail

pub fn register_conditional_middleware_guardrail(
    &mut self,
    name: &str,
    kinds: BTreeSet<RuntimeRegistrationKind>,
    registration_name: &str,
    guardrail: ConditionalMiddlewareGuardrailFn,
) -> Result<()>

Registers a global conditional middleware guardrail and records its rollback closure.

register_event_metadata_injector

pub fn register_event_metadata_injector(
    &mut self,
    name: &str,
    priority: i32,
    callback: EventMetadataInjectorFn,
) -> Result<()>

Registers an Event metadata injector and records its rollback closure.

register_mark_sanitize_guardrail

pub fn register_mark_sanitize_guardrail(
    &mut self,
    name: &str,
    priority: i32,
    callback: EventSanitizeFn,
) -> Result<()>

Registers a mark event sanitizer and records its rollback closure.

register_scope_sanitize_start_guardrail

pub fn register_scope_sanitize_start_guardrail(
    &mut self,
    name: &str,
    priority: i32,
    callback: EventSanitizeFn,
) -> Result<()>

Registers a scope-start event sanitizer and records its rollback closure.

register_scope_sanitize_end_guardrail

pub fn register_scope_sanitize_end_guardrail(
    &mut self,
    name: &str,
    priority: i32,
    callback: EventSanitizeFn,
) -> Result<()>

Registers a scope-end event sanitizer and records its rollback closure.

register_llm_request_intercept

pub fn register_llm_request_intercept(
    &mut self,
    name: &str,
    priority: i32,
    break_chain: bool,
    callback: LlmRequestInterceptFn,
) -> Result<()>

Registers an LLM request intercept and records its rollback closure.

register_tool_sanitize_request_guardrail

pub fn register_tool_sanitize_request_guardrail(
    &mut self,
    name: &str,
    priority: i32,
    callback: ToolSanitizeFn,
) -> Result<()>

Registers a tool sanitize-request guardrail and records its rollback closure.

register_tool_sanitize_response_guardrail

pub fn register_tool_sanitize_response_guardrail(
    &mut self,
    name: &str,
    priority: i32,
    callback: ToolSanitizeFn,
) -> Result<()>

Registers a tool sanitize-response guardrail and records its rollback closure.

register_tool_conditional_execution_guardrail

pub fn register_tool_conditional_execution_guardrail(
    &mut self,
    name: &str,
    priority: i32,
    callback: ToolConditionalFn,
) -> Result<()>

Registers a tool conditional-execution guardrail and records its rollback closure.

register_llm_sanitize_request_guardrail

pub fn register_llm_sanitize_request_guardrail(
    &mut self,
    name: &str,
    priority: i32,
    callback: LlmSanitizeRequestFn,
) -> Result<()>

Registers an LLM sanitize-request guardrail and records its rollback closure.

register_llm_sanitize_response_guardrail

pub fn register_llm_sanitize_response_guardrail(
    &mut self,
    name: &str,
    priority: i32,
    callback: LlmSanitizeResponseFn,
) -> Result<()>

Registers an LLM sanitize-response guardrail and records its rollback closure.

register_llm_conditional_execution_guardrail

pub fn register_llm_conditional_execution_guardrail(
    &mut self,
    name: &str,
    priority: i32,
    callback: LlmConditionalFn,
) -> Result<()>

Registers an LLM conditional-execution guardrail and records its rollback closure.

register_llm_execution_intercept

pub fn register_llm_execution_intercept(
    &mut self,
    name: &str,
    priority: i32,
    callback: LlmExecutionFn,
) -> Result<()>

Registers an LLM execution intercept and records its rollback closure.

register_llm_stream_execution_intercept

pub fn register_llm_stream_execution_intercept(
    &mut self,
    name: &str,
    priority: i32,
    callback: LlmStreamExecutionFn,
) -> Result<()>

Registers an LLM stream execution intercept and records its rollback closure.

register_tool_request_intercept

pub fn register_tool_request_intercept(
    &mut self,
    name: &str,
    priority: i32,
    break_chain: bool,
    callback: ToolInterceptFn,
) -> Result<()>

Registers a tool request intercept and records its rollback closure.

register_tool_execution_intercept

pub fn register_tool_execution_intercept(
    &mut self,
    name: &str,
    priority: i32,
    callback: ToolExecutionFn,
) -> Result<()>

Registers a tool execution intercept that receives the full ToolExecutionContext and records its rollback closure.

add_registration

pub fn add_registration(&mut self, registration: PluginRegistration)

Adds a prebuilt registration to the context.

extend_registrations

pub fn extend_registrations(&mut self, registrations: Vec<PluginRegistration>)

Extends the context with prebuilt registrations.

activation_diagnostics

pub fn activation_diagnostics(&self) -> &[ConfigDiagnostic]

Diagnostics accumulated while activating this component.

into_registrations

pub fn into_registrations(self) -> Vec<PluginRegistration>

Consumes the context and returns the recorded registrations.

Trait Implementations

impl Default for HostPluginRegistrationContext

impl Default for HostPluginRegistrationContext

default

fn default() -> Self

impl PluginRegistrationContext for HostPluginRegistrationContext

impl PluginRegistrationContext for HostPluginRegistrationContext

diagnostics_context

fn diagnostics_context(&self) -> Option<&(dyn Any + Send + Sync)>

qualify_name

fn qualify_name(&self, name: &str) -> String

register_subscriber

fn register_subscriber(
    &mut self,
    name: &str,
    callback: EventSubscriberFn,
) -> Result<()>

add_registration

fn add_registration(&mut self, registration: PluginRegistration)

record_activation_diagnostic

fn record_activation_diagnostic(&mut self, diagnostic: ConfigDiagnostic)

record_nonfatal_activation_failure

fn record_nonfatal_activation_failure(
    &mut self,
    component_key: &'static str,
    classification: Classification,
    diagnostic: ConfigDiagnostic,
)

activation_diagnostics

fn activation_diagnostics(&self) -> &[ConfigDiagnostic]

register_conditional_middleware_guardrail

fn register_conditional_middleware_guardrail(
    &mut self,
    name: &str,
    kinds: BTreeSet<RuntimeRegistrationKind>,
    registration_name: &str,
    guardrail: ConditionalMiddlewareGuardrailFn,
) -> Result<()>

register_event_metadata_injector

fn register_event_metadata_injector(
    &mut self,
    name: &str,
    priority: i32,
    callback: EventMetadataInjectorFn,
) -> Result<()>

register_mark_sanitize_guardrail

fn register_mark_sanitize_guardrail(
    &mut self,
    name: &str,
    priority: i32,
    callback: EventSanitizeFn,
) -> Result<()>

register_scope_sanitize_start_guardrail

fn register_scope_sanitize_start_guardrail(
    &mut self,
    name: &str,
    priority: i32,
    callback: EventSanitizeFn,
) -> Result<()>

register_scope_sanitize_end_guardrail

fn register_scope_sanitize_end_guardrail(
    &mut self,
    name: &str,
    priority: i32,
    callback: EventSanitizeFn,
) -> Result<()>

register_llm_request_intercept

fn register_llm_request_intercept(
    &mut self,
    name: &str,
    priority: i32,
    break_chain: bool,
    callback: LlmRequestInterceptFn,
) -> Result<()>

register_tool_sanitize_request_guardrail

fn register_tool_sanitize_request_guardrail(
    &mut self,
    name: &str,
    priority: i32,
    callback: ToolSanitizeFn,
) -> Result<()>

register_tool_sanitize_response_guardrail

fn register_tool_sanitize_response_guardrail(
    &mut self,
    name: &str,
    priority: i32,
    callback: ToolSanitizeFn,
) -> Result<()>

register_tool_conditional_execution_guardrail

fn register_tool_conditional_execution_guardrail(
    &mut self,
    name: &str,
    priority: i32,
    callback: ToolConditionalFn,
) -> Result<()>

register_llm_sanitize_request_guardrail

fn register_llm_sanitize_request_guardrail(
    &mut self,
    name: &str,
    priority: i32,
    callback: LlmSanitizeRequestFn,
) -> Result<()>

register_llm_sanitize_response_guardrail

fn register_llm_sanitize_response_guardrail(
    &mut self,
    name: &str,
    priority: i32,
    callback: LlmSanitizeResponseFn,
) -> Result<()>

register_llm_conditional_execution_guardrail

fn register_llm_conditional_execution_guardrail(
    &mut self,
    name: &str,
    priority: i32,
    callback: LlmConditionalFn,
) -> Result<()>

register_llm_execution_intercept

fn register_llm_execution_intercept(
    &mut self,
    name: &str,
    priority: i32,
    callback: LlmExecutionFn,
) -> Result<()>

register_llm_stream_execution_intercept

fn register_llm_stream_execution_intercept(
    &mut self,
    name: &str,
    priority: i32,
    callback: LlmStreamExecutionFn,
) -> Result<()>

register_tool_request_intercept

fn register_tool_request_intercept(
    &mut self,
    name: &str,
    priority: i32,
    break_chain: bool,
    callback: ToolInterceptFn,
) -> Result<()>

register_tool_execution_intercept

fn register_tool_execution_intercept(
    &mut self,
    name: &str,
    priority: i32,
    callback: ToolExecutionFn,
) -> Result<()>

uses_plugin_component_namespace

fn uses_plugin_component_namespace(&self) -> bool

with_child_namespace

fn with_child_namespace(&self, name: &str) -> Box<dyn PluginRegistrationContext>

into_registrations

fn into_registrations(self: Box<Self>) -> Vec<PluginRegistration>

extend_registrations

fn extend_registrations(&mut self, registrations: Vec<PluginRegistration>)