diff --git a/codex-rs/ext/skills/src/host_outcome.rs b/codex-rs/ext/skills/src/host_outcome.rs index 18d8d1bd0f..2a63fa6d0f 100644 --- a/codex-rs/ext/skills/src/host_outcome.rs +++ b/codex-rs/ext/skills/src/host_outcome.rs @@ -27,7 +27,7 @@ pub struct SkillLoadOutcome { impl SkillLoadOutcome { /// Builds an already-composed outcome while retaining the filesystem that supplied each skill. - pub fn from_parts( + pub(crate) fn from_parts( skills: Vec, errors: Vec, skill_roots: Vec, @@ -52,25 +52,13 @@ impl SkillLoadOutcome { !self.disabled_paths.contains(&skill.path_to_skills_md) } - pub fn is_skill_allowed_for_implicit_invocation(&self, skill: &SkillMetadata) -> bool { - self.is_skill_enabled(skill) && skill.allows_implicit_invocation() - } - - pub fn allowed_skills_for_implicit_invocation(&self) -> Vec { - self.skills - .iter() - .filter(|skill| self.is_skill_allowed_for_implicit_invocation(skill)) - .cloned() - .collect() - } - - pub fn skills_with_enabled(&self) -> impl Iterator { + pub(crate) fn skills_with_enabled(&self) -> impl Iterator { self.skills .iter() .map(|skill| (skill, self.is_skill_enabled(skill))) } - pub fn with_disabled_paths(mut self, disabled_paths: HashSet) -> Self { + pub(crate) fn with_disabled_paths(mut self, disabled_paths: HashSet) -> Self { self.disabled_paths = disabled_paths; let mut by_scripts_dir = HashMap::new(); let mut by_doc_path = HashMap::new(); @@ -92,18 +80,18 @@ impl SkillLoadOutcome { self } - pub fn is_agent_plugin_skill(&self, skill: &SkillMetadata) -> bool { + pub(crate) fn is_agent_plugin_skill(&self, skill: &SkillMetadata) -> bool { self.agent_plugin_skill_paths .contains(&skill.path_to_skills_md) } /// Returns the discovery root that supplied a loaded skill path. - pub fn skill_root_for_path(&self, path: &AbsolutePathBuf) -> Option<&AbsolutePathBuf> { + pub(crate) fn skill_root_for_path(&self, path: &AbsolutePathBuf) -> Option<&AbsolutePathBuf> { self.skill_root_by_path.get(path) } /// Returns the logical path used to discover a canonical skill path. - pub fn skill_discovery_path_for_path( + pub(crate) fn skill_discovery_path_for_path( &self, path: &AbsolutePathBuf, ) -> Option<&AbsolutePathBuf> { @@ -111,7 +99,7 @@ impl SkillLoadOutcome { } /// Returns loaded skill roots in discovery order. - pub fn skill_roots_in_discovery_order(&self) -> impl Iterator { + pub(crate) fn skill_roots_in_discovery_order(&self) -> impl Iterator { self.skill_roots.iter() } @@ -124,7 +112,7 @@ impl SkillLoadOutcome { } /// Reads one loaded skill through the filesystem that discovered it. - pub async fn read_skill_text(&self, skill: &SkillMetadata) -> io::Result { + pub(crate) async fn read_skill_text(&self, skill: &SkillMetadata) -> io::Result { let fs = self .file_system_for_skill(skill) .unwrap_or_else(|| Arc::clone(&LOCAL_FS)); diff --git a/codex-rs/ext/skills/src/host_service.rs b/codex-rs/ext/skills/src/host_service.rs index a7357420f0..d07a097192 100644 --- a/codex-rs/ext/skills/src/host_service.rs +++ b/codex-rs/ext/skills/src/host_service.rs @@ -40,10 +40,10 @@ use crate::loader::load_and_merge_host_skill_roots_with_request_snapshots; #[derive(Debug, Clone)] pub struct HostSkillsLoadInput { - pub cwd: AbsolutePathBuf, - pub effective_skill_roots: Vec, - pub config_layer_stack: ConfigLayerStack, - pub bundled_skills_enabled: bool, + cwd: AbsolutePathBuf, + effective_skill_roots: Vec, + config_layer_stack: ConfigLayerStack, + bundled_skills_enabled: bool, plugin_skill_snapshots: Option>, } diff --git a/codex-rs/ext/skills/src/host_service_tests.rs b/codex-rs/ext/skills/src/host_service_tests.rs index 240f718816..86ed5538b1 100644 --- a/codex-rs/ext/skills/src/host_service_tests.rs +++ b/codex-rs/ext/skills/src/host_service_tests.rs @@ -5,6 +5,7 @@ use codex_config::ConfigLayerSource; use codex_config::ConfigLayerStack; use codex_config::ConfigRequirementsToml; use codex_exec_server::LOCAL_FS; +use codex_skills::ImplicitSkillLookup; use codex_skills::LoadedSkillRoot; use codex_skills::SkillRootSnapshotCache; use codex_skills::SkillRootSnapshots; @@ -662,10 +663,9 @@ async fn skills_for_config_disables_plugin_skills_by_name() { assert_eq!(skill.path_to_skills_md, skill_path); assert!(outcome.disabled_paths.contains(&skill.path_to_skills_md)); assert!( - !outcome - .allowed_skills_for_implicit_invocation() - .iter() - .any(|allowed_skill| allowed_skill.path_to_skills_md == skill.path_to_skills_md) + outcome + .implicit_skill_for_doc_path(&skill.path_to_skills_md) + .is_none() ); } diff --git a/codex-rs/ext/skills/src/loader/host.rs b/codex-rs/ext/skills/src/loader/host.rs index 673c9114e2..41b54fd6d8 100644 --- a/codex-rs/ext/skills/src/loader/host.rs +++ b/codex-rs/ext/skills/src/loader/host.rs @@ -109,13 +109,13 @@ impl HostSkillRoot { /// Skills and errors loaded from one canonical host root. #[derive(Clone)] -pub struct HostSkillRootSnapshot { - pub root: AbsolutePathBuf, - pub skills: Vec, - pub skill_discovery_path_by_path: Arc>, - pub errors: Vec, - pub file_system: Arc, - pub is_agent_plugin: bool, +pub(crate) struct HostSkillRootSnapshot { + pub(crate) root: AbsolutePathBuf, + pub(crate) skills: Vec, + pub(crate) skill_discovery_path_by_path: Arc>, + pub(crate) errors: Vec, + pub(crate) file_system: Arc, + pub(crate) is_agent_plugin: bool, } struct ResolvedDiscoveredSkill { @@ -124,7 +124,7 @@ struct ResolvedDiscoveredSkill { path_uri: PathUri, } -pub async fn load_host_skill_root(root: HostSkillRoot) -> HostSkillRootSnapshot { +pub(crate) async fn load_host_skill_root(root: HostSkillRoot) -> HostSkillRootSnapshot { let is_agent_plugin = root.discovery_mode() == SkillDiscoveryMode::DirectChildren; let canonical_root = canonicalize_for_skill_identity(root.file_system.as_ref(), &root.path).await;