Skip to content

v1.0.0

Choose a tag to compare

@github-actions github-actions released this 16 Mar 21:49
· 213 commits to main since this release

AimDB v1.0.0 Release Notes

Stable core API, real-time browser streaming, and LLM-driven architecture design!

Async in-memory database for MCU → edge → cloud data synchronization


🎯 Highlights

This release promotes aimdb-core to 1.0.0 — declaring a stable public API for the core database engine. It also ships four entirely new crates: a WebSocket connector for real-time browser streaming, a WASM adapter for running AimDB in the browser, a code generation library for architecture-to-code workflows, and a shared wire protocol for the WebSocket ecosystem. The MCP server gains a full architecture agent for LLM-driven system design, and the CLI adds code generation and live monitoring commands.

Headline: MCU → Edge → Cloud → Browser — AimDB now spans the full stack.

Extensible Streamable registry — the Streamable type dispatch system has been redesigned from a closed dispatcher to an open, extensible registry pattern. Users now register their own types via .register::<T>() on connector and adapter builders. Concrete contracts (Temperature, Humidity, GpsLocation) have moved to application-level crates.


✨ Major Features

🌐 WebSocket Connector (New Crate)

Real-time bidirectional streaming to browsers and between AimDB instances!

use aimdb_tokio_adapter::TokioAdapter;
use aimdb_websocket_connector::WebSocketConnector;

let db = AimDbBuilder::new()
    .runtime(TokioAdapter::new())
    .with_connector(
        WebSocketConnector::new()
            .bind("0.0.0.0:8080")
            .path("/ws")
            .with_late_join(true),
    );

// Push records to browser clients
builder.configure::<Temperature>(AppKey::Temp, |reg| {
    reg.buffer(BufferCfg::SingleLatest)
       .link_to("ws://temperature");  // ← streams to all subscribers
});

Two modes:

  • 🖥️ Server mode (Axum-based) — accept incoming WebSocket connections via link_to("ws://topic")
  • 🔗 Client mode (tokio-tungstenite) — connect out to remote servers via link_to("ws-client://host/topic") for AimDB-to-AimDB sync without a broker
  • 🔐 Authentication via pluggable AuthHandler trait
  • 📡 MQTT-style wildcards — # multi-level, * single-level topic matching
  • ⏱️ Late-join — new subscribers receive current values immediately
  • 📋 StreamableRegistry — extensible type-erased dispatch via .register::<T>() with schema-name collision detection

🕸️ WASM Adapter (New Crate)

Run AimDB in the browser — full dataflow engine via WebAssembly!

import { useRecord, useBridge } from 'aimdb-wasm-adapter/react';

function TemperatureDashboard() {
    const bridge = useBridge("ws://localhost:8080/ws");
    const temp = useRecord<Temperature>(bridge, "sensor.temperature");

    return <div>Current: {temp?.celsius}°C</div>;
}

Features:

  • 🏗️ Full aimdb-executor trait implementations (RuntimeAdapter, Spawn, TimeOps, Logger)
  • 🪶 Rc<RefCell<…>> buffers — zero-overhead for single-threaded WASM
  • 🎯 WasmDb facade via #[wasm_bindgen]: configureRecord, get, set, subscribe
  • 🌉 WsBridge — WebSocket bridge connecting browser to remote AimDB server
  • ⚛️ React hooks: useRecord<T>, useSetRecord<T>, useBridge
  • 📋 SchemaRegistry for type-erased record dispatch with extensible .register::<T>() API
  • no_std + alloc compatible (wasm32-unknown-unknown target)

📋 Data Contracts — Pure Trait Crate

aimdb-data-contracts refocused as a pure trait-definition crate (version reset to 0.1.0).

Trait definitions for self-describing data schemas that work identically across MCU, edge, and cloud:

  • SchemaType — unique identity and versioning
  • Streamable — capability marker for types crossing serialization boundaries
  • Linkable — wire format for connector transport
  • Simulatable — test data generation
  • Observable — signal extraction for monitoring
  • Migratable — schema evolution with MigrationChain and MigrationStep

Concrete contracts (Temperature, Humidity, GpsLocation) and the closed StreamableVisitor dispatcher have been removed — see Breaking Changes below.

🏗️ Code Generation (New Crate)

Architecture-to-code: generate Rust source and Mermaid diagrams from .aimdb/state.toml!

# Generate Mermaid architecture diagram
aimdb generate mermaid

# Generate Rust schema code
aimdb generate schema

# Scaffold a new common crate
aimdb generate common-crate

# Scaffold a hub binary crate
aimdb generate hub-crate

aimdb-codegen features:

  • 📄 ArchitectureState type for reading .aimdb/state.toml decision records
  • 📊 Mermaid diagram generation from architecture state
  • 🦀 Rust source generation — value structs, key enums, SchemaType/Linkable impls, configure_schema() functions
  • 🏗️ Common crate, hub crate, and binary crate scaffolding
  • ✅ State validation module for architecture integrity checks

🤖 Architecture Agent (MCP)

LLM-driven system design — propose, validate, and apply architecture changes through conversation!

The MCP server now includes a full architecture agent with a session state machine:

Idle → Gathering → Proposing → Resolve

16+ new MCP tools:

Tool Description
propose_add_record Add a new record to the architecture
propose_add_connector Add a connector (MQTT, WebSocket, etc.)
propose_modify_buffer Change buffer type/capacity
propose_modify_fields Modify record fields
propose_modify_key_variants Change key variants
remove_record Remove a record
rename_record Rename a record
reset_session Reset agent session state
resolve_proposal Apply or reject pending proposals
save_memory Persist architecture decisions
validate_against_instance Validate architecture against running instance
get_architecture Get current architecture state
get_buffer_metrics Get buffer performance metrics

Architecture MCP resources provide Mermaid diagrams and validation results as live resources.

📡 Wire Protocol (New Crate)

Shared wire protocol types for the WebSocket ecosystem.

aimdb-ws-protocol provides ServerMessage and ClientMessage enums used by both the WebSocket connector (server side) and the WASM adapter (browser side). JSON-encoded with "type" discriminant tag.


🔧 Other Changes

aimdb-core

  • Added ws:// and wss:// URL scheme support in ConnectorUrl for WebSocket connectors
  • ConnectorUrl::default_port() now handles WebSocket schemes
  • ConnectorUrl::is_secure() includes wss://

aimdb-cli

  • New aimdb generate subcommand for code generation via aimdb-codegen
  • New aimdb watch subcommand for live record monitoring

Dependency Updates

  • aimdb-knx-connector 0.3.1 — Updated Embassy dependency versions (executor 0.10.0, time 0.5.1, sync 0.8.0, futures 0.1.2, net 0.9.0)
  • aimdb-mqtt-connector 0.5.1 — Updated Embassy dependency versions (executor 0.10.0, time 0.5.1, sync 0.8.0, net 0.9.0)
  • Embassy submodules updated to latest upstream commits

📦 Published Crates

New Crates

  • 🆕 aimdb-websocket-connector@0.1.0 — real-time bidirectional WebSocket streaming
  • 🆕 aimdb-ws-protocol@0.1.0 — shared wire protocol types
  • 🆕 aimdb-wasm-adapter@0.1.1 — WebAssembly runtime adapter with React hooks
  • 🆕 aimdb-codegen@0.1.0 — architecture-to-code generation

Updated

Crate Previous New
aimdb-core 0.5.0 1.0.0
aimdb-data-contracts 0.5.0 0.1.0 (reset — pure trait crate)
aimdb-cli 0.5.0 0.6.0
aimdb-mcp 0.5.0 0.6.0
aimdb-mqtt-connector 0.5.0 0.5.1
aimdb-knx-connector 0.3.0 0.3.1

Unchanged

  • aimdb-tokio-adapter@0.5.0
  • aimdb-embassy-adapter@0.5.0
  • aimdb-client@0.5.0
  • aimdb-sync@0.5.0
  • aimdb-persistence@0.1.0
  • aimdb-persistence-sqlite@0.1.0
  • aimdb-derive@0.1.0
  • aimdb-executor@0.1.0

⚠️ Breaking Changes

  • aimdb-data-contracts: Concrete contracts removed from this crate. If you depended on Temperature, Humidity, or GpsLocation from aimdb-data-contracts, define them in your own application crate or shared common crate (see examples/weather-mesh-demo/weather-mesh-common for a reference).
  • aimdb-data-contracts: for_each_streamable() and StreamableVisitor removed. Use .register::<T>() on connector/adapter builders instead.
  • aimdb-data-contracts: ts feature removed (ts-rs dependency dropped).
  • aimdb-data-contracts: Version reset from 1.0.0 to 0.1.0 to reflect the reduced, stabilizing scope as a pure trait crate.

🖥️ New CLI Commands

# Code generation
aimdb generate mermaid           # Generate Mermaid architecture diagram
aimdb generate schema            # Generate Rust schema code
aimdb generate common-crate      # Scaffold a common crate
aimdb generate hub-crate         # Scaffold a hub binary crate

# Live monitoring
aimdb watch <record>             # Watch live record updates

🚀 Migration Guide

Step 1: Update dependencies

[dependencies]
aimdb-core = "1.0"
aimdb-data-contracts = "0.1"  # reset — now a pure trait crate
aimdb-tokio-adapter = "0.5"   # unchanged
# Optional: add WebSocket streaming
aimdb-websocket-connector = "0.1"
# Optional: add WASM support
aimdb-wasm-adapter = "0.1"

Step 2: Move concrete contracts to your crate

If you used Temperature, Humidity, or GpsLocation from aimdb-data-contracts, copy them into your own application or shared common crate. See examples/weather-mesh-demo/weather-mesh-common for a working example.

Step 3: Replace StreamableVisitor with .register::<T>()

// Before (closed dispatcher):
// for_each_streamable(visitor);

// After (extensible registry):
let connector = WebSocketConnector::new()
    .register::<Temperature>()
    .register::<Humidity>()
    .register::<GpsLocation>();

Step 4: No other breaking API changes

The 0.5.0 → 1.0.0 upgrade for aimdb-core has no breaking changes — only additive features (WebSocket URL scheme support). All existing code continues to compile unchanged.

Step 5: Try the new tools

# Update CLI
cargo install aimdb-cli

# Generate architecture diagrams from running instances
aimdb generate mermaid

# Watch live data
aimdb watch sensor.temperature

📚 Examples

All examples updated for v1.0.0:

git clone https://github.com/aimdb-dev/aimdb.git && cd aimdb

# MQTT connector demo
cargo run -p tokio-mqtt-connector-demo

# Weather mesh demo (multi-station with WebSocket streaming)
cargo run -p weather-hub

# Sync API demo
cargo run -p sync-api-demo

# Embedded (cross-compile)
cd examples/embassy-mqtt-connector-demo
cargo build --release --target thumbv7em-none-eabihf

📖 New Design Documents

  • 023 — Architecture Agent: LLM-powered session-based architecture design workflow
  • 024 — Codegen Common Crate: Architecture state to compilable Rust source
  • 025 — WASM Adapter: Full browser runtime design with React integration

🤝 Contributing

git clone https://github.com/aimdb-dev/aimdb.git
cd aimdb
make check  # fmt + clippy + test + embedded + wasm cross-compile

📄 License

Apache License 2.0 — see LICENSE.