Skip to main content

Module consult

Module consult 

Source
Expand description

Handing an open question to the chat conversation its task came from.

A task filed by the standing chat (Source::Agent with crate::queue::CHAT_NODE, whose run is the conversation’s id) can raise a question the owner would rather talk through where the task started. The owner passes it on; the chat agent either answers it with magi answer or puts the decision points to the owner in the conversation.

Three rules, each with a reason:

  • One place decides. origin_talk is the only judge of “does this question have a chat to ask”; the web view and both entry points use it.
  • Not a choice. The hand-over never goes into Question::choices and never touches Question::answer: the question stays Open, its validation and the choice actions stay as they were.
  • No new seat, no new waiter. The text is queued as a draft of the existing talk, so the chat’s own turn machinery (its session, its turn gate) runs it exactly as if the owner had typed it.

Functions§

begin
Record the hand-over and queue the question as the chat’s next message.
origin_talk
The conversation q may be handed to, if any.
pending_consults
Is any question handed to talk talk_id still open?