Skip to content

openagents_sdk::rooms

Authenticated access to the app's existing Loro rooms on Coder sync.

The caller supplies the service address and account session. Room bytes stay opaque here; openagents-sync owns the shared room protocol and retry loop.

ItemWhat it does
Room structA room reference cannot be moved to a different account or deployment.
Service structOne explicitly trusted sync service, bound to an authenticated account.
MAX_CHECKPOINT_BYTES constThe largest checkpoint or row page a room read accepts, in bytes.
MAX_ROW_BYTES constThe largest row a push accepts, in bytes.

Room

pub struct Room {}

A room reference cannot be moved to a different account or deployment.

Room::id

pub fn id(&self) -> &str

Returns the room's ID.

Room::socket

pub fn socket(&self, device: &str) -> Result<String, Error>

Returns the WebSocket address that connects device to this room.

Room::checkpoint

pub async fn checkpoint(&self) -> Result<Vec<u8>, Error>

Downloads the room's latest checkpoint.

Room::rows

pub async fn rows(&self, after: u64) -> Result<Vec<u8>, Error>

Downloads the room's rows after the row number after.

Room::push

pub async fn push(
    &self,
    device: &str,
    batch: &str,
    bytes: Vec<u8>,
) -> Result<String, Error>

Uploads one row from device as batch batch and returns the service's reply.

Service

pub struct Service {}

One explicitly trusted sync service, bound to an authenticated account.

Service::new

pub fn new(
    client: Client,
    session: Session,
    base: &str,
    cancel: CancellationToken,
) -> Result<Self, Error>

Connects to a sync service at base for the session's account.

Service::room

pub fn room(&self, id: &str) -> Result<Room, Error>

Returns the room with this ID.

MAX_CHECKPOINT_BYTES

pub const MAX_CHECKPOINT_BYTES: usize = 32 * 1024 * 1024;

The largest checkpoint or row page a room read accepts, in bytes.

MAX_ROW_BYTES

pub const MAX_ROW_BYTES: usize = 1024 * 1024 - 4096;

The largest row a push accepts, in bytes.