Record Class ChannelBinding
java.lang.Object
java.lang.Record
io.agentscope.harness.agent.gateway.channel.ChannelBinding
- Record Components:
agentId- the target agent id when this binding matches (required)peer- exact peer key to match (e.g."direct:u_42"); highest priorityparentPeer- parent-peer key for thread-parent inheritance (e.g."channel:c_ops")guild- guild/server/workspace id to matchroles- role ids to match within the guild (evaluated alongsideguild); if non-empty the binding is a guild+roles tier binding; if empty it is a guild-only tier bindingteam- team id to matchaccount- account id to matchchannel- channel id to match (lower priority; rarely needed inside channel-specific config)sessionScope- optional per-binding DM session scope override; null means inherit fromChannelConfig.dmScope()
public record ChannelBinding(String agentId, String peer, String parentPeer, String guild, Set<String> roles, String team, String account, String channel, DmScope sessionScope)
extends Record
One routing rule that maps a set of inbound-message conditions to a target
agentId.
A binding is evaluated by ChannelRouter at the tier corresponding to the most
specific non-null condition field it carries (priority order):
peer— exact peer-key match ("direct:u_123"or"channel:c_help")parentPeer— parent-peer key match (thread-parent inheritance)guild+roles— guild membership AND at least one role matchesguildalone — guild membership (no role constraint)team— team id matchaccount— account id matchchannel— channel id match
Within a tier, the first binding in ChannelConfig.bindings() list order that matches
wins. Only one condition tier is active per binding: the most specific non-null field determines
the tier.
The optional sessionScope field provides a per-binding session override: when non-null
it takes precedence over the channel-level ChannelConfig.dmScope() for DM session key
construction.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaccount()Returns the value of theaccountrecord component.agentId()Returns the value of theagentIdrecord component.channel()Returns the value of thechannelrecord component.final booleanIndicates whether some other object is "equal to" this one.static ChannelBindingforAccount(String account, String agentId) Matches a specific account id.static ChannelBindingforChannel(String channel, String agentId) Matches a specific channel id.static ChannelBindingMatches any message from a specific guild (server/workspace).static ChannelBindingforGuildRoles(String guild, Set<String> roles, String agentId) Matches messages from a guild where the sender holds at least one of the given roles.static ChannelBindingforParentPeer(String parentPeer, String agentId) Matches messages that are threads under a specific parent peer.static ChannelBindingMatches an exact peer (e.g. a specific DM user or channel id).static ChannelBindingMatches a specific team id.guild()Returns the value of theguildrecord component.final inthashCode()Returns a hash code value for this object.Returns the value of theparentPeerrecord component.peer()Returns the value of thepeerrecord component.roles()Returns the value of therolesrecord component.Returns the value of thesessionScoperecord component.team()Returns the value of theteamrecord component.final StringtoString()Returns a string representation of this record class.withSessionScope(DmScope scope) Returns a copy of this binding with a per-binding session scope override.
-
Constructor Details
-
ChannelBinding
public ChannelBinding(String agentId, String peer, String parentPeer, String guild, Set<String> roles, String team, String account, String channel, DmScope sessionScope) Creates an instance of aChannelBindingrecord class.- Parameters:
agentId- the value for theagentIdrecord componentpeer- the value for thepeerrecord componentparentPeer- the value for theparentPeerrecord componentguild- the value for theguildrecord componentroles- the value for therolesrecord componentteam- the value for theteamrecord componentaccount- the value for theaccountrecord componentchannel- the value for thechannelrecord componentsessionScope- the value for thesessionScoperecord component
-
-
Method Details
-
forPeer
Matches an exact peer (e.g. a specific DM user or channel id). -
forParentPeer
Matches messages that are threads under a specific parent peer. -
forGuild
Matches any message from a specific guild (server/workspace). -
forGuildRoles
Matches messages from a guild where the sender holds at least one of the given roles. -
forTeam
Matches a specific team id. -
forAccount
Matches a specific account id. -
forChannel
Matches a specific channel id. -
withSessionScope
Returns a copy of this binding with a per-binding session scope override. -
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object). -
agentId
Returns the value of theagentIdrecord component.- Returns:
- the value of the
agentIdrecord component
-
peer
Returns the value of thepeerrecord component.- Returns:
- the value of the
peerrecord component
-
parentPeer
Returns the value of theparentPeerrecord component.- Returns:
- the value of the
parentPeerrecord component
-
guild
Returns the value of theguildrecord component.- Returns:
- the value of the
guildrecord component
-
roles
Returns the value of therolesrecord component.- Returns:
- the value of the
rolesrecord component
-
team
Returns the value of theteamrecord component.- Returns:
- the value of the
teamrecord component
-
account
Returns the value of theaccountrecord component.- Returns:
- the value of the
accountrecord component
-
channel
Returns the value of thechannelrecord component.- Returns:
- the value of the
channelrecord component
-
sessionScope
Returns the value of thesessionScoperecord component.- Returns:
- the value of the
sessionScoperecord component
-