InboundMessage
public record InboundMessage( String channelId, String accountId, Peer peer, String senderId, Peer parentPeer, String guild, String team, Set<String> roles, List<Msg> messages, String preferredAgentId, RuntimeContext runtimeContext)
io/agentscope/harness/agent/gateway/channel/InboundMessage.java:63–270承载入站消息数据的记录类型。位于 io.agentscope.harness.agent.gateway.channel 包。核心成员包括 channelId、accountId、peer、senderId、parentPeer、guild。
Normalized inbound message produced by a Channel adapter before routing. Carries all
identity and context metadata needed by ChannelRouter to resolve an agent and build a
stable session key.
Two identity fields are deliberately separate:
-
#peer— the conversation identifier used to construct the session key (DM user id, group chat id, channel id) -
#senderId— the message sender's identity, used asuserIdfor HarnessAgent namespace isolation. In DM scenarios these are equal; in group/channel scenariospeer.idis the group andsenderIdis the individual author.
#runtimeContext() is not used for routing and does not participate in session
key computation. It is forwarded to the Gateway as the caller merge base for the agent turn.
记录组件摘要Record Component Summary
| 组件Component | 类型Type | 说明Description |
|---|---|---|
channelId | String | 执行渠道标识相关操作。 identifier of the originating channel (e.g. `"chatui"`, `"slack"`) |
accountId | String | 执行 `accountId` 方法。 optional multi-account identifier (e.g. Slack app installation id); null for
single-account channels |
peer | Peer | 执行对端相关操作。 the conversation peer (DM partner, channel, group, or thread) — used for session key |
senderId | String | 执行 `senderId` 方法。 optional sender identity for user-level isolation; if null, `#peer`'s id is
used as fallback in DM contexts |
parentPeer | Peer | 执行父级对端相关操作。 optional parent peer for thread-nested messages; used for
`binding.peer.parent` inheritance |
guild | String | 执行 `guild` 方法。 optional guild / server / workspace id (Discord guild, Slack workspace) |
team | String | 执行团队相关操作。 optional team id (Slack team, MS Teams team) |
roles | Set<String> | 执行 `roles` 方法。 optional set of role ids the sender holds within the guild; used for
`binding.guild+roles` tier evaluation |
messages | List<Msg> | 执行消息相关操作。 the actual message content to forward to the agent |
preferredAgentId | String | 执行 `preferredAgentId` 方法。 optional explicit agent override evaluated by `ChannelRouter` as a
tier-0 short-circuit before any binding tier. Set this when the caller already knows which
agent should handle the request (e.g. a path-mapped Web UI where the user clicked an agent
card); the router still builds session and outbound context normally so bindings continue to
control `sessionScope` and outbound addressing. `null` for normal binding-driven
routing. |
runtimeContext | RuntimeContext | 执行运行时上下文相关操作。 optional caller-supplied `RuntimeContext` merged into the agent
turn; `null` when none. Not part of routing / session identity. |
嵌套类摘要Nested Class Summary
| 类Class | 类型Kind | 说明Description |
|---|---|---|
Builder | 类class | 构建器,用于构建并配置目标实例。 A class in io.agentscope.harness.agent.gateway.channel that deploys, schedules and serves agents. |
构造器摘要Constructor Summary
方法摘要Method Summary
记录组件详情Record Component Detail
channelId
String channelId执行渠道标识相关操作。
identifier of the originating channel (e.g. "chatui", "slack")
io/agentscope/harness/agent/gateway/channel/InboundMessage.java:63–270accountId
String accountId执行 accountId 方法。
optional multi-account identifier (e.g. Slack app installation id); null for single-account channels
io/agentscope/harness/agent/gateway/channel/InboundMessage.java:63–270peer
Peer peer执行对端相关操作。
the conversation peer (DM partner, channel, group, or thread) — used for session key
io/agentscope/harness/agent/gateway/channel/InboundMessage.java:63–270senderId
String senderId执行 senderId 方法。
optional sender identity for user-level isolation; if null, #peer's id is
used as fallback in DM contexts
io/agentscope/harness/agent/gateway/channel/InboundMessage.java:63–270parentPeer
Peer parentPeer执行父级对端相关操作。
optional parent peer for thread-nested messages; used for
binding.peer.parent inheritance
io/agentscope/harness/agent/gateway/channel/InboundMessage.java:63–270guild
String guild执行 guild 方法。
optional guild / server / workspace id (Discord guild, Slack workspace)
io/agentscope/harness/agent/gateway/channel/InboundMessage.java:63–270team
String team执行团队相关操作。
optional team id (Slack team, MS Teams team)
io/agentscope/harness/agent/gateway/channel/InboundMessage.java:63–270roles
Set<String> roles执行 roles 方法。
optional set of role ids the sender holds within the guild; used for
binding.guild+roles tier evaluation
io/agentscope/harness/agent/gateway/channel/InboundMessage.java:63–270messages
List<Msg> messages执行消息相关操作。
the actual message content to forward to the agent
io/agentscope/harness/agent/gateway/channel/InboundMessage.java:63–270preferredAgentId
String preferredAgentId执行 preferredAgentId 方法。
optional explicit agent override evaluated by ChannelRouter as a
tier-0 short-circuit before any binding tier. Set this when the caller already knows which
agent should handle the request (e.g. a path-mapped Web UI where the user clicked an agent
card); the router still builds session and outbound context normally so bindings continue to
control sessionScope and outbound addressing. null for normal binding-driven
routing.
io/agentscope/harness/agent/gateway/channel/InboundMessage.java:63–270runtimeContext
RuntimeContext runtimeContext执行运行时上下文相关操作。
optional caller-supplied RuntimeContext merged into the agent
turn; null when none. Not part of routing / session identity.
io/agentscope/harness/agent/gateway/channel/InboundMessage.java:63–270构造器详情Constructor Detail
InboundMessage
public InboundMessage(String channelId, String accountId, Peer peer, String senderId, Peer parentPeer, String guild, String team, Set<String> roles, List<Msg> messages, String preferredAgentId, RuntimeContext runtimeContext)
初始化 InboundMessage 实例。
Creates a new instance.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
channelId | String | 渠道标识(类型 `String`)。The channel id. |
accountId | String | account 标识(类型 `String`)。The account id. |
peer | Peer | 对端(类型 `Peer`)。The peer. |
senderId | String | sender 标识(类型 `String`)。The sender id. |
parentPeer | Peer | 父级对端(类型 `Peer`)。The parent peer. |
guild | String | guild(类型 `String`)。The guild. |
team | String | 团队(类型 `String`)。The team. |
roles | Set<String> | roles(类型 `Set`)。The roles. |
messages | List<Msg> | 消息列表(类型 `List`)。The messages. |
preferredAgentId | String | preferred 智能体标识(类型 `String`)。The preferred agent id. |
runtimeContext | RuntimeContext | 运行时上下文(类型 `RuntimeContext`)。The runtime context. |
io/agentscope/harness/agent/gateway/channel/InboundMessage.java:76–81方法详情Method Detail
dm
public static InboundMessage dm(String channelId, String peerId, List<Msg> messages)
执行 dm 方法。
Single-turn DM with no guild/team/role metadata (typical for direct chat UI use).
| 名称Name | 类型Type | 说明Description |
|---|---|---|
channelId | String | 渠道标识(类型 `String`)。The channel id. |
peerId | String | 对端标识(类型 `String`)。The peer id. |
messages | List<Msg> | 消息列表(类型 `List`)。The messages. |
InboundMessageio/agentscope/harness/agent/gateway/channel/InboundMessage.java:89–102dmFor
public static InboundMessage dmFor(String channelId, String peerId, String agentId, List<Msg> messages)
执行dm 用于相关操作。
Single-turn DM with an explicit #preferredAgentId() override — the router will use the supplied agentId as a tier-0 short-circuit instead of evaluating bindings.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
channelId | String | 渠道标识(类型 `String`)。The channel id. |
peerId | String | 对端标识(类型 `String`)。The peer id. |
agentId | String | 智能体标识(类型 `String`)。The agent id. |
messages | List<Msg> | 消息列表(类型 `List`)。The messages. |
InboundMessageio/agentscope/harness/agent/gateway/channel/InboundMessage.java:108–123channel
public static InboundMessage channel(String channelId, String roomId, String senderId, String guild, List<Msg> messages)
执行渠道相关操作。
Channel / group message with optional guild context.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
channelId | String | 渠道标识(类型 `String`)。The channel id. |
roomId | String | room 标识(类型 `String`)。The room id. |
senderId | String | sender 标识(类型 `String`)。The sender id. |
guild | String | guild(类型 `String`)。The guild. |
messages | List<Msg> | 消息列表(类型 `List`)。The messages. |
InboundMessageio/agentscope/harness/agent/gateway/channel/InboundMessage.java:129–143channel
public static InboundMessage channel(String channelId, String roomId, String guild, List<Msg> messages)
执行渠道相关操作。
Channel message with optional guild context (no explicit senderId — sender identity unknown, falls back to room peer for isolation).
| 名称Name | 类型Type | 说明Description |
|---|---|---|
channelId | String | 渠道标识(类型 `String`)。The channel id. |
roomId | String | room 标识(类型 `String`)。The room id. |
guild | String | guild(类型 `String`)。The guild. |
messages | List<Msg> | 消息列表(类型 `List`)。The messages. |
InboundMessageio/agentscope/harness/agent/gateway/channel/InboundMessage.java:149–163isDm
public boolean isDm()
判断是否Dm。
Whether this message originates from a direct / DM peer.
booleanio/agentscope/harness/agent/gateway/channel/InboundMessage.java:166–168isThread
public boolean isThread()
判断是否会话线程。
Whether this message is a thread-nested reply.
booleanio/agentscope/harness/agent/gateway/channel/InboundMessage.java:171–173withRuntimeContext
public InboundMessage withRuntimeContext(RuntimeContext runtimeContext)
执行使用运行时上下文相关操作。
Returns a copy carrying the given RuntimeContext.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
runtimeContext | RuntimeContext | 运行时上下文(类型 `RuntimeContext`)。The runtime context. |
InboundMessageio/agentscope/harness/agent/gateway/channel/InboundMessage.java:176–189builder
public static Builder builder(String channelId, Peer peer, List<Msg> messages)
返回构建器实例。
Returns a builder for constructing messages with all optional fields.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
channelId | String | 渠道标识(类型 `String`)。The channel id. |
peer | Peer | 对端(类型 `Peer`)。The peer. |
messages | List<Msg> | 消息列表(类型 `List`)。The messages. |
Builderio/agentscope/harness/agent/gateway/channel/InboundMessage.java:192–194嵌套类详情Nested Class Detail
Builder
public static final class Builder构建器,用于构建并配置目标实例。位于 io.agentscope.harness.agent.gateway.channel 包。核心成员包括 accountId、senderId、parentPeer、guild、team、roles。
A class in io.agentscope.harness.agent.gateway.channel that deploys, schedules and serves agents. Declared in io.agentscope.harness.agent.gateway.channel.