// Glue implementation provides socket object.typeSocket= Reader & Writer;interfaceReader{read(p: Uint8Array):Promise<number|null>;}interfaceWriter{write(p: Uint8Array):Promise<number>;}// Channel provides a per-message communication method.interfaceWrpChannel{listen(): AsyncGenerator<WrpMessage>;send(message: WrpMessage):Promise<void>;}typeMetadata= Record<string,string>;interfaceLazyMetadata{[key:string]:|undefined|string|Promise<string|undefined>|(()=>string|undefined)|(()=>Promise<string|undefined>);}// Guest provides a way to send requests to the host.interfaceWrpGuest{
availableMethods: Set<string>;request(
methodName:string,
req: AsyncGenerator<Uint8Array>,
metadata?: LazyMetadata,):{
res: AsyncGenerator<Uint8Array>;
header:Promise<Metadata>;
trailer:Promise<Metadata>;};}// Host provides a way to handle and respond to requests from guests.interfaceWrpHost{listen(): AsyncGenerator<WrpRequest>;}interfaceWrpRequest{
methodName:string;
metadata: Metadata;
req: AsyncGenerator<Uint8Array>;sendHeader(value: Metadata):void;sendPayload(value: Uint8Array):void;sendTrailer(value: Metadata):void;}