Reputation Types
Core data types and structures for the KnowThat Reputation Engine.
Overview
This crate provides the fundamental data structures used throughout the KnowThat reputation system, including agent data, reputation scores, and builders for constructing agent instances. It serves as the foundation for all reputation calculations and interactions.
Key Features
- Type Safety: Strong type system with builder pattern for safe construction
- Serialization: Full serde support for JSON serialization/deserialization
- Validation: Built-in validation for all data structures
- Documentation: Comprehensive documentation with examples
- No Unsafe Code:
#![forbid(unsafe_code)]for memory safety guarantees
Key Types
AgentData
Represents an MCP agent with all reputation-relevant data including:
- Identity information (DID, verification status)
- Interaction history (total interactions, reviews)
- MCP level and capabilities
- Timestamps for tracking
ReputationScore
The calculated reputation score containing:
- Numerical score value
- Confidence level and percentage
- Calculation metadata
AgentDataBuilder
Fluent builder for constructing AgentData instances with validation.
Usage
Add this to your Cargo.toml:
[]
= "0.1.0"
Basic Example
use ;
// Create agent data using the builder
let agent = new
.total_interactions
.with_reviews
.mcp_level
.identity_verified
.build
.unwrap;
println!;
println!;
Builder Pattern
use AgentData;
let agent = builder
.total_interactions
.with_reviews
.mcp_level
.identity_verified
.build
.unwrap;
Working with Reputation Scores
use ReputationScore;
let score = ReputationScore ;
println!;
Features
Default Features
serde- Serialization support
Optional Features
wasm- WebAssembly compatibility (enableschrono/wasmbind)
License
Licensed under either of:
- Apache License, Version 2.0 (LICENSE-APACHE)
- MIT License (LICENSE-MIT)
at your option.
Contributing
This is part of the KnowThat Reputation Engine project. Please see the main repository for contribution guidelines.