mirror of
https://github.com/openai/codex.git
synced 2026-10-24 18:18:41 +00:00
## What changed - Define and export skill metadata, policy, dependency, interface, and configuration rule types from `codex-skills`. - Update core, plugin, and extension consumers to use the shared models while retaining compatibility re-exports from `codex-core-skills`. - Share product-restriction handling between host and environment skill metadata. ## Testing - Add unit coverage for default and explicit implicit-invocation and product policies. GitOrigin-RevId: 9093469f8fff8e2d902dc9781235f64709827a87
37 lines
1.2 KiB
Rust
37 lines
1.2 KiB
Rust
use super::*;
|
|
|
|
#[test]
|
|
fn missing_policy_allows_implicit_invocation_and_all_products() {
|
|
let skill = EnvironmentSkillMetadata {
|
|
path_to_skills_md: PathUri::parse("file:///skills/demo/SKILL.md").expect("valid skill URI"),
|
|
name: "demo".to_string(),
|
|
description: "Demo skill".to_string(),
|
|
short_description: None,
|
|
dependencies: None,
|
|
policy: None,
|
|
};
|
|
|
|
assert!(skill.allows_implicit_invocation());
|
|
assert!(skill.matches_product_restriction(/*restriction_product*/ None));
|
|
}
|
|
|
|
#[test]
|
|
fn policy_restricts_implicit_invocation_and_products() {
|
|
let policy = SkillPolicy {
|
|
allow_implicit_invocation: Some(false),
|
|
products: vec![Product::Codex],
|
|
};
|
|
let skill = EnvironmentSkillMetadata {
|
|
path_to_skills_md: PathUri::parse("file:///skills/demo/SKILL.md").expect("valid skill URI"),
|
|
name: "demo".to_string(),
|
|
description: "Demo skill".to_string(),
|
|
short_description: None,
|
|
dependencies: None,
|
|
policy: Some(policy),
|
|
};
|
|
|
|
assert!(!skill.allows_implicit_invocation());
|
|
assert!(skill.matches_product_restriction(Some(Product::Codex)));
|
|
assert!(!skill.matches_product_restriction(/*restriction_product*/ None));
|
|
}
|