Weave documentation
Rust referenceweave-nexus

weave-nexus · governance

Source declarations, signatures and documentation for governance.

Source: sigil/weave/models/nexus/src/governance.rs. SHA-256: f26b4cbce3c9dd821f54a65df2099ddc94e2874f7a24c6d65c4144d19d205088.

This reference follows declared source modules, retains conditional attributes, and includes public declarations and implementation methods. Private-module re-exports and trait resolution require the compiler; this is a source reference, not a claim that every listed item is a root import. Function bodies and constant values are omitted.

governance::NexusPolicy

Nexus policy hook for admission/filtering/backpressure (identity-agnostic)

#[async_trait]
pub trait NexusPolicy: Send + Sync {
    /// Allow or deny a candidate node before it enters the view
    async fn allow(&self, writer_key: &str, index: u64, timestamp: SystemTime) -> bool;
}

Source line: 16.

governance::AllowAllPolicy

Default policy for tests and open deployments

pub struct AllowAllPolicy;

Source line: 22.

governance::GovernanceRules

Rules governing which agents can participate in a nexus

#[derive(Clone, Serialize, Deserialize)]
pub struct GovernanceRules {
/// Who makes decisions about participation

pub authority: GovernanceAuthority,
/// Policy for adding/removing agents

pub policy: GovernancePolicy
}

Source line: 68.

governance::GovernanceAuthority

Authority for governance decisions (key-only)

#[derive(Debug, Clone, Serialize, Deserialize)]
pub enum GovernanceAuthority {
    /// Single founder key decides (hex-encoded 32-byte public key)
    SingleKey(String),

    /// Multiple founder keys decide via threshold (M-of-N). Keys are hex-encoded
    /// 32-byte public keys from Strand/Strand Vault contexts.
    MultiKeyThreshold {
        founders: Vec<String>,
        threshold: u32,
    },

    /// Any agent from specified organizations
    OrganizationList(Vec<String>),
}

Source line: 91.

governance::GovernancePolicy

Policy for agent participation

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct GovernancePolicy {
/// Allow agents from same organization automatically

pub allow_same_org: bool,
/// Require explicit approval for each agent

pub require_approval: bool,
/// Whitelist of approved organizations

pub approved_orgs: Vec<String>,
/// Blacklist of denied organizations

pub denied_orgs: Vec<String>,
/// Maximum agents per organization

pub max_agents_per_org: Option<usize>
}

Source line: 108.

governance::GovernanceRules::submit_approval

Record an approval from a founder for a target (key-only auth path).

This is a minimal, key-only mechanism suitable for MHR-style governance without requiring any external identity resolution. Approvals are stored process-wide in a concurrent map for the duration of the process.

pub async fn submit_approval(
        founder_key_hex: &str,
        target_key_hex: &str,
        record: ApprovalRecord,
    ) -> Result<()>;

Source line: 143.

governance::GovernanceRules::is_organization_authorized

Check if an organization is authorized to participate

pub async fn is_organization_authorized(&self, org_did: &str) -> Result<bool>;

Source line: 154.

governance::GovernanceRules::check_org_limits

Check if adding another agent from an organization would exceed limits

pub fn check_org_limits(&self, org_did: &str) -> Result<()>;

Source line: 198.

governance::GovernanceRules::open

Create open governance (any agent can join)

pub fn open() -> Self;

Source line: 214.

governance::ApprovalRecord

Approval record stored in governance system (keys-only)

#[derive(Debug, Clone)]
pub struct ApprovalRecord {
pub public_key: [u8; 32],
pub signature: [u8; 64],
pub timestamp: chrono::DateTime<chrono::Utc>
}

Source line: 333.

governance::OrganizationGovernance

Interface for organization governance systems (MHR feature)

#[allow(dead_code)]
#[async_trait::async_trait]
pub trait OrganizationGovernance: Send + Sync {
    async fn has_approved(&self, org_did: &str) -> Result<bool>;
}

Source line: 344.

On this page