Skip to main content

switch_agent

Function switch_agent 

Source
pub fn switch_agent(
    talk: &mut Talk,
    store: &Talks,
    spec: &AgentSpec,
) -> Result<bool>
Expand description

Hand the conversation to another roster agent.

A CLI session belongs to one CLI and cannot be carried to another, so the seat is minted afresh rather than edited: the next turn finds seat.turns == 0 and re-sends the transcript, since the new agent has heard none of it. A magi-written note records the change in the transcript. Returns false (and writes nothing, not even a note) when the stored talk already uses spec.

Re-reads under Talks::guard, like close, and errors rather than resurrecting a record a concurrent delete removed. Refusing a closed talk or a turn in flight is the caller’s job: only it can see the latter.