reasoninglayer 0.1.2

Rust client SDK for the Reasoning Layer API
Documentation
//! Evidence-grounded document generation DTOs.

use std::collections::BTreeMap;

use serde::{Deserialize, Serialize};

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct GenerationProvenanceDto {
    pub description: String,
    pub location: String,
    pub source_fact_id: String,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct ArtifactDto {
    pub content: String,
    pub label: String,
    pub modality: String,
    #[serde(default)]
    pub provenance: Vec<GenerationProvenanceDto>,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct DiagnosticDto {
    pub level: String,
    pub message: String,
    pub stage: String,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct ConstraintCheckDto {
    pub description: String,
    pub satisfied: bool,
}

/// Violation from the oversight pipeline. The typed canonical form will land alongside the
/// `oversight` resource DTOs in a future patch release; for now this is a free-form JSON value.
pub type ViolationDto = serde_json::Value;

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct GenerationVerificationDto {
    #[serde(default)]
    pub checks: Vec<ConstraintCheckDto>,
    pub coverage: f64,
    pub passed: bool,
    pub soft_constraint_score: f64,
    #[serde(default)]
    pub violations: Vec<ViolationDto>,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct GenerateDocumentRequest {
    #[serde(default, skip_serializing_if = "BTreeMap::is_empty")]
    pub metadata: BTreeMap<String, String>,
    pub modality: String,
    pub root_term_id: String,
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub tenant_id: Option<String>,
}

#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub struct GenerateDocumentResponse {
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub artifact: Option<ArtifactDto>,
    #[serde(default)]
    pub diagnostics: Vec<DiagnosticDto>,
    pub success: bool,
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub verification: Option<GenerationVerificationDto>,
}