5. @fleetmesh/dm#
@fleetmesh/dm implements browser-side direct messaging for FleetMesh: bilateral conversations, message storage and unread counters, consolidated inbox and outbox views, NIP-44 message body sealing, and synchronization with mediated leaf deliveries and host mailboxes. Its host-side counterpart is Direct-Message Host Stores (fleetmesh_protocols.dm).
5.1. Installation#
npm install @fleetmesh/dm@next @fleetmesh/circles@next @fleetmesh/textile@next @fleetmesh/leaf@next
Runtime dependencies are @fleetmesh/circles and @fleetmesh/textile.
Conversation state is persisted locally in the browser (loadDmState, saveDmState). Outbound transmission is delegated to the host adapter: sendDirectMessage persists the message with status sending and passes it to the host adapter, which delivers it either as a mediated DIDComm envelope via a leaf session or through the host’s HTTP API.
5.2. Modules#
Module |
Description |
|---|---|
|
Bilateral conversation management (one conversation per pair of identities): |
|
Outbound and inbound message handling: |
|
|
|
State synchronization: |
|
Unified inbox/outbox view ( |
|
Type definitions for conversations, messages, attachments, and serialized client state. |
|
|
5.3. Host Adapter#
DmHostAdapter defines the complete interface between @fleetmesh/dm and its host environment. Transport delivery is provided by sendMediatedDidcommEnvelope (via the user’s mediator) and sendServerDirectMessage (via the host API). fetchDmConversations and markServerDmRead synchronize state with the host mailbox, while notification and typing callbacks integrate with host UI layers. Any unconfigured adapter member follows the failure semantics specified in Browser Packages (@fleetmesh/*), returning an explicit failure rather than reporting synthetic delivery success.