Skip to content

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 --- serialization
  • uuid --- unique identifiers
  • chrono --- timestamps
  • thiserror --- 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 offers

API Reference

Core Types

TypeDescription
EngineStatusEnum: Initializing, Ready, Error, Shutdown
ConnectionStatusEnum: Disconnected, Discovering, Connected
IdentityStateIdentity summary (DID, display name, trust tier, counts)
RoleOfferIncoming role offer from an organization
AcceptedRoleA role binding after acceptance
RoleInboxManages pending and accepted role offers
BrainCoreErrorCrate error type

Modules

ModuleDescription
app_stateEngine and connection status, identity state
dashboardDashboard view data structures
role_inboxRole offer management
errorError types

Released under the MIT License.