Spec conformance: meta support and spec updates (#415)

* feat: add _meta to content blocks and embedded resources; update schemas

* feat: set default protocol version; add _meta to content blocks/resources; update schemas

* chore: format content.rs via rustfmt

* chore(protocol): keep LATEST at 2025-03-26 per review until full 2025-06-18 compliance

* feat(prompt): add constructors with optional meta for image and resource

- Keep text helper; meta is currently ignored for text until schema supports it.

* refactor(prompt): simplify constructors so meta is optional; remove duplicate non-meta variants

* fix: modify code comment about version

* refactor(prompt): rename meta parameters in new_resource function for clarity
This commit is contained in:
Andrew Harvard 2025-09-04 14:23:36 -04:00 • committed by GitHub
commit 4eb413b6c6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -16,8 +16,8 @@ pub struct Annotations {
pub audience: Option<Vec<Role>>,
#[serde(skip_serializing_if = "Option::is_none")]
pub priority: Option<f32>,
#[serde(skip_serializing_if = "Option::is_none")]
pub timestamp: Option<DateTime<Utc>>,
#[serde(skip_serializing_if = "Option::is_none", rename = "lastModified")]
pub last_modified: Option<DateTime<Utc>>,
}
impl Annotations {
@ -30,7 +30,7 @@ impl Annotations {
);
Annotations {
priority: Some(priority),
timestamp: Some(timestamp),
last_modified: Some(timestamp),
audience: None,
}
}
@ -72,7 +72,7 @@ impl<T: AnnotateAble> Annotated<T> {
self.annotations.as_ref().and_then(|a| a.priority)
}
pub fn timestamp(&self) -> Option<DateTime<Utc>> {
self.annotations.as_ref().and_then(|a| a.timestamp)
self.annotations.as_ref().and_then(|a| a.last_modified)
}
pub fn with_audience(self, audience: Vec<Role>) -> Annotated<T>
where
@ -92,7 +92,7 @@ impl<T: AnnotateAble> Annotated<T> {
annotations: Some(Annotations {
audience: Some(audience),
priority: None,
timestamp: None,
last_modified: None,
}),
}
}
@ -114,7 +114,7 @@ impl<T: AnnotateAble> Annotated<T> {
raw: self.raw,
annotations: Some(Annotations {
priority: Some(priority),
timestamp: None,
last_modified: None,
audience: None,
}),
}
@ -128,7 +128,7 @@ impl<T: AnnotateAble> Annotated<T> {
Annotated {
raw: self.raw,
annotations: Some(Annotations {
timestamp: Some(timestamp),
last_modified: Some(timestamp),
..annotations
}),
}
@ -136,7 +136,7 @@ impl<T: AnnotateAble> Annotated<T> {
Annotated {
raw: self.raw,
annotations: Some(Annotations {
timestamp: Some(timestamp),
last_modified: Some(timestamp),
priority: None,
audience: None,
}),
@ -211,7 +211,7 @@ pub trait AnnotateAble: sealed::Sealed {
Self: Sized,
{
self.annotate(Annotations {
timestamp: Some(timestamp),
last_modified: Some(timestamp),
..Default::default()
})
}