mirror of
https://github.com/openai/codex.git
synced 2026-11-29 07:35:16 +00:00
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:
1 parent
1151b23f01
commit
bfb6a6ea22
8 files changed
+445
-55
No files matched your search
@@ -6,6 +6,7 @@ use codex_exec_server::WalkEntryKind;
|
||||
use codex_exec_server::WalkOptions;
|
||||
use codex_utils_path_uri::PathUri;
|
||||
use codex_utils_plugins::DISCOVERABLE_PLUGIN_MANIFEST_PATHS;
|
||||
use codex_utils_plugins::SkillDiscoveryMode;
|
||||
|
||||
use super::MAX_SCAN_DEPTH;
|
||||
use super::MAX_SKILLS_DIRS_PER_ROOT;
|
||||
@@ -29,6 +30,7 @@ pub(super) enum HiddenDirectoryPolicy {
|
||||
pub(super) struct SkillDiscoveryOptions {
|
||||
pub directory_symlinks: DirectorySymlinkPolicy,
|
||||
pub hidden_directories: HiddenDirectoryPolicy,
|
||||
pub mode: SkillDiscoveryMode,
|
||||
}
|
||||
|
||||
pub(super) struct SkillDiscovery {
|
||||
@@ -64,7 +66,10 @@ pub(super) async fn discover_skills(
|
||||
.walk(
|
||||
root,
|
||||
WalkOptions {
|
||||
max_depth: MAX_SCAN_DEPTH,
|
||||
max_depth: match options.mode {
|
||||
SkillDiscoveryMode::Recursive => MAX_SCAN_DEPTH,
|
||||
SkillDiscoveryMode::DirectChildren => 2,
|
||||
},
|
||||
max_directories: MAX_SKILLS_DIRS_PER_ROOT,
|
||||
max_entries: MAX_SKILLS_ENTRIES_PER_ROOT,
|
||||
follow_directory_symlinks: matches!(
|
||||
@@ -137,7 +142,15 @@ pub(super) async fn discover_skills(
|
||||
}
|
||||
WalkEntryKind::File => {
|
||||
file_paths.insert(entry.path.clone());
|
||||
if entry.path.basename().as_deref() == Some(SKILLS_FILENAME) {
|
||||
if entry.path.basename().as_deref() == Some(SKILLS_FILENAME)
|
||||
&& (options.mode == SkillDiscoveryMode::Recursive
|
||||
|| entry
|
||||
.path
|
||||
.parent()
|
||||
.and_then(|parent| parent.parent())
|
||||
.as_ref()
|
||||
== Some(root))
|
||||
{
|
||||
skill_files.push(entry.path);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user