pub fn budget_split(global_budget: u32, provider_count: usize) -> Vec<u32>Expand description
Split a global composition budget into one max_tokens share per
capability-matching provider, computed before any provider’s query is
built so honest legs sum to <= global_budget (issue #15, allocation).
The default policy is an equal split: each provider gets
global_budget / n, and the global_budget % n remainder tokens are handed
one apiece to the first providers, so the shares sum to exactly
global_budget (for n > 0) with no share exceeding it. The order of the
returned shares matches the order of the providers the caller filtered, so a
caller that wants a weighted split (by provider trust, past hit-rate, or
declared cost) can swap this one function without touching the fan-out: the
only contract the rest of the module relies on is sum(shares) <= global_budget.
provider_count == 0 yields an empty split — there is nobody to query.