MCPcopy Create free account
hub / github.com/NVIDIA/NeMo-Relay / layer_config

Function layer_config

crates/core/src/plugin.rs:909–924  ·  view source on GitHub ↗

Layers `right` (higher precedence) onto `left` in place. Objects merge recursively and arrays/scalars are replaced by `right`, except the top-level `components` array, whose entries pair by `kind` in order of appearance so multi-instance kinds are not collapsed. Internal helper shared by plugin initialization and `plugins.toml` discovery.

(left: &mut Json, right: Json)

Source from the content-addressed store, hash-verified

907/// multi-instance kinds are not collapsed. Internal helper shared by plugin
908/// initialization and `plugins.toml` discovery.
909fn layer_config(left: &mut Json, right: Json) {
910 match (left, right) {
911 (Json::Object(left), Json::Object(right)) => {
912 for (key, value) in right {
913 match (key.as_str(), left.get_mut(&key)) {
914 ("components", Some(existing)) => merge_plugin_components(existing, value),
915 (_, Some(existing)) => merge_json_value(existing, value),
916 (_, _) => {
917 left.insert(key, value);
918 }
919 }
920 }
921 }
922 (left, right) => *left = right,
923 }
924}
925
926/// Merges `right` components into `left` by `kind`, pairing repeated kinds positionally.
927fn merge_plugin_components(left: &mut Json, right: Json) {

Calls 3

merge_plugin_componentsFunction · 0.85
merge_json_valueFunction · 0.85
as_strMethod · 0.45