pub struct SkillExposure {
pub alias: String,
pub argument: String,
}Expand description
A capability as a skill a person invokes by a short name from an agent’s prompt:
/intent <sentence> in Claude Code. The name and the one input field the typed text
fills are declared here, once; the file an agent product reads is generated from them
(the editors module) and carries no description of what the capability does beyond
the capability’s own.
use majordomus_cli::capability::SkillExposure;
let s = SkillExposure { alias: "intent".into(), argument: "statement".into() };
assert!(s.validate().is_ok());
// a name an agent product already owns is refused, and so is one that is not a name
let taken = SkillExposure { alias: "review".into(), argument: "x".into() };
assert!(taken.validate().unwrap_err().contains("reserved"));
let shouted = SkillExposure { alias: "Intent".into(), argument: "x".into() };
assert!(shouted.validate().is_err());Fields§
§alias: StringThe name typed after the slash: lowercase letters, digits and hyphens, at most 64.
argument: StringThe input field the text typed after the name fills, verbatim.
Implementations§
Source§impl SkillExposure
impl SkillExposure
Sourcepub fn validate(&self) -> Result<(), String>
pub fn validate(&self) -> Result<(), String>
Is the alias a name an agent product will accept and does not already own, and is an argument named?
use majordomus_cli::capability::{SkillExposure, RESERVED_SKILL_NAMES};
let skill = |alias: &str, argument: &str| SkillExposure {
alias: alias.into(),
argument: argument.into(),
};
assert!(skill("propose-intent", "statement").validate().is_ok());
assert!(skill("-intent", "statement").validate().is_err());
assert!(skill("intent", "").validate().unwrap_err().contains("no input field"));
// every reserved name is refused, by name
for reserved in RESERVED_SKILL_NAMES {
assert!(skill(reserved, "x").validate().unwrap_err().contains("reserved"));
}Trait Implementations§
Source§impl Clone for SkillExposure
impl Clone for SkillExposure
Source§fn clone(&self) -> SkillExposure
fn clone(&self) -> SkillExposure
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for SkillExposure
impl Debug for SkillExposure
Source§impl<'de> Deserialize<'de> for SkillExposure
impl<'de> Deserialize<'de> for SkillExposure
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for SkillExposure
Source§impl JsonSchema for SkillExposure
impl JsonSchema for SkillExposure
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Returns a string that uniquely identifies the schema produced by this type. Read more
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Generates a JSON Schema for this type. Read more
Source§fn inline_schema() -> bool
fn inline_schema() -> bool
Whether JSON Schemas generated for this type should be included directly in parent schemas,
rather than being re-used where possible using the
$ref keyword. Read moreSource§impl PartialEq for SkillExposure
impl PartialEq for SkillExposure
Source§fn eq(&self, other: &SkillExposure) -> bool
fn eq(&self, other: &SkillExposure) -> bool
Tests for
self and other values to be equal, and is used by ==.Source§impl Serialize for SkillExposure
impl Serialize for SkillExposure
impl StructuralPartialEq for SkillExposure
Auto Trait Implementations§
impl Freeze for SkillExposure
impl RefUnwindSafe for SkillExposure
impl Send for SkillExposure
impl Sync for SkillExposure
impl Unpin for SkillExposure
impl UnsafeUnpin for SkillExposure
impl UnwindSafe for SkillExposure
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.