import type { PeerMessage } from './types.js' import type { PubKeyHex } from '../wallet/Wallet.interfaces.js' /** * Abstract communications layer. * * This intentionally mirrors the essential subset of message-box-client / MessageBoxClient. * RemittanceManager never talks directly to HTTP/WebSockets – it only uses this interface. */ export interface CommsLayer { /** * Sends a message over the store-and-forward channel. Returns the transport messageId. */ sendMessage: (args: { recipient: PubKeyHex, messageBox: string, body: string }, hostOverride?: string) => Promise /** * Sends a message over the live channel (e.g. WebSocket). Returns the transport messageId. * Implementers may throw if live sending is not possible. * RemittanceManager will fall back to sendMessage where appropriate. */ sendLiveMessage?: (args: { recipient: PubKeyHex, messageBox: string, body: string }, hostOverride?: string) => Promise /** * Lists pending messages for a message box. */ listMessages: (args: { messageBox: string, host?: string }) => Promise /** * Acknowledges messages (deletes them from the server / inbox). */ acknowledgeMessage: (args: { messageIds: string[] }) => Promise /** * Optional live listener. */ listenForLiveMessages?: (args: { messageBox: string overrideHost?: string onMessage: (msg: PeerMessage) => void }) => Promise }