Support plugin roots in the host skill loader (#37267)

## What changed

- Carry plugin identity, namespace, root, and discovery mode through host skill loading.
- Apply the owning plugin namespace and IDs to loaded skill metadata.
- Respect direct-child discovery for Agent Plugins and reject skills that resolve outside the plugin root or are not regular files.
- Preserve recursive discovery and symlink behavior for legacy plugin roots, and allow the full 64-character namespace plus 64-character skill name.

## Testing

Add host-loader coverage for plugin metadata, namespace ownership, direct-child filtering, path containment, recursive symlinks, shared assets, and maximum-length qualified names.

GitOrigin-RevId: cdde821643ce39bd030d0c3753b3304b75161690
This commit is contained in:
felixxia-oai authored and copyberry committed 2026-08-06 12:44:36 +00:00
1 parent 1151b23f01
commit bfb6a6ea22
8 files changed
+445 -55

No files matched your search

+11 -18
View File
@@ -99,12 +99,11 @@ fn roots_from_layer_stack(
match &layer.name {
ConfigLayerSource::Project { .. } => {
if let Some(repository_file_system) = &repository_file_system {
roots.push(HostSkillRoot {
path: config_folder.join(SKILLS_DIR_NAME),
scope: SkillScope::Repo,
file_system: Arc::clone(repository_file_system),
plugin_root: None,
});
roots.push(HostSkillRoot::host(
config_folder.join(SKILLS_DIR_NAME),
SkillScope::Repo,
Arc::clone(repository_file_system),
));
}
}
ConfigLayerSource::User { .. } => {
@@ -145,12 +144,7 @@ fn roots_from_layer_stack(
}
fn local_root(path: AbsolutePathBuf, scope: SkillScope) -> HostSkillRoot {
HostSkillRoot {
path,
scope,
file_system: Arc::clone(&LOCAL_FS),
plugin_root: None,
}
HostSkillRoot::host(path, scope, Arc::clone(&LOCAL_FS))
}
fn host_root_to_skill_root(root: HostSkillRoot) -> SkillRoot {
@@ -193,12 +187,11 @@ async fn repo_agents_skill_roots(
.buffered(MAX_CONCURRENT_ANCESTOR_PROBES);
while let Some((agents_skills, result)) = results.next().await {
match result {
Ok(metadata) if metadata.is_directory => roots.push(HostSkillRoot {
path: agents_skills,
scope: SkillScope::Repo,
file_system: Arc::clone(&repository_file_system),
plugin_root: None,
}),
Ok(metadata) if metadata.is_directory => roots.push(HostSkillRoot::host(
agents_skills,
SkillScope::Repo,
Arc::clone(&repository_file_system),
)),
Ok(_) => {}
Err(error) if error.kind() == io::ErrorKind::NotFound => {}
Err(error) => {