ManagedSessionChannelBridge
@Component public class ManagedSessionChannelBridge
io/agentscope/builder/web/managed/ManagedSessionChannelBridge.java:52–233托管会话渠道 Bridge,承载智能体的部署、调度与服务化运行。位于 io.agentscope.builder.web.managed 包。核心成员包括 dispatchAndAwaitReply、ManagedSessionChannelBridge。
Bridges inbound IM channel turns (DingTalk, Feishu, WeCom, GitHub, GitLab, ...) into the managed-session model across plane boundaries:
-
POST /api/internal/sessions/find-or-createon the control plane resolves (or creates and version-pins) the session for the channel conversation; -
POST /api/sessions/{id}/eventson the data plane posts the user message, which schedules the harness turn asynchronously; -
GET /api/sessions/{id}/events?after=seqon the data plane is polled until the turn reaches a terminal status, and the lastagent.messagetext is returned as the channel reply.
All calls authenticate with the shared internal token; the acting owner is carried in
X-Builder-Internal-User so the receiving plane attributes the operation to the channel
tenant. The bridge performs blocking polls on boundedElastic — one in-flight turn per
channel conversation, so contention stays bounded by inbound message rate.
构造器摘要Constructor Summary
| 构造器Constructor | 说明Description |
|---|---|
public ManagedSessionChannelBridge(WebClient controlPlane, WebClient dataPlane, long replyTimeoutMs, long pollIntervalMs) | 初始化 `ManagedSessionChannelBridge` 实例。 Creates a new instance. |
方法摘要Method Summary
| 方法Method | 说明Description |
|---|---|
public Mono<String> dispatchAndAwaitReply(String ownerId, String agentId, String externalKey, String text) | 执行 `dispatchAndAwaitReply` 方法。 Posts `text` as a user message on the found-or-created managed session and waits for
the turn to finish, returning the assistant reply text. |
public Mono<String> dispatchAndAwaitReply(String ownerId, String agentId, String text)deprecated | 执行 `dispatchAndAwaitReply` 方法。 Performs the dispatch and await reply operation. |
构造器详情Constructor Detail
ManagedSessionChannelBridge
public ManagedSessionChannelBridge(WebClient controlPlane, WebClient dataPlane, long replyTimeoutMs, long pollIntervalMs)
初始化 ManagedSessionChannelBridge 实例。
Creates a new instance.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
controlPlane | WebClient | 控制面(类型 `WebClient`)。The control plane. |
dataPlane | WebClient | 数据面(类型 `WebClient`)。The data plane. |
replyTimeoutMs | long | 回复超时 Ms(类型 `long`)。The reply timeout ms. |
pollIntervalMs | long | poll 间隔 Ms(类型 `long`)。The poll interval ms. |
io/agentscope/builder/web/managed/ManagedSessionChannelBridge.java:65–74方法详情Method Detail
dispatchAndAwaitReply
public Mono<String> dispatchAndAwaitReply(String ownerId, String agentId, String externalKey, String text)
执行 dispatchAndAwaitReply 方法。
Posts text as a user message on the found-or-created managed session and waits for the turn to finish, returning the assistant reply text.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
ownerId | String | 所有者标识(类型 `String`)。Builder tenant that owns the channel / agent (not the IM peer) |
agentId | String | 智能体标识(类型 `String`)。target managed agent id |
externalKey | String | 外部键(类型 `String`)。stable conversation key (`ChannelExternalKeys`) |
text | String | 文本(类型 `String`)。user message text |
Mono<String>io/agentscope/builder/web/managed/ManagedSessionChannelBridge.java:85–89dispatchAndAwaitReply
public Mono<String> dispatchAndAwaitReply(String ownerId, String agentId, String text)
执行 dispatchAndAwaitReply 方法。
Performs the dispatch and await reply operation.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
ownerId | String | 所有者标识(类型 `String`)。The owner id. |
agentId | String | 智能体标识(类型 `String`)。The agent id. |
text | String | 文本(类型 `String`)。The text. |
Mono<String>io/agentscope/builder/web/managed/ManagedSessionChannelBridge.java:92–95