Package: @hexos/react-core

Abstract transport interface for client-server communication.

SSETransport is the default implementation using HTTP Server-Sent Events.

Related: AgentConfig configures the connection, TransportMessage is the outbound payload, TransportEvent is the inbound event type.

interface AgentTransport {
    connect(config: AgentConfig): Promise<void>;
    send(message: TransportMessage): void;
    sendApproval(decision: ApprovalDecision): Promise<void>;
    onMessage(callback: (event: TransportEvent) => void): () => void;
    disconnect(): void;
}

connect

(config: AgentConfig) => Promise

send

(message: TransportMessage) => void

sendApproval

(decision: ApprovalDecision) => Promise

onMessage

(callback: (event: TransportEvent) => void) => () => void

disconnect

() => void