# `CommBus.Budget`
[🔗](https://github.com/fosferon/comm_bus/blob/v0.1.0/{path}#L{line})

Token budget management.

# `fit_budget`
[🔗](https://github.com/fosferon/comm_bus/blob/v0.1.0/{path}#L{line})

```elixir
@spec fit_budget([CommBus.Entry.t()], non_neg_integer()) :: [CommBus.Entry.t()]
```

Selects entries that fit within a token budget using priority-based greedy selection.

Entries are sorted by `(priority, weight, id)` in descending order, then
accumulated until the token limit is reached. Entries whose `token_count`
would exceed the remaining budget are skipped.

## Parameters

  - `entries` — List of `%CommBus.Entry{}` structs with `token_count` populated.
  - `limit` — Maximum number of tokens allowed.

## Returns

A list of `%CommBus.Entry{}` structs that fit within the budget, preserving
the priority-based selection order.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
