Skip to main content

ReferenceMeta

Struct ReferenceMeta 

Source
pub struct ReferenceMeta {
    pub id: String,
    pub kind: String,
    pub destination: String,
    pub mime: Option<String>,
    pub filename: Option<String>,
    pub size_bytes: Option<i64>,
    pub provenance: ReferenceProvenance,
    pub actions: Vec<String>,
}
Expand description

Persisted (metadata-only) reference attached to a user turn. Mirrors the TypeScript ReferenceMeta shape used by the desktop composer. No image bytes live here — the desktop keeps the bytes in-memory only; this record is the transcript-visible card (filename, size, kind, trust) that the UI persists under cr.references.v1 and re-attaches on restart.

Wire compatibility: all fields use #[serde(default)] and skip_serializing_if so legacy rows (pre-references) deserialize cleanly. ReferenceMeta is exposed as a standalone type — the desktop owns the transcript mutation surface in the user-message variant, and Agent 4’s integration pass binds this type into the PostMessage body when the composer forwards references to the engine.

Fields§

§id: String

Stable client-generated id (uuid v4 on the desktop). Reused by the transcript’s chip strip and the inline resolver; never recast on restart so the chip identity survives a page reload.

§kind: String

"external_link" | "workspace_file" | "generated_document" | "image" | "artifact" | "change_set". Free-form on the wire so a future kind can be introduced without breaking older clients; the desktop renders unknown kinds as a generic chip.

§destination: String

Display target: URL, workspace-relative path, doc id, artifact id, or change-set id. Used by openExternal / revealInFolder / file resolver.

§mime: Option<String>

Optional MIME hint — "image/png", "text/markdown", "application/octet-stream", etc.

§filename: Option<String>

Display filename shown on the chip when kind is image, workspace_file, or generated_document. Optional for external_link and change_set where the destination is the label.

§size_bytes: Option<i64>

Best-effort byte count for the original artifact. None for external_link and change_set where the size is not knowable up front.

§provenance: ReferenceProvenance

Provenance + trust. source is the producer string ("composer.paste", "workspace_resolver", etc.), createdAt is the ISO timestamp the user added the reference, trust is the ContentTrust label, contentHash (when known) is the SHA-256 of the original bytes — present for image / workspace_file / generated_document once the desktop has read the file.

§actions: Vec<String>

Action affordances the chip exposes. Free-form on the wire; the desktop renders the intersection with its known action set so a future download action sent from a newer sender doesn’t break an older renderer.

Implementations§

Source§

impl ReferenceMeta

Source

pub fn empty(id: &str, kind: &str, destination: &str) -> Self

Wire-friendly default: an empty record with no actions / no MIME / no size. Useful for tests that need a placeholder.

Trait Implementations§

Source§

impl Clone for ReferenceMeta

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ReferenceMeta

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for ReferenceMeta

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Eq for ReferenceMeta

Source§

impl PartialEq for ReferenceMeta

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl Serialize for ReferenceMeta

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for ReferenceMeta

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.