/**
 * Derive the file-level decision pill state from per-rule actions.
 *
 * Rules with `issues.length === 0` are skipped — there's nothing for the
 * agent to decide on, so they don't contribute to the pending count and
 * don't block the "all accepted" verdict.
 *
 * Pure: no I/O, no mutation.
 */
export function compute_file_decision_state(rule_actions, rules_with_issues) {
    const actions = rule_actions ?? {};
    const rules = rules_with_issues.filter(r => r.issues.length > 0);
    let any_sent_back = false;
    let all_accepted = rules.length > 0;
    let pending_count = 0;
    for (const rule of rules) {
        const action = actions[rule.rule_id];
        if (action === 'sent_back') {
            any_sent_back = true;
            all_accepted = false;
        }
        else if (action === 'accepted') {
            // continue
        }
        else {
            // pending
            all_accepted = false;
            pending_count += rule.issues.length;
        }
    }
    return {
        accepted: all_accepted && !any_sent_back,
        sent_back: any_sent_back,
        pending_count,
    };
}
//# sourceMappingURL=file_decision_state.js.map