pub fn pick(
agents: &[AgentSpec],
want: Option<&str>,
available: &dyn Fn(&AgentSpec) -> bool,
) -> Result<AgentSpec>Expand description
Choose the agent for a seat that stands alone rather than rotating through
the roster: crate::talk’s standing conversation, crate::bump’s
release-bump decision, or anything else that needs one agent picked once
rather than a panel filled in.
available is a parameter rather than a call to installed so the order
below is assertable on a machine with none of these CLIs installed, which is
every CI runner.
The order, and why:
- An explicit id always wins, and is an error rather than a fallback when it is unusable. Naming a seat has a reason, and silently substituting a different model would waste whatever that reason was.
- Otherwise a
AgentKind::Claudeseat, ahead of the roster order: it is the only one of the three CLIs magi can address before the first turn (see this module’s own doc on session mechanics), which matters most for a conversation that opens with nothing typed yet. - Otherwise the first runnable agent in roster order, because the roster order is the operator’s own stated preference and magi has nothing better to go on.