Services.Conversation.Interrupts (fnord v0.8.83)
View SourceQueue for injecting user messages into a conversation mid-completion.
This GenServer stores a FIFO list of pending injected user messages per conversation pid. AI.Completion will drain and apply these messages at safe checkpoints before sending a model request or between tool-call rounds.
Additionally, it supports temporarily blocking interrupts for a conversation during critical phases (e.g., finalization). When blocked, attempts to interrupt should be rejected at the UI layer; this server tracks blocked state so callers can check/decide behavior.
Summary
Functions
Block interrupts for a given conversation pid.
Return true if interrupts are currently blocked for conversation pid.
Returns a specification to start this module under a supervisor.
Returns true if any interrupts are pending for the conversation pid.
Enqueue an injected user message for the given conversation pid.
Start the interrupt queue server.
Drain all pending injected messages for a conversation. Returns an empty list if none are pending.
Unblock interrupts for a given conversation pid.
Types
@type msg() :: AI.Util.msg()
Functions
@spec block(pid()) :: :ok
Block interrupts for a given conversation pid.
Return true if interrupts are currently blocked for conversation pid.
Returns a specification to start this module under a supervisor.
See Supervisor.
Returns true if any interrupts are pending for the conversation pid.
Enqueue an injected user message for the given conversation pid.
@spec start_link(Keyword.t()) :: GenServer.on_start()
Start the interrupt queue server.
Drain all pending injected messages for a conversation. Returns an empty list if none are pending.
@spec unblock(pid()) :: :ok
Unblock interrupts for a given conversation pid.