类 InterruptControl

java.lang.Object
io.agentscope.core.interruption.InterruptControl

public final class InterruptControl extends Object
Per-session interrupt signal.

Holds the mutable interrupt flag, source, and optional user message for a single conversational session. A stateless agent engine (e.g. ReActAgent) keeps one InterruptControl per (userId, sessionId) slot (attached transiently to that slot's AgentState), so a targeted interrupt(userId, sessionId) signals exactly one session's in-flight call without affecting other concurrent calls on the same agent instance.

This holder is intentionally runtime-only: it is never serialized as part of the persisted agent state.

  • 构造器详细资料

    • InterruptControl

      public InterruptControl()
  • 方法详细资料

    • trigger

      public void trigger(InterruptSource src, Msg msg)
      Raise the interrupt signal.
      参数:
      src - the interrupt source; null is treated as InterruptSource.USER
      msg - an optional user message associated with the interruption (ignored when null)
    • isInterrupted

      public boolean isInterrupted()
      返回:
      true if this session has been interrupted and not yet reset
    • getSource

      public InterruptSource getSource()
      返回:
      the current interrupt source
    • getUserMessage

      public Msg getUserMessage()
      返回:
      the user message associated with the interruption, or null
    • reset

      public void reset()
      Clear the interrupt signal back to its initial (non-interrupted) state.
    • toContext

      public InterruptContext toContext()
      Build an InterruptContext snapshot of the current signal.