export class InMemoryMcpCompletionBridge {
    listeners = new Map();
    pending = new Map();
    subscribe(jobId, listener) {
        this.listeners.set(jobId, listener);
        const buffered = this.pending.get(jobId);
        if (buffered) {
            this.pending.delete(jobId);
            listener(buffered);
        }
    }
    unsubscribe(jobId) {
        this.listeners.delete(jobId);
    }
    publish(jobId, completion) {
        const listener = this.listeners.get(jobId);
        if (listener) {
            listener(completion);
            return;
        }
        this.pending.set(jobId, completion);
    }
}
//# sourceMappingURL=mcpCompletion.memory.gateway.js.map