spt-brain-core
Shared SmartBrain app state, role negotiation, and app logic
Overview
spt-brain-core provides the platform-agnostic shared state and role negotiation protocol used across all SmartBrain native apps (macOS, iOS, visionOS, Windows, Android). It defines the core data types for engine status, identity state, dashboard views, and organizational role offers that are consumed via UniFFI bridges on each platform.
Key Features
- App State Management --- engine status, connection state, and identity summary for UI rendering
- Role Inbox --- receive, review, and accept organizational role offers with capability grants
- Dashboard Types --- shared dashboard data structures for cross-platform consistency
- Platform Agnostic --- zero platform dependencies; consumed via UniFFI bridges
- Serializable --- all types derive Serde traits for wire transport and persistence
Dependencies
Key external dependencies:
serde/serde_json--- serializationuuid--- unique identifierschrono--- timestampsthiserror--- typed error handling
No internal SPT crate dependencies.
Usage
rust
use spt_brain_core::{EngineStatus, IdentityState, RoleInbox, RoleOffer};
let status = EngineStatus::Ready;
let mut inbox = RoleInbox::default();
// inbox.offer(...) to enqueue incoming role offersAPI Reference
Core Types
| Type | Description |
|---|---|
EngineStatus | Enum: Initializing, Ready, Error, Shutdown |
ConnectionStatus | Enum: Disconnected, Discovering, Connected |
IdentityState | Identity summary (DID, display name, trust tier, counts) |
RoleOffer | Incoming role offer from an organization |
AcceptedRole | A role binding after acceptance |
RoleInbox | Manages pending and accepted role offers |
BrainCoreError | Crate error type |
Modules
| Module | Description |
|---|---|
app_state | Engine and connection status, identity state |
dashboard | Dashboard view data structures |
role_inbox | Role offer management |
error | Error types |