/// <reference types="node" resolution-mode="require"/>
/// <reference types="node" resolution-mode="require"/>
import { Readable, Writable } from "stream";
import type { TypedEmitter } from "tiny-typed-emitter";
export declare class Controller {
    events: TypedEmitter<ControllerEvents>;
    private handlers;
    private sources;
    private nextEndpointId;
    private requests;
    private nextRequestId;
    constructor();
    open(label: string, details?: StreamDetails): OutgoingStream;
    receive(packet: Packet): void;
    private onCreate;
    private onFinish;
    private onWrite;
    _request(name: StanzaName, payload: StanzaPayload, data: Buffer | null): Promise<unknown>;
    private onRequest;
    private resolve;
    private reject;
    private onNotification;
}
export default Controller;
type ControllerEvents = {
    stream: (stream: IncomingStream) => void;
    send: (packet: Packet) => void;
};
export interface IncomingStream extends Readable {
    label: string;
    details: StreamDetails;
}
export interface OutgoingStream extends Writable {
}
export interface StreamDetails {
    [key: string]: any;
}
export interface Packet {
    stanza: {
        [key: string]: any;
    };
    data: Buffer | null;
}
type StanzaName = string;
interface StanzaPayload {
    [key: string]: any;
}
