Skip to main content

Crate nemo_relay_plugin

Crate nemo_relay_plugin 

Source
Expand description

Stable native plugin ABI and Rust authoring helpers for NeMo Relay.

This crate intentionally does not depend on the nemo-relay runtime crate. Native plugins built with it communicate with a host through versioned C-compatible tables and host-owned string handles.

Macros§

nemo_relay_plugin
Exports a concrete plugin constructor as a native plugin entry symbol body.

Structs§

AnnotatedLlmRequest
Structured view of an LLM request, produced by a Codec from opaque LlmRequest content.
AnnotatedLlmResponse
Structured view of an LLM response, produced by a response codec from raw JSON API output.
CategoryProfile
Category-specific profile data.
ConfigDiagnostic
Structured validation diagnostic for plugin validation.
DataSchema
Identifier for the schema that describes an event’s opaque data payload.
EventCategory
Semantic category carried by ATOF category.
EventSanitizeFields
Observability fields that event sanitizers may rewrite.
LlmAttributes
Bitflags that modify LLM-call behavior and observability.
LlmNext
Typed continuation passed to LLM execution intercepts.
LlmOptimizationContribution
One optimizer’s evidence for a change to an LLM call.
LlmOptimizationKind
Open, forward-compatible optimization classification.
LlmOptimizationModel
Model identity used for counterfactual and effective pricing.
LlmOptimizationModelTransition
A model change proposed or applied by an optimizer.
LlmOptimizationSummary
Close-time accounting attached to the normalized LLM response.
LlmOptimizationTokenImpact
Shared token evidence that Relay can aggregate without understanding a plugin payload.
LlmOptimizationTokens
Token quantities retained independently from pricing arithmetic.
LlmRequest
JSON-shaped LLM request payload passed through the runtime.
LlmRequestInterceptOutcome
Result of an LLM request intercept that can schedule lifecycle marks.
LlmSanitizeRequestCodec
Safe callback-scoped request codec facade for typed native plugins.
LlmSanitizeRequestContext
Per-call request codec context delivered to an LLM sanitizer.
LlmSanitizeResponseCodec
Safe callback-scoped response codec facade for typed native plugins.
LlmSanitizeResponseContext
Per-call response codec context delivered to an LLM sanitizer.
LlmStream
Host- or plugin-owned stream returned across the native LLM stream ABI.
LlmStreamNext
Typed continuation passed to LLM stream execution intercepts.
NemoRelayNativeAsyncCompletion
Opaque one-shot completion retained by a pending native callback.
NemoRelayNativeAsyncNext
Opaque native execution continuation supplied only to execution intercepts.
NemoRelayNativeAsyncStream
Opaque incremental output channel supplied to native async stream intercepts.
NemoRelayNativeHostApiV1
Versioned host API table passed to native plugin entry symbols.
NemoRelayNativeHostApiV3
ABI-v3 host extension appended to NemoRelayNativeHostApiV1.
NemoRelayNativeLlmRequestCodec
Opaque callback-scoped request codec capability owned by the host.
NemoRelayNativeLlmResponseCodec
Opaque callback-scoped response codec capability owned by the host.
NemoRelayNativeLlmSanitizeRequestContext
Per-call LLM sanitizer context passed over the native ABI.
NemoRelayNativeLlmSanitizeResponseContext
Per-call response sanitizer context passed over the native ABI.
NemoRelayNativeLlmStreamV1
Native LLM JSON stream handle table.
NemoRelayNativePluginContext
Opaque plugin registration context borrowed from the host during registration.
NemoRelayNativePluginV1
Versioned plugin descriptor returned by native plugin entry symbols.
NemoRelayNativeScopeHandle
Opaque host-owned scope handle.
NemoRelayNativeScopeStack
Opaque host-owned scope stack handle.
NemoRelayNativeScopeStackBinding
Opaque host-owned captured scope-stack binding.
NemoRelayNativeString
Opaque host-owned UTF-8 string or JSON byte buffer.
PendingMarkSpec
Mark requested by middleware for materialization by a lifecycle owner.
PluginContext
Borrowed safe wrapper around a host plugin registration context.
PluginRuntime
Cloneable high-level runtime handle for host APIs available to native plugins.
ScopeAttributes
Bitflags that modify scope behavior and observability.
ScopeGuard
RAII guard for a host scope opened by PluginRuntime::scope.
ScopeHandle
Host-owned scope handle returned by native scope APIs.
ScopeStack
Host-owned isolated scope stack returned by native scope-stack APIs.
ScopeStackBinding
Captured thread-local scope-stack binding.
ThreadScopeStackGuard
RAII guard that restores the previous thread-local scope stack on drop.
ToolAttributes
Bitflags that modify tool-call behavior and observability.
ToolExecutionInterceptOutcome
Canonical result returned by a tool execution intercept.
ToolNext
Typed continuation passed to tool execution intercepts.

Enums§

BuiltinLlmCodec
Built-in LLM codec identities available to native plugins.
DiagnosticLevel
Diagnostic severity returned by plugin validation.
Event
Tagged union covering the two ATOF event kinds emitted by the runtime.
HandleAttributes
Attribute bitflags attached to a concrete handle kind.
LlmCodecIdentity
Per-call LLM codec identity delivered to native plugins.
LlmOptimizationEvidenceQuality
Whether token evidence was observed directly or estimated.
LlmOptimizationSummaryStatus
Completeness of close-time optimization accounting.
NemoRelayNativeAsyncCallbackState
Indicates whether an asynchronous native callback settled before returning.
NemoRelayNativeAsyncMiddlewareKind
Middleware surface selected by the native async registration hook.
NemoRelayNativeLlmCodecKind
Discriminator for the codec supplied to an LLM sanitizer over the native ABI.
NemoRelayNativeScopeType
Scope category used by native plugins when opening scopes.
NemoRelayStatus
Status codes returned by stable native ABI functions.
ScopeCategory
Agent Trajectory Observability Format (ATOF) lifecycle phase for a scope event.
ScopeType
Semantic category attached to a scope lifecycle span.

Constants§

NEMO_RELAY_NATIVE_ABI_VERSION
Native plugin ABI version supported by this crate.
NEMO_RELAY_NATIVE_ABI_VERSION_ASYNC_MIDDLEWARE
ABI version that introduced completion-based asynchronous middleware.
NEMO_RELAY_NATIVE_ABI_VERSION_LEGACY
Legacy native plugin ABI accepted by Relay hosts for compatibility.

Traits§

LlmOptimizationPayload
Trait implemented by typed plugin payloads embedded in an optimization contribution.
NativePlugin
Trait implemented by Rust native plugins.

Functions§

capture_scope_stack_thread
Captures the current thread-local scope-stack binding.
create_scope_stack
Creates a new independent scope stack.
current_scope
Retrieves the current scope handle.
emit_mark
Emits a mark event under the current scope.
export_plugin
Initializes a native plugin descriptor for a Rust SDK plugin value.
pop_scope
Pops a scope and emits its end event.
push_scope
Pushes a scope and emits its start event.

Type Aliases§

Json
Type alias for serde_json::Value, used as the universal JSON representation throughout NeMo Relay APIs.
LlmJsonStream
Synchronous JSON chunk stream used by native LLM stream intercept helpers.
NemoRelayNativeAsyncMiddlewareCb
Completion-based native middleware callback.
NemoRelayNativeAsyncNextResultCb
Receives one completion from a unary execution-continuation invocation.
NemoRelayNativeAsyncNextStreamCb
Receives one downstream stream item. chunk_json is non-null for a chunk, error is non-null for failure or consumer cancellation, and done marks clean completion. Unless the callback itself returns false, the host invokes one terminal callback so the plugin can reclaim user_data. Return false to cancel downstream production after the current callback; in that case, reclaim user_data before returning because no later callback is made.
NemoRelayNativeAsyncStreamMiddlewareCb
Incremental native LLM stream intercept callback.
NemoRelayNativeEventSanitizeCb
Native event observability-field sanitizer callback.
NemoRelayNativeEventSubscriberCb
Native event subscriber callback.
NemoRelayNativeFreeFn
Optional destructor for user data captured by native callbacks.
NemoRelayNativeLlmConditionalCb
Native LLM conditional-execution callback.
NemoRelayNativeLlmExecutionCb
Native LLM execution intercept callback.
NemoRelayNativeLlmNextFn
Runtime-provided continuation for LLM execution intercepts.
NemoRelayNativeLlmRequestInterceptCb
Native LLM request intercept callback.
NemoRelayNativeLlmSanitizeRequestCb
Native LLM request sanitizer callback. Return a successful null output to omit the observability payload and annotation. request_json is borrowed, but may be written directly to out_request_json as a pass-through; the host releases an aliased input/output once. Any other non-null output must be host-allocated and transfers ownership to the host.
NemoRelayNativeLlmSanitizeResponseCb
Native LLM response sanitizer callback. Return a successful null output to omit the observability payload and annotation. payload_json is borrowed, but may be written directly to out_json as a pass-through; the host releases an aliased input/output once. Any other non-null output must be host-allocated and transfers ownership to the host.
NemoRelayNativeLlmStreamCancelFn
Optional native stream cancellation callback.
NemoRelayNativeLlmStreamDropFn
Optional native stream destructor callback.
NemoRelayNativeLlmStreamExecutionCb
Native LLM stream execution intercept callback.
NemoRelayNativeLlmStreamNextFn
Runtime-provided continuation for LLM stream execution intercepts.
NemoRelayNativeLlmStreamPollFn
Native stream poll callback.
NemoRelayNativePluginDropFn
Native plugin drop callback.
NemoRelayNativePluginEntry
Native entry symbol type loaded by the host.
NemoRelayNativePluginRegisterFn
Native plugin registration callback.
NemoRelayNativePluginValidateFn
Native plugin validation callback.
NemoRelayNativeToolConditionalCb
Native tool conditional-execution callback.
NemoRelayNativeToolExecutionCb
Native tool execution intercept callback.
NemoRelayNativeToolJsonCb
Native JSON transform callback for tool request/response sanitizers and tool request intercepts.
NemoRelayNativeToolNextFn
Runtime-provided continuation for tool execution intercepts.
NemoRelayNativeWithScopeStackCb
Native callback executed while a host scope stack is temporarily active.
Result
Result type used by the Rust native plugin SDK.