tf-types 0.1.6

Core semantic types, traits, and schemas powering the TrustForge protocol.
Documentation
// GENERATED by `tf-schema codegen --target rust` — DO NOT EDIT BY HAND.

#![allow(unused_imports, non_camel_case_types, non_snake_case, clippy::all)]

use serde::{Deserialize, Serialize};
use super::*;

/// Signed record of an important event (TF-0005). Hash-chain verification lives in Phase 2.
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
pub struct ProofEvent {
    /// Version of the proof-event schema itself.
    pub event_version: ProofEvent_EventVersion,
    /// Stable event identifier.
    pub id: String,
    /// Dotted event-type identifier, e.g. session.established, action.approved.
    #[serde(rename = "type")]
    pub type_: String,
    /// Actor that produced the event.
    pub actor_id: ActorId,
    /// Specific actor instance that produced the event.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub instance_id: Option<InstanceId>,
    /// Session identifier this event belongs to.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub session_id: Option<String>,
    /// When the event occurred.
    pub timestamp: Timestamp,
    /// Proof level at which this event was emitted.
    pub level: ProofLevel,
    /// Reference to the object this event is about (capability ID, file hash, etc.).
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub subject_ref: Option<String>,
    /// Hash of the event's associated payload.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub payload_hash: Option<HashRef>,
    /// Hash of the immediately preceding event in the hash-chain.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub parent_hash: Option<HashRef>,
    /// Free-form context object carried with the event.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub context: Option<serde_json::Value>,
    /// Chain of responsibility for this event: who/what authorised, requested, and executed the action. TF-0006 "chain of responsibility".
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub provenance: Option<ProofEvent_Provenance>,
    /// Signature envelope over the canonical form of this event (not verified in the foundation phase).
    pub signature: SignatureEnvelope,
}

/// Version of the proof-event schema itself.
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
pub enum ProofEvent_EventVersion {
    #[serde(rename = "1")]
    V1,
}

/// Chain of responsibility for this event: who/what authorised, requested, and executed the action. TF-0006 "chain of responsibility".
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
pub struct ProofEvent_Provenance {
    /// Human originator.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub human: Option<ActorId>,
    /// AI agent that issued the request.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub agent: Option<ActorId>,
    /// Specific running instance of the agent.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub instance: Option<InstanceId>,
    /// Model identifier (provider-prefixed) the agent invoked, e.g. anthropic:claude-opus-4-7.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub model: Option<String>,
    /// Tool / function name (e.g. MCP tool) the agent called.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub tool: Option<String>,
    /// Action the agent originally asked to perform.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub requested_action: Option<ActionName>,
}