proofborne-core 0.1.0-alpha.3

Versioned contracts, events, provider types, and proof graph for Proofborne
Documentation
use serde::{Deserialize, Serialize};
use serde_json::Value;

/// JSON-schema-described tool visible to providers.
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
#[serde(rename_all = "camelCase")]
pub struct ToolDefinition {
    /// Stable tool name.
    pub name: String,
    /// Concise behavior and boundary description.
    pub description: String,
    /// JSON Schema for arguments.
    pub input_schema: Value,
    /// Runtime risk class, never inferred from an untrusted description.
    pub action_class: ActionClass,
}

/// Structured provider-requested tool call.
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
#[serde(rename_all = "camelCase")]
pub struct ToolCall {
    /// Provider call identifier.
    pub id: String,
    /// Registered tool name.
    pub name: String,
    /// Schema-validated arguments.
    pub arguments: Value,
    /// Contract criteria whose proof obligations justify this action.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    pub obligation_ids: Vec<String>,
}

/// Structured runtime result returned to the provider.
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
#[serde(rename_all = "camelCase")]
pub struct ToolResult {
    /// Original call identifier.
    pub call_id: String,
    /// Tool name.
    pub name: String,
    /// Whether invocation succeeded.
    pub success: bool,
    /// Public/redacted output.
    pub output: Value,
    /// Evidence node produced by the runtime.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub evidence_id: Option<uuid::Uuid>,
}

/// Runtime-owned action classification.
#[derive(Debug, Clone, Copy, Serialize, Deserialize, PartialEq, Eq, PartialOrd, Ord)]
#[serde(rename_all = "snake_case")]
pub enum ActionClass {
    /// Reads workspace data without executing a process.
    Read,
    /// Runs diagnostics or tests that may create ignored artifacts.
    Diagnose,
    /// Modifies workspace files.
    WorkspaceWrite,
    /// Runs an arbitrary local process or shell.
    Execute,
    /// Accesses an external network service beyond the selected model provider.
    Network,
    /// Requests a budgeted child session and may merge a reviewed workspace handoff.
    Delegate,
    /// Destructive, credential, or out-of-workspace action.
    Sensitive,
}