<commit_before>// Control-flow utility.
var cadence = require('cadence')

// Evented message queue.
var Procesion = require('procession')
var coalesce = require('nascent.coalesce')

var Basin = require('./basin')
var Spigot = require('./spigot')

function Responder (delegate, qualifier) {
    this._qualifier = qualifier
    this._delegate = delegate
    this.basin = new Basin(this)
    this.spigot = new Spigot(this)
}

Responder.prototype.fromBasin = cadence(function (async, envelope) {
    switch (envelope.method) {
    case 'endOfStream':
    case 'error':
        this.basin.responses.enqueue(envelope, async())
        this.spigot.requests.enqueue(envelope, async())
        break
    case 'entry':
        envelope = envelope.body
        if (envelope.to == this._qualifier) {
            async(function () {
                this._delegate.request(envelope.body, async())
            }, function (response) {
                this.basin.responses.enqueue({
                    module: 'conduit',
                    to: envelope.from,
                    from: this._qualifier,
                    cookie: envelope.cookie,<commit_msg>Responder now qualifies messages by module.<commit_after>// Control-flow utility.
var cadence = require('cadence')

// Evented message queue.
var Procesion = require('procession')
var coalesce = require('nascent.coalesce')

var Basin = require('./basin')
var Spigot = require('./spigot')

function Responder (delegate, qualifier) {
    this._qualifier = qualifier
    this._delegate = delegate
    this.basin = new Basin(this)
    this.spigot = new Spigot(this)
}

Responder.prototype.fromBasin = cadence(function (async, envelope) {
    switch (envelope.method) {
    case 'endOfStream':
    case 'error':
        this.basin.responses.enqueue(envelope, async())
        this.spigot.requests.enqueue(envelope, async())
        break
    case 'entry':
        envelope = envelope.body
        if (envelope.module == 'conduit' && envelope.to == this._qualifier) {
            async(function () {
                this._delegate.request(envelope.body, async())
            }, function (response) {
                this.basin.responses.enqueue({
                    module: 'conduit',
                    to: envelope.from,
                    from: this._qualifier,
                    cookie: envelope.cookie,
{'fraction_non_alphanumeric': 0.12085106382978723, 'fraction_numerical': 0.0, 'mean_word_length': 2.387608069164265, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4280705', 'n_tokens_mistral': 693, 'n_tokens_neox': 669, 'n_words': 148}