mirror of
https://github.com/openai/codex.git
synced 2026-11-26 07:26:11 +00:00
Parse model annotations from skill frontmatter (#38467)
## What changed - Add an optional `model` field to parsed and loaded skill metadata. - Recognize `model: luna` while ignoring unsupported model values without preventing the rest of the skill metadata from loading. ## Testing - Cover supported, absent, unsupported, and repaired frontmatter model values. GitOrigin-RevId: 376b65555e81d29a5eae93cc4c2633aacf7cd7c8
This commit is contained in:
1 parent
c6dee5f49f
commit
3711943d11
17 files changed
+122
-1
No files matched your search
@@ -1,3 +1,4 @@
|
||||
use crate::SkillModel;
|
||||
use serde::Deserialize;
|
||||
use thiserror::Error;
|
||||
|
||||
@@ -10,6 +11,8 @@ struct SkillFrontmatter {
|
||||
#[serde(default)]
|
||||
description: Option<String>,
|
||||
#[serde(default)]
|
||||
model: Option<serde_yaml::Value>,
|
||||
#[serde(default)]
|
||||
metadata: SkillFrontmatterMetadata,
|
||||
}
|
||||
|
||||
@@ -25,6 +28,7 @@ pub struct ParsedSkillFrontmatter {
|
||||
pub name: String,
|
||||
pub description: String,
|
||||
pub short_description: Option<String>,
|
||||
pub model: Option<SkillModel>,
|
||||
}
|
||||
|
||||
/// Error produced while parsing or validating `SKILL.md` metadata.
|
||||
@@ -88,6 +92,13 @@ pub fn parse_skill_frontmatter_metadata(
|
||||
name,
|
||||
description,
|
||||
short_description,
|
||||
model: parsed.model.and_then(|model| {
|
||||
serde_yaml::from_value(model)
|
||||
.inspect_err(|error| {
|
||||
tracing::warn!(%error, "ignoring invalid skill model annotation");
|
||||
})
|
||||
.ok()
|
||||
}),
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user