Skip to main content

gsm_core/
render_plan.rs

1//! Minimal render-planning types shared across renderers.
2use schemars::JsonSchema;
3use serde::{Deserialize, Serialize};
4use serde_json::Value;
5
6/// Render tiers are coarse buckets for capability and downgrade decisions.
7#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize, JsonSchema)]
8#[serde(rename_all = "snake_case")]
9pub enum RenderTier {
10    TierA,
11    TierB,
12    TierC,
13    TierD,
14}
15
16/// A renderer-independent plan describing what to render and any warnings produced.
17#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize, JsonSchema)]
18pub struct RenderPlan {
19    /// Target capability tier.
20    pub tier: RenderTier,
21    /// Human-friendly summary text (optional).
22    pub summary_text: Option<String>,
23    /// Action identifiers/labels the host can map to platform-specific actions.
24    pub actions: Vec<String>,
25    /// Attachment references (URLs or opaque identifiers) to include in the render.
26    pub attachments: Vec<String>,
27    /// Deterministic warnings emitted during planning.
28    pub warnings: Vec<RenderWarning>,
29    /// Opaque debug payload for diagnostics.
30    pub debug: Option<Value>,
31}
32
33/// Structured warning emitted during render planning.
34#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize, JsonSchema)]
35pub struct RenderWarning {
36    /// Machine-readable warning code (e.g., "text_truncated").
37    pub code: String,
38    /// Optional human-readable description.
39    pub message: Option<String>,
40    /// Optional JSON pointer–like path indicating where the warning applies.
41    pub path: Option<String>,
42}