Skip to main content

mur_common/multimodal/
artifact.rs

1use serde::{Deserialize, Serialize};
2
3#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
4#[serde(rename_all = "snake_case")]
5pub enum ArtifactKind {
6    Image,
7    Pdf,
8    Text,
9}
10
11/// In-memory record of one dropped/pasted artifact.
12///
13/// Consumed by:
14/// * the GUI composer (thumbnails + remove control)
15/// * `mur-agent-runtime`'s `B0SafetyHook` (untrusted wrapper injection,
16///   side-effect-tool deny via the `after_untrusted_input` turn-flag).
17///
18/// `decoder_version` and `ocr_engine_version` are persisted in
19/// `telemetry/inputs.jsonl` so a future audit can reproduce the exact
20/// decode chain.
21#[derive(Debug, Clone, Serialize, Deserialize)]
22pub struct MultimodalArtifact {
23    /// Content hash of the *re-encoded* (sanitized) bytes.
24    pub sha256: String,
25    pub kind: ArtifactKind,
26    pub mime: String,
27    pub size_bytes: u64,
28    /// OCR'd text for images, extracted text for PDFs. None for `text/*`
29    /// (the body itself is the text).
30    pub ocr_text: Option<String>,
31    /// Page count for PDFs. None for images.
32    pub page_count: Option<u32>,
33    pub created_at: chrono::DateTime<chrono::Utc>,
34    pub decoder_version: String,
35    pub ocr_engine_version: Option<String>,
36}