Skip to main content

treeship_core/session/
render.rs

1//! Render configuration for Explorer Session Reports.
2//!
3//! Lightweight hints embedded in the .treeship package that tell
4//! Explorer how to present the session receipt visually.
5
6use serde::{Deserialize, Serialize};
7
8/// Render configuration for the session report.
9#[derive(Debug, Clone, Default, Serialize, Deserialize)]
10pub struct RenderConfig {
11    /// Display title for the report.
12    #[serde(skip_serializing_if = "Option::is_none")]
13    pub title: Option<String>,
14
15    /// Theme name (e.g., "default", "dark", "minimal").
16    #[serde(skip_serializing_if = "Option::is_none")]
17    pub theme: Option<String>,
18
19    /// Which sections to render and in what order.
20    #[serde(default, skip_serializing_if = "Vec::is_empty")]
21    pub sections: Vec<RenderSection>,
22
23    /// Whether to generate a preview.html in the package.
24    #[serde(default = "default_true")]
25    pub generate_preview: bool,
26}
27
28fn default_true() -> bool { true }
29
30/// A section in the rendered report.
31#[derive(Debug, Clone, Serialize, Deserialize)]
32pub struct RenderSection {
33    /// Section identifier.
34    pub id: String,
35
36    /// Human-readable section label.
37    pub label: String,
38
39    /// Whether this section is visible by default.
40    #[serde(default = "default_true")]
41    pub visible: bool,
42}
43
44impl RenderConfig {
45    /// Default sections matching the spec's Explorer UX.
46    pub fn default_sections() -> Vec<RenderSection> {
47        vec![
48            RenderSection { id: "summary".into(), label: "Session Summary".into(), visible: true },
49            RenderSection { id: "participants".into(), label: "Participant Strip".into(), visible: true },
50            RenderSection { id: "agent_graph".into(), label: "Delegation & Collaboration Graph".into(), visible: true },
51            RenderSection { id: "timeline".into(), label: "Mission Timeline".into(), visible: true },
52            RenderSection { id: "side_effects".into(), label: "Side-Effect Ledger".into(), visible: true },
53            RenderSection { id: "proofs".into(), label: "Proofs Panel".into(), visible: true },
54        ]
55    }
56}