# a2ui-base
[](https://crates.io/crates/a2ui-base)
[](https://docs.rs/a2ui-base)
[](https://github.com/Liangdi/a2ui/blob/master/LICENSE)
> π¦ Part of the **a2ui** crate ecosystem Β· framework-agnostic core layer
>
> This crate is the foundational sub-crate of the [`a2ui`](https://crates.io/crates/a2ui) workspace. See the [root README](https://github.com/Liangdi/a2ui#readme) for the full introduction.
The **framework-agnostic core** of the [A2UI (Agent to UI) v1.0](https://github.com/a2ui-project/a2ui) protocol: protocol types, component / data models, catalogs, the message processor, capabilities negotiation, validation, and the interaction layer shared by every UI backend. It **depends on no UI framework** (no ratatui / Slint / egui), so it can be used standalone for other backends or pure protocol parsing.
## Where it fits
```
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β apps: a2ui-gallery (TUI) a2ui-slint-gallery a2ui-egui-gallery β
β umbrella: a2ui (re-export core + tui [+ slint] [+ egui]) β
β backends: a2ui-tui (ratatui) a2ui-slint a2ui-egui β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β βΆ a2ui-base (framework-agnostic: Protocol / Model / Catalog / Processor) β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
```
`a2ui-base` is the foundation of the whole workspace β all three backends (ratatui / Slint / egui) are built on it. The framework-agnostic interaction logic (focus traversal `focus`, event-result application `interaction`, component behavior `components`) lives here so every backend agrees on keyboard / button behavior.
## Modules
| `protocol` | A2UI v1.0 JSON message types (serverβclient, clientβserver) |
| `model` | Runtime component tree, surfaces, JSON Pointer data binding |
| `catalog` | Catalog, component API, function implementations, schema-only functions, inline catalogs |
| `message_processor` | Message parsing β state changes; `process_message` / `parse_jsonl` |
| `capabilities` | `ClientCapabilities` / `ServerCapabilities` negotiation + inline catalog parsing (UAX#31 validation) |
| `validate` | Protocol validation (`ValidationConfig` / `ValidationReport`) |
| `observable` | Reactive state management |
| `focus` / `interaction` / `components` | Shared interaction layer (focus traversal, `EventResult` application, component `handle_event`) |
## Usage
```bash
cargo add a2ui-base
```
```rust
use a2ui_base::message_processor::MessageProcessor;
use a2ui_base::catalog::Catalog;
let mut processor = MessageProcessor::new(vec![/* catalogs */]);
// Parse and process one JSON message
let msg = MessageProcessor::parse_message(r#"{"version":"v1.0",...}"#)?;
processor.process_message(msg)?;
// Read protocol-produced outgoing messages (functionResponse / actionResponse / ...)
let outgoing = processor.drain_outgoing();
```
> Want a renderable terminal UI out of the box? Combine it with [`a2ui-tui`](https://crates.io/crates/a2ui-tui); or reach this crate as `a2ui::core::...` via the umbrella [`a2ui`](https://crates.io/crates/a2ui).
## License
MIT