"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.broadcastBackgroundCalleeSummary = broadcastBackgroundCalleeSummary;
const evt_registry_1 = require("../evt-registry");
const persistence_1 = require("../persistence");
async function broadcastBackgroundCalleeSummary(dlg) {
    const activeCallees = await persistence_1.DialogPersistence.loadActiveCallees(dlg.id, dlg.status);
    const pending = activeCallees.batches.flatMap((batch) => batch.callees.filter((callee) => callee.status === 'pending'));
    (0, evt_registry_1.postDialogEvent)(dlg, {
        type: 'dlg_background_callee_summary_evt',
        backgroundCalleeDialogCount: pending.length,
        backgroundFreshBootsReasoningCalleeCount: pending.filter((callee) => callee.callName === 'freshBootsReasoning').length,
    });
}
