Build and Package
The repository example builds a cdylib against the current 1.0.0 SDK and packages it
with a strict schema. Run every command in this procedure from
examples/rust-native-plugin unless a step says otherwise.
Build the Library
The example crate exposes both cdylib and rlib. Relay loads the cdylib; the rlib
lets the example integration tests call validation helpers without loading an unsafe
dynamic boundary. The dependencies use the current 1.0.0 public SDK rather than a Git
revision or an older package line. The path = "../../crates/plugin" override exists
only because this checked example builds inside the NeMo Relay repository. A standalone
plugin depends on the published nemo-relay-plugin = "1.0.0" package without path.
The checked example uses the following package and dependency configuration:
Build and materialize the platform-specific library as follows:
-
Run the example tests and build the debug library.
-
Copy
relay-plugin.tomltorelay-plugin.local.toml. Replace<platform-library-file>insource.artifactandload.librarywith the file Cargo produced:libnemo_relay_rust_native_plugin_example.dylibon macOS,libnemo_relay_rust_native_plugin_example.soon Linux, ornemo_relay_rust_native_plugin_example.dllon Windows. -
Calculate the artifact SHA-256 from the example directory. Use
shasum -a 256 target/debug/<platform-library-file>on macOS,sha256sum target/debug/<platform-library-file>on Linux, orGet-FileHash -Algorithm SHA256 target/debug/<platform-library-file>in PowerShell. Put the lowercase result after the existingsha256:prefix.
At this point, success means the tests pass, the library exists at both manifest paths, and the digest describes those exact bytes.
Understand the Manifest
The checked manifest template declares the plugin identity, version contracts, schema, library path, and integrity evidence:
The source.artifact and load.library paths must identify the same library. Replace
<artifact-sha256> with the lowercase digest of those bytes. The exported descriptor’s
plugin kind must exactly match plugin.id. The schema includes
the SDK-owned executor.worker_threads property because this example opts into shared
Tokio support and allows a component override. additionalProperties: false prevents
an operator typo from silently becoming inactive configuration.
The native-only schema fragment below gives the SDK executor override a strict positive
integer. executor_config_for_component performs the corresponding runtime validation,
so direct activation and package validation agree.
Package Native Dependencies
Include linked native libraries in the package. Keep the relative paths used by
the library’s runtime search paths. These paths tell the operating system where
to find dependencies after Relay copies the package into protected staging.
For example, use $ORIGIN paths on Linux or @loader_path and @rpath paths on
macOS. On Windows, place sidecar DLLs beside the plugin DLL.
Relay reads the binary imports and copies the package-local dependency chain. Use loader-relative paths for package dependencies. Relay rejects absolute package paths and sidecars whose library names conflict with different bytes already loaded in the process. Give different sidecar implementations unique library names.
List each package-local dependency’s SHA-256 digest under integrity.dependencies.
Use its package-relative file path with forward slashes. For symbolic links, use
the target file’s path. Sign each dependency when the host requires signatures or
when the main library is signed. Signature paths are relative to the manifest.
Relay verifies the captured dependency bytes before it loads any library.
For a dependency stored at lib/helper.so, add the following evidence:
System libraries use the operating system’s search rules. Libraries and their captured dependencies stay loaded until Relay exits.
Validate and Activate
Use the following procedure to validate the package, activate it, and remove it safely:
-
From the repository root, validate the local manifest before adding it.
-
Register and enable the package in the user configuration.
-
Add the shared scenario configuration under the dynamic record, including
executor.worker_threads = 2. Start Relay with the package enabled, inspect the activation report, and execute the documented tool and LLM calls. -
Change
requests.modeto an unsupported value and validate again. Then restore the valid value, add an unknown property, and verify that static package validation rejects the schema violation. During component validation, confirm that the plugin’s diagnostic also reports the field rather than ignoring it. -
Disable and remove the package after clearing the active component.
Success means manifest and schema validation fail before loading altered or invalid artifacts, a valid component produces an active runtime report, representative calls show the configured behavior, and removal occurs only after the host reports that the component registrations have been cleared.