packages/plugin-sdk/docs/design/architecture.md
AIRI is a multi-node system where plugins, bridges, and viewers communicate over Eventa transports. A Plugin Host loads plugins, provides a single API surface, and routes control and data across devices. The platform separates the control plane from the data plane, supports local and remote plugins, and enables multi-device orchestration without changing plugin APIs.
AIRI needs to run across desktop, web, and mobile while keeping one clean API surface. Plugins must be able to register UI, declare capabilities, and exchange data with device-specific bridges. To keep the system scalable, high-rate streams must be separated from lifecycle and configuration traffic.
Runtime dependency orchestration is intentionally split into a dedicated design document to keep this architecture document focused on platform shape and planes.
The platform design focuses on consistent APIs, transport-agnostic integration, and multi-device orchestration.
Control plane purpose: lifecycle, configuration, routing policy, permissions, and UI contributions.
Typical control messages:
Data plane purpose: real-time and high-throughput streams.
Typical data messages:
Both planes use Eventa messages. Transport options:
The Plugin Host is a Node process that:
Viewers render UI and character output. Examples:
The lifecycle below mirrors the detailed lifecycle comment in
packages/plugin-sdk/src/plugin-host/core.ts and focuses on the module
announcement, configuration, and capability phases.
flowchart TD
A[Connect to control plane] --> B[Authenticate]
B --> C[Host sends registry:modules:sync]
C --> D[Module emits module:announce]
D --> E[Module declares deps + initial config]
E --> F{Dependencies resolved?}
F -- no --> G[module:status emitted]
F -- yes --> H[module:prepared]
H --> I[module:configuration:needed]
I --> J[validate/plan/commit config]
J --> K[module:configuration:configured]
K --> L[Offer capabilities]
L --> M[Capability configuration phase]
M --> N[module:status ready]
Detailed capability dependency orchestration, waiting phases, and readiness gates are defined in capability-orchestration.md.
Bridges connect external devices and services to AIRI. They do not own UI; they only provide data and actions. Examples:
Remote plugins are services in any language that connect over Eventa and register capabilities. They are preferred for server integrations and non-JS/TS stacks.
All SDK calls are transport-agnostic. The host controls whether communication is local IPC or remote RPC without changing plugin APIs.
Each node announces capabilities on registration. The control plane grants or denies permissions and routes requests based on policy.
Example capabilities:
The Plugin Host can run in three modes:
Plugins declare metadata in a manifest file and provide runtime entrypoints.
Example:
{
"id": "airi.vscode",
"name": "AIRI VS Code",
"version": "1.0.0",
"capabilities": ["context.read", "ui.panel", "commands"],
"entrypoints": {
"node": "./dist/node/index.js"
}
}
Active design.
capability-orchestration.md.Q: Why split control and data planes? A: Lifecycle traffic and high-rate streams have different reliability and QoS needs.
Q: Do bridges render UI? A: No. UI is contributed to viewers through the control plane.
Q: Can remote plugins be written without JS or npm? A: Yes. They only need to speak the Eventa protocol over WebSocket.