类 HookEvent

java.lang.Object
io.agentscope.core.hook.HookEvent
直接已知子类:
ActingEvent, ErrorEvent, PostCallEvent, PreCallEvent, ReasoningEvent, SummaryEvent

public abstract sealed class HookEvent extends Object permits PreCallEvent, PostCallEvent, ReasoningEvent, ActingEvent, SummaryEvent, ErrorEvent
Base class for all hook events.

This is a sealed class - only the predefined event types are permitted. This enables exhaustive pattern matching in switch expressions.

All events provide access to common context:

Modifiability: Whether an event allows modification is determined by the presence of setter methods in the concrete event class.

另请参阅:
  • 构造器详细资料

    • HookEvent

      protected HookEvent(HookEventType type, Agent agent)
      Constructor for HookEvent.
      参数:
      type - The event type (must not be null)
      agent - The agent instance (must not be null)
      抛出:
      NullPointerException - if type or agent is null
  • 方法详细资料

    • getType

      public final HookEventType getType()
      Get the event type.
      返回:
      The event type
    • getAgent

      public final Agent getAgent()
      Get the agent instance.
      返回:
      The agent instance (never null)
    • getTimestamp

      public final long getTimestamp()
      Get the timestamp when event was created.
      返回:
      The timestamp (milliseconds since epoch)
    • getMemory

      public final Memory getMemory()
      Convenient access to agent's memory.
      返回:
      The memory, or null if agent doesn't have memory