Class RemoteEventCodec
java.lang.Object
io.agentscope.harness.agent.subagent.protocol.RemoteEventCodec
Bidirectional mapping between internal
AgentEvents and stable RemoteAgentEvent
wire DTOs.-
Method Summary
Modifier and TypeMethodDescriptionstatic Optional<RemoteAgentEvent>fromAgentEvent(io.agentscope.core.event.AgentEvent event) Maps an internal agent event to a protocol DTO (without seq/taskId — those are assigned by the server event bus).static booleanmatchesDetail(RemoteAgentEvent event, String detail) Detail check for a whole DTO; equivalent tomatchesDetail(RemoteEventType, String).static booleanmatchesDetail(RemoteEventType type, String detail) Whether this event type should be emitted for the given detail level.static Optional<io.agentscope.core.event.AgentEvent>toAgentEvent(RemoteAgentEvent remote) Maps a protocol DTO back to an internalAgentEvent.
-
Method Details
-
fromAgentEvent
Maps an internal agent event to a protocol DTO (without seq/taskId — those are assigned by the server event bus).Every event also carries its full serialization in
RemoteAgentEvent.getPayload(), so a client can restore the original instance instead of the lossy flat fields. Event types without a dedicated wire type are forwarded asRemoteEventType.AGENT_EVENTand are only visible atdetail=verbose. -
toAgentEvent
Maps a protocol DTO back to an internalAgentEvent. Unknown or incomplete types are dropped. When the DTO carries ataskId, it is copied ontoAgentEvent.METADATA_TASK_ID.A
payloadis preferred over the flat fields: it restores the original event with its ids, timestamps and metadata intact, and is the only way to recover events sent asRemoteEventType.AGENT_EVENT. Servers too old to send one still decode through the per-type mapping below. -
matchesDetail
Whether this event type should be emitted for the given detail level.- Parameters:
type- event typedetail- seeRemoteStreamDetail
-
matchesDetail
Detail check for a whole DTO; equivalent tomatchesDetail(RemoteEventType, String).
-