ChannelBinding
public record ChannelBinding( String agentId, String peer, String parentPeer, String guild, Set<String> roles, String team, String account, String channel, DmScope sessionScope)
io/agentscope/harness/agent/gateway/channel/ChannelBinding.java:57–114承载渠道绑定数据的记录类型。位于 io.agentscope.harness.agent.gateway.channel 包。核心成员包括 agentId、peer、parentPeer、guild、roles、team。
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 matches -
#guildalone — guild membership (no role constraint) -
#team— team id match -
#account— account id match -
#channel— 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.
记录组件摘要Record Component Summary
| 组件Component | 类型Type | 说明Description |
|---|---|---|
agentId | String | 执行智能体标识相关操作。 the target agent id when this binding matches (required) |
peer | String | 执行对端相关操作。 exact peer key to match (e.g. `"direct:u_42"`); highest priority |
parentPeer | String | 执行父级对端相关操作。 parent-peer key for thread-parent inheritance (e.g. `"channel:c_ops"`) |
guild | String | 执行 `guild` 方法。 guild/server/workspace id to match |
roles | Set<String> | 执行 `roles` 方法。 role ids to match within the guild (evaluated alongside `guild`); if non-empty
the binding is a guild+roles tier binding; if empty it is a guild-only tier binding |
team | String | 执行团队相关操作。 team id to match |
account | String | 执行 `account` 方法。 account id to match |
channel | String | 执行渠道相关操作。 channel id to match (lower priority; rarely needed inside channel-specific config) |
sessionScope | DmScope | 执行会话范围相关操作。 optional per-binding DM session scope override; null means inherit from
`ChannelConfig#dmScope()` |
构造器摘要Constructor Summary
| 构造器Constructor | 说明Description |
|---|---|
public ChannelBinding(String agentId, String peer, String parentPeer, String guild, Set<String> roles, String team, String account, String channel, DmScope sessionScope) | 初始化 `ChannelBinding` 实例。 Creates a new instance. |
方法摘要Method Summary
记录组件详情Record Component Detail
agentId
String agentId执行智能体标识相关操作。
the target agent id when this binding matches (required)
io/agentscope/harness/agent/gateway/channel/ChannelBinding.java:57–114peer
String peer执行对端相关操作。
exact peer key to match (e.g. "direct:u_42"); highest priority
io/agentscope/harness/agent/gateway/channel/ChannelBinding.java:57–114parentPeer
String parentPeer执行父级对端相关操作。
parent-peer key for thread-parent inheritance (e.g. "channel:c_ops")
io/agentscope/harness/agent/gateway/channel/ChannelBinding.java:57–114guild
String guild执行 guild 方法。
guild/server/workspace id to match
io/agentscope/harness/agent/gateway/channel/ChannelBinding.java:57–114roles
Set<String> roles执行 roles 方法。
role ids to match within the guild (evaluated alongside guild); if non-empty
the binding is a guild+roles tier binding; if empty it is a guild-only tier binding
io/agentscope/harness/agent/gateway/channel/ChannelBinding.java:57–114team
String team执行团队相关操作。
team id to match
io/agentscope/harness/agent/gateway/channel/ChannelBinding.java:57–114account
String account执行 account 方法。
account id to match
io/agentscope/harness/agent/gateway/channel/ChannelBinding.java:57–114channel
String channel执行渠道相关操作。
channel id to match (lower priority; rarely needed inside channel-specific config)
io/agentscope/harness/agent/gateway/channel/ChannelBinding.java:57–114sessionScope
DmScope sessionScope执行会话范围相关操作。
optional per-binding DM session scope override; null means inherit from
ChannelConfig#dmScope()
io/agentscope/harness/agent/gateway/channel/ChannelBinding.java:57–114构造器详情Constructor Detail
ChannelBinding
public ChannelBinding(String agentId, String peer, String parentPeer, String guild, Set<String> roles, String team, String account, String channel, DmScope sessionScope)
初始化 ChannelBinding 实例。
Creates a new instance.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
agentId | String | 智能体标识(类型 `String`)。The agent id. |
peer | String | 对端(类型 `String`)。The peer. |
parentPeer | String | 父级对端(类型 `String`)。The parent peer. |
guild | String | guild(类型 `String`)。The guild. |
roles | Set<String> | roles(类型 `Set`)。The roles. |
team | String | 团队(类型 `String`)。The team. |
account | String | account(类型 `String`)。The account. |
channel | String | 渠道(类型 `String`)。The channel. |
sessionScope | DmScope | 会话范围(类型 `DmScope`)。The session scope. |
io/agentscope/harness/agent/gateway/channel/ChannelBinding.java:68–71方法详情Method Detail
forPeer
public static ChannelBinding forPeer(String peer, String agentId)
执行用于对端相关操作。
Matches an exact peer (e.g.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
peer | String | 对端(类型 `String`)。The peer. |
agentId | String | 智能体标识(类型 `String`)。The agent id. |
ChannelBindingio/agentscope/harness/agent/gateway/channel/ChannelBinding.java:74–76forParentPeer
public static ChannelBinding forParentPeer(String parentPeer, String agentId)
执行用于父级对端相关操作。
Matches messages that are threads under a specific parent peer.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
parentPeer | String | 父级对端(类型 `String`)。The parent peer. |
agentId | String | 智能体标识(类型 `String`)。The agent id. |
ChannelBindingio/agentscope/harness/agent/gateway/channel/ChannelBinding.java:79–82forGuild
public static ChannelBinding forGuild(String guild, String agentId)
执行 forGuild 方法。
Matches any message from a specific guild (server/workspace).
| 名称Name | 类型Type | 说明Description |
|---|---|---|
guild | String | guild(类型 `String`)。The guild. |
agentId | String | 智能体标识(类型 `String`)。The agent id. |
ChannelBindingio/agentscope/harness/agent/gateway/channel/ChannelBinding.java:85–87forGuildRoles
public static ChannelBinding forGuildRoles(String guild, Set<String> roles, String agentId)
执行 forGuildRoles 方法。
Matches messages from a guild where the sender holds at least one of the given roles.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
guild | String | guild(类型 `String`)。The guild. |
roles | Set<String> | roles(类型 `Set`)。The roles. |
agentId | String | 智能体标识(类型 `String`)。The agent id. |
ChannelBindingio/agentscope/harness/agent/gateway/channel/ChannelBinding.java:90–92forTeam
public static ChannelBinding forTeam(String team, String agentId)
执行用于团队相关操作。
Matches a specific team id.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
team | String | 团队(类型 `String`)。The team. |
agentId | String | 智能体标识(类型 `String`)。The agent id. |
ChannelBindingio/agentscope/harness/agent/gateway/channel/ChannelBinding.java:95–97forAccount
public static ChannelBinding forAccount(String account, String agentId)
执行 forAccount 方法。
Matches a specific account id.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
account | String | account(类型 `String`)。The account. |
agentId | String | 智能体标识(类型 `String`)。The agent id. |
ChannelBindingio/agentscope/harness/agent/gateway/channel/ChannelBinding.java:100–102forChannel
public static ChannelBinding forChannel(String channel, String agentId)
执行用于渠道相关操作。
Matches a specific channel id.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
channel | String | 渠道(类型 `String`)。The channel. |
agentId | String | 智能体标识(类型 `String`)。The agent id. |
ChannelBindingio/agentscope/harness/agent/gateway/channel/ChannelBinding.java:105–107withSessionScope
public ChannelBinding withSessionScope(DmScope scope)
执行使用会话范围相关操作。
Returns a copy of this binding with a per-binding session scope override.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
scope | DmScope | 范围(类型 `DmScope`)。The scope. |
ChannelBindingio/agentscope/harness/agent/gateway/channel/ChannelBinding.java:110–113