package com.correx.core.context.builder

/**
 * The REQUIRED bucket alone (task, constraints, loaded inputs, failures) does not fit the
 * stage's token budget. Required context is never trimmed, so the only correct outcome is
 * failing the build loudly — a silently truncated instruction is worse than no run.
 */
class RequiredContextOverflowException(
    val requiredTokens: Int,
    val budgetLimit: Int,
    val breakdown: Map<String, Int>,
) : IllegalStateException(
    "Required context ($requiredTokens tokens) exceeds the stage budget ($budgetLimit); " +
        "by sourceType: " + breakdown.entries.joinToString(", ") { "${it.key}=${it.value}" },
)
