Skip to main content

arbor_server/
lib.rs

1//! Arbor Server - WebSocket server for the Arbor Protocol
2//!
3//! This crate implements the server side of the Arbor Protocol,
4//! allowing AI agents and IDE integrations to query the code graph.
5//!
6//! The server supports:
7//! - Multiple concurrent connections
8//! - JSON-RPC 2.0 messages
9//! - Real-time graph updates via subscriptions
10//! - File watching with debounced re-indexing
11
12use arbor_graph::ArborGraph;
13use std::sync::Arc;
14use tokio::sync::RwLock;
15
16/// Shared graph state across connections.
17pub type SharedGraph = Arc<RwLock<ArborGraph>>;
18
19/// Server-to-client messages.
20#[derive(Debug, Clone, serde::Serialize)]
21#[serde(tag = "type")]
22pub enum ServerMessage {
23    GraphUpdate,
24    FocusNode,
25    IndexerStatus,
26}
27
28mod handlers;
29mod protocol;
30mod server;
31pub mod sync_server;
32
33pub use protocol::{Request, Response, RpcError};
34pub use server::{ArborServer, ServerConfig};
35pub use sync_server::{
36    BroadcastMessage, FocusNodePayload, GraphUpdatePayload, IndexerStatusPayload, SyncServer,
37    SyncServerConfig, SyncServerHandle,
38};