Blossom keeps every business rule in a Rust core, and the macOS app renders what the core decides.
Dependencies point inward only. Each layer is its own Rust crate or Swift target, so an import in the wrong direction does not compile.
| Layer | Where | Role |
|---|---|---|
domain | crates/domain | Agents, sessions, requests, priority, logos. Depends on nothing. |
application | crates/application | NotchState, the reducer, the projections, the use cases and the ports. |
infrastructure | crates/infrastructure | Implements the ports: adapters, packages, Extism plugins, the configuration file. |
protocol | crates/protocol | Wire contracts shared with adapters and plugins. |
bridge | crates/bridge | The UniFFI facade: start the core, subscribe, send an intent. |
Bridge | apps/macos/sources/bridge | Generated bindings and their wrapper; imports the core xcframework. |
Presentation | apps/macos/sources/presentation | SwiftUI views and the theme. Imports Bridge; renders, never decides. |
Platform | apps/macos/sources/platform | AppKit and system APIs: the notch window, the shortcut, updates. |
Blossom | apps/macos/sources/application | Entry point and composition root; imports the rest. |
Nothing in crates/ depends on Apple frameworks, so another platform brings its own interface on top of the same core.
Tip
Rule of thumb for any new line of code: if another platform would need the same rule, it belongs in the core.
NotchState is the single source of truth, and it changes in exactly one place: reduce(state, event) -> state, a pure function with no I/O and no clock. A user intent enters the reducer wrapped in an event, so every change takes one path.
Views never receive the whole state. The application projects it into shapes made for rendering: Mode says what the notch shows, Ear which tiles fit in idle, PendingRequest what a request asks. Notch owns the state behind a lock and calls each observer with the newest state after every event.
The application declares what it needs as ports in crates/application/src/ports: an adapter host, the packages of adapters, a plugin host, a configuration store, a catalog source and Connections. Infrastructure implements them; the application never names an implementation.
initialize; the adapter answers with its manifest, then reports sessions.Snapshot of FFI records, which the Swift wrapper exposes as an AsyncStream.Core.send(intent:), into the same reducer. When a request stops being pending, the adapter host writes its outcome back to the adapter that asked.Note
Core has five operations: start, subscribe, send, report for a signal, and shut_down. Beside it, self_test checks a built app for Blossom --selftest.
| Side | File | Wires |
|---|---|---|
| Rust | crates/bridge/src/core.rs | The infrastructure implementation of every port. |
| Swift | apps/macos/sources/application/composition.swift | The core, the models, the views, the windows and the menu. |
~/Library/Application Support/Blossom/configuration.json, or the file BLOSSOM_CONFIGURATION names. The core writes it; the app never does.Important
The core has no async runtime: the adapter host uses operating system threads for each launch. Add a runtime only when blocking threads stop being enough, and record that decision.