mirror of
https://github.com/openai/codex.git
synced 2026-11-13 14:46:14 +00:00
Generalize skill locator aliases across providers (#37488)
## What changed - Compact executor and orchestrator skill locators under metadata pressure, using provider-specific `e` and `o` aliases alongside host `r` aliases. - Derive alias roots from executor discovery paths and orchestrator namespaces while preserving host plugin root handling. - Centralize alias ordering, deduplication, and longest-prefix matching across skill providers. ## Testing - Cover alias planning, cross-platform executor roots, and host plugin discovery. GitOrigin-RevId: e7d15bd3891c08ae20170e96c4ad45c76d353707
This commit is contained in:
1 parent
27e4a05cd3
commit
ce22ea9712
12 files changed
+458
-218
No files matched your search
@@ -89,6 +89,7 @@ impl SkillProvider for ExecutorSkillProvider {
|
||||
&skill,
|
||||
authority.clone(),
|
||||
selected_root_id,
|
||||
path,
|
||||
environment_id,
|
||||
/*instructions*/ None,
|
||||
));
|
||||
@@ -172,8 +173,10 @@ impl ExecutorSkillProvider {
|
||||
let mut catalog = SkillCatalog::default();
|
||||
for root in snapshot.roots() {
|
||||
let selected_root_id = &root.selected_root.id;
|
||||
let CapabilityRootLocation::Environment { environment_id, .. } =
|
||||
&root.selected_root.location;
|
||||
let CapabilityRootLocation::Environment {
|
||||
environment_id,
|
||||
path,
|
||||
} = &root.selected_root.location;
|
||||
let discovery = match &root.result {
|
||||
Ok(discovery) => discovery.as_ref(),
|
||||
Err(error) => {
|
||||
@@ -193,6 +196,7 @@ impl ExecutorSkillProvider {
|
||||
&skill.metadata,
|
||||
authority.clone(),
|
||||
selected_root_id,
|
||||
path,
|
||||
environment_id,
|
||||
Some(skill.instructions),
|
||||
));
|
||||
@@ -206,10 +210,15 @@ fn catalog_entry_from_skill(
|
||||
skill: &EnvironmentSkillMetadata,
|
||||
authority: SkillAuthority,
|
||||
selected_root_id: &str,
|
||||
selected_root_path: &PathUri,
|
||||
environment_id: &str,
|
||||
instructions: Option<String>,
|
||||
) -> SkillCatalogEntry {
|
||||
let handle_prefix = format!("skill://{selected_root_id}/");
|
||||
let alias_root = format!(
|
||||
"{handle_prefix}{}",
|
||||
normalized_environment_path(selected_root_path).trim_start_matches('/')
|
||||
);
|
||||
let normalized_main_path = normalized_environment_path(&skill.path_to_skills_md);
|
||||
let normalized_package_path = skill.path_to_skills_md.parent().map_or_else(
|
||||
|| normalized_main_path.clone(),
|
||||
@@ -245,6 +254,7 @@ fn catalog_entry_from_skill(
|
||||
)
|
||||
.with_short_description(skill.short_description.clone())
|
||||
.with_display_path(main_resource)
|
||||
.with_alias_root(alias_root)
|
||||
.with_dependencies(skill.dependencies.clone());
|
||||
|
||||
if skill.allows_implicit_invocation() {
|
||||
|
||||
@@ -112,9 +112,9 @@ fn catalog_from_outcome(outcome: &SkillLoadOutcome) -> SkillCatalog {
|
||||
entry = entry.with_display_path(discovery_path.to_string_lossy().replace('\\', "/"));
|
||||
}
|
||||
if let Some(root) = outcome.skill_root_for_path(&skill.path_to_skills_md) {
|
||||
entry = entry.with_display_path_root(root.to_string_lossy().replace('\\', "/"));
|
||||
entry = entry.with_alias_root(root.to_string_lossy().replace('\\', "/"));
|
||||
if let Some(root_order) = root_order_by_path.get(root.as_path()) {
|
||||
entry = entry.with_display_path_root_order(*root_order);
|
||||
entry = entry.with_alias_root_order(*root_order);
|
||||
}
|
||||
}
|
||||
catalog.push_entry(entry);
|
||||
|
||||
@@ -48,7 +48,7 @@ async fn host_catalog_entries_carry_their_render_metadata() -> Result<(), Box<dy
|
||||
assert_eq!(catalog.entries.len(), 1);
|
||||
assert_eq!(
|
||||
(
|
||||
catalog.entries[0].display_path_root(),
|
||||
catalog.entries[0].alias_root(),
|
||||
catalog.entries[0].prompt_scope(),
|
||||
),
|
||||
(
|
||||
@@ -96,7 +96,7 @@ async fn host_catalog_preserves_symlinked_skill_discovery_paths()
|
||||
(
|
||||
catalog.entries[0].main_prompt.as_str(),
|
||||
catalog.entries[0].display_path.as_deref(),
|
||||
catalog.entries[0].display_path_root(),
|
||||
catalog.entries[0].alias_root(),
|
||||
),
|
||||
(
|
||||
canonical_path.to_string_lossy().as_ref(),
|
||||
|
||||
@@ -246,6 +246,7 @@ impl SkillProvider for OrchestratorSkillProvider {
|
||||
|
||||
fn catalog_entry_from_resource(resource: &Resource) -> Option<SkillCatalogEntry> {
|
||||
let uri = validated_skill_uri(resource.uri.as_str(), MAX_SKILL_PACKAGE_URI_CHARS)?;
|
||||
let namespace = uri.strip_prefix("skill://")?.split_once('/')?.0;
|
||||
let meta = resource.meta.as_ref()?.as_object()?;
|
||||
let allow_implicit_invocation = meta
|
||||
.get("allow_implicit_invocation")
|
||||
@@ -271,7 +272,8 @@ fn catalog_entry_from_resource(resource: &Resource) -> Option<SkillCatalogEntry>
|
||||
description,
|
||||
SkillResourceId::new(main_prompt),
|
||||
)
|
||||
.with_display_path(uri);
|
||||
.with_display_path(uri)
|
||||
.with_alias_root(format!("skill://{namespace}"));
|
||||
|
||||
Some(if allow_implicit_invocation {
|
||||
entry
|
||||
|
||||
Reference in new issue
Block a user