Struct Nemo Relay Native Host ApiV3

View as Markdown

Generated from cargo doc --no-deps -p nemo-relay -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.

#[repr(C)]pub struct NemoRelayNativeHostApiV3 {Show 16 fields
    pub v1: NemoRelayNativeHostApiV1,
    pub async_completion_resolve_json: unsafe extern "C" fn(completion: *const NemoRelayNativeAsyncCompletion, value_json: *const NemoRelayNativeString) -> NemoRelayStatus,
    pub async_completion_reject: unsafe extern "C" fn(completion: *const NemoRelayNativeAsyncCompletion, message: *const NemoRelayNativeString) -> NemoRelayStatus,
    pub async_completion_is_cancelled: unsafe extern "C" fn(completion: *const NemoRelayNativeAsyncCompletion) -> bool,
    pub async_completion_release: unsafe extern "C" fn(completion: *const NemoRelayNativeAsyncCompletion),
    pub async_next_invoke: unsafe extern "C" fn(next: *const NemoRelayNativeAsyncNext, invocation_json: *const NemoRelayNativeString, completion: *const NemoRelayNativeAsyncCompletion) -> NemoRelayStatus,
    pub async_next_release: unsafe extern "C" fn(next: *const NemoRelayNativeAsyncNext),
    pub plugin_context_register_async_middleware: unsafe extern "C" fn(ctx: *mut NemoRelayNativePluginContext, kind: u32, name: *const NemoRelayNativeString, priority: i32, break_chain: bool, cb: NemoRelayNativeAsyncMiddlewareCb, user_data: *mut c_void, free_fn: NemoRelayNativeFreeFn) -> NemoRelayStatus,
    pub async_stream_push_json: unsafe extern "C" fn(stream: *const NemoRelayNativeAsyncStream, chunk_json: *const NemoRelayNativeString) -> NemoRelayStatus,
    pub async_stream_finish: unsafe extern "C" fn(stream: *const NemoRelayNativeAsyncStream) -> NemoRelayStatus,
    pub async_stream_reject: unsafe extern "C" fn(stream: *const NemoRelayNativeAsyncStream, message: *const NemoRelayNativeString) -> NemoRelayStatus,
    pub async_stream_is_cancelled: unsafe extern "C" fn(stream: *const NemoRelayNativeAsyncStream) -> bool,
    pub async_stream_release: unsafe extern "C" fn(stream: *const NemoRelayNativeAsyncStream),
    pub async_next_invoke_stream: unsafe extern "C" fn(next: *const NemoRelayNativeAsyncNext, invocation_json: *const NemoRelayNativeString, stream: *const NemoRelayNativeAsyncStream, cb: NemoRelayNativeAsyncNextStreamCb, user_data: *mut c_void) -> NemoRelayStatus,
    pub plugin_context_register_async_stream_middleware: unsafe extern "C" fn(ctx: *mut NemoRelayNativePluginContext, name: *const NemoRelayNativeString, priority: i32, cb: NemoRelayNativeAsyncStreamMiddlewareCb, user_data: *mut c_void, free_fn: NemoRelayNativeFreeFn) -> NemoRelayStatus,
    pub async_next_invoke_result: unsafe extern "C" fn(next: *const NemoRelayNativeAsyncNext, invocation_json: *const NemoRelayNativeString, cb: NemoRelayNativeAsyncNextResultCb, user_data: *mut c_void) -> NemoRelayStatus,
}

ABI-v3 host extension appended to NemoRelayNativeHostApiV1.

Its first field is the complete v1/v2 table, so legacy plugins can keep treating the pointer as a NemoRelayNativeHostApiV1.

Fields

v1: NemoRelayNativeHostApiV1

Compatibility prefix for ABI-v1/v2 plugins.

async_completion_resolve_json: unsafe extern "C" fn(completion: *const NemoRelayNativeAsyncCompletion, value_json: *const NemoRelayNativeString) -> NemoRelayStatus

Resolves an async callback completion with a JSON value.

async_completion_reject: unsafe extern "C" fn(completion: *const NemoRelayNativeAsyncCompletion, message: *const NemoRelayNativeString) -> NemoRelayStatus

Rejects an async callback completion with a UTF-8 message.

async_completion_is_cancelled: unsafe extern "C" fn(completion: *const NemoRelayNativeAsyncCompletion) -> bool

Returns true after the awaiting runtime has cancelled the invocation.

async_completion_release: unsafe extern "C" fn(completion: *const NemoRelayNativeAsyncCompletion)

Releases the callback-owned reference after a pending completion settles.

async_next_invoke: unsafe extern "C" fn(next: *const NemoRelayNativeAsyncNext, invocation_json: *const NemoRelayNativeString, completion: *const NemoRelayNativeAsyncCompletion) -> NemoRelayStatus

Invokes an execution continuation and settles a supplied completion.

Cancellation of that completion aborts an in-flight continuation. This legacy convenience hook is one-shot because its result settles the middleware completion; use async_next_invoke_result for repeated or concurrent calls.

async_next_release: unsafe extern "C" fn(next: *const NemoRelayNativeAsyncNext)

Releases the callback-owned continuation reference.

Execution callbacks must call this exactly once after their final use for both Complete and Pending return states.

plugin_context_register_async_middleware: unsafe extern "C" fn(ctx: *mut NemoRelayNativePluginContext, kind: u32, name: *const NemoRelayNativeString, priority: i32, break_chain: bool, cb: NemoRelayNativeAsyncMiddlewareCb, user_data: *mut c_void, free_fn: NemoRelayNativeFreeFn) -> NemoRelayStatus

Registers a completion-based asynchronous middleware surface.

kind must be a valid NemoRelayNativeAsyncMiddlewareKind discriminant. The host rejects unknown u32 values and NemoRelayNativeAsyncMiddlewareKind::LlmStreamExecutionIntercept, which must use plugin_context_register_async_stream_middleware.

async_stream_push_json: unsafe extern "C" fn(stream: *const NemoRelayNativeAsyncStream, chunk_json: *const NemoRelayNativeString) -> NemoRelayStatus

Pushes one JSON chunk to an incremental native stream without blocking.

A full bounded host queue returns NemoRelayStatus::Internal and records a backpressure message in the host’s last-error slot. The producer may retry the logical chunk after the consumer advances.

async_stream_finish: unsafe extern "C" fn(stream: *const NemoRelayNativeAsyncStream) -> NemoRelayStatus

Finishes an incremental native stream successfully.

async_stream_reject: unsafe extern "C" fn(stream: *const NemoRelayNativeAsyncStream, message: *const NemoRelayNativeString) -> NemoRelayStatus

Rejects an incremental native stream without blocking.

A full bounded queue returns NemoRelayStatus::Internal; the caller may retry the rejection after the consumer advances.

async_stream_is_cancelled: unsafe extern "C" fn(stream: *const NemoRelayNativeAsyncStream) -> bool

Returns true when the consumer cancelled or released the stream.

async_stream_release: unsafe extern "C" fn(stream: *const NemoRelayNativeAsyncStream)

Releases the callback-owned incremental stream reference.

async_next_invoke_stream: unsafe extern "C" fn(next: *const NemoRelayNativeAsyncNext, invocation_json: *const NemoRelayNativeString, stream: *const NemoRelayNativeAsyncStream, cb: NemoRelayNativeAsyncNextStreamCb, user_data: *mut c_void) -> NemoRelayStatus

Invokes a downstream stream and reports chunks incrementally.

The host reports consumer cancellation through one terminal callback with a non-null error. If a result callback returns false, it must reclaim its own user_data before returning because no terminal callback follows. This hook may be called repeatedly or concurrently with independent callback state while the output stream remains active.

plugin_context_register_async_stream_middleware: unsafe extern "C" fn(ctx: *mut NemoRelayNativePluginContext, name: *const NemoRelayNativeString, priority: i32, cb: NemoRelayNativeAsyncStreamMiddlewareCb, user_data: *mut c_void, free_fn: NemoRelayNativeFreeFn) -> NemoRelayStatus

Registers an incremental asynchronous LLM stream intercept.

async_next_invoke_result: unsafe extern "C" fn(next: *const NemoRelayNativeAsyncNext, invocation_json: *const NemoRelayNativeString, cb: NemoRelayNativeAsyncNextResultCb, user_data: *mut c_void) -> NemoRelayStatus

Invokes a unary execution continuation with an independent result sink.

Unlike the legacy completion-coupled async_next_invoke, this hook may be called repeatedly or concurrently with distinct user_data.

Trait Implementations

impl Clone for NemoRelayNativeHostApiV3

impl Clone for NemoRelayNativeHostApiV3

clone

fn clone(&self) -> NemoRelayNativeHostApiV3

clone_from

fn clone_from(&mut self, source: &Self)

impl Copy for NemoRelayNativeHostApiV3

impl Copy for NemoRelayNativeHostApiV3

impl Send for NemoRelayNativeHostApiV3

impl Send for NemoRelayNativeHostApiV3

impl Sync for NemoRelayNativeHostApiV3

impl Sync for NemoRelayNativeHostApiV3