Repository navigation
Backlog
Description
需求
由持有实例的一方,按 id 把调用交给内层作用域的数据面。依据是 ADR 027,按 #2200 修改后的 D1–D6:不另建路由机制和索引,查的是持有者已有的表。写法和调用方的下一步,以本 issue 的已定决定为准。
- 进程到 Session:Agents 持有 Session。
sessions.call({ sessionId, lineId?, service, method, args })按sessionId选 Session,带lineId时再交给这个 Session 选线。 - Session 到线:Session 持有它的线。Session 部件用
sessionScope.lineCall({ lineId, service, method, args }),只能到本 Session 的线。 - 可调用范围:目标作用域在 catalog 中共享的数据面。到一条线时,可以调这条线的
timelineContext,以及线上各个 Capability。不包括机制登记点(sessionMethods、toolRegistry等)和生命周期服务。 - 一套操作:Rust 和其他语言调用同一组数据操作,Rust 不另有取对象的入口(见 #2015)。
- 实例键:不交给调用方。Session 边界契约中「实例键只在实例内部可读」的约定不变。
- 可用范围:Rust 部件在进程内调用;语言运行时和 UI leaf 经 rutis 会话调用。RPC 客户端不走这条路径。
- 加载:
sessions.call在调用期间保持 Session 加载,没加载就先加载(ADR 027 D5)。 - 能选中的线:线发布之后才能选中,结束之后选不中。两条路径都查 TimelineTree 的同一份发布状态(
published),不另建线的表。 - 错误:目标所有者的错误原样传递。选不中、或者加载不了时,回答以下六种之一,先选 Session,再选线,最后选服务。这些错误都在调用目标的操作之前回答:
NoSession:Session 不存在,或已经关闭、不能再加载。只有进程调用方会收到。调用方停止,不重试。SessionClosing:Session 正在关闭,目标是其中的线时也回答这个错误。调用方结束本次工作。SessionReloading:Agents 正在重载,暂时不能接收调用。只有进程调用方会收到。调用方稍后重试。SessionUnavailable { reason }:Session 存在,但现在加载不了,例如恢复失败,或者它所属的 Agent 不可用。只有进程调用方会收到。调用方把原因报告出去,不重试。NoLine:Session 存活,但这条线还没发布、正在关闭、已关闭,或者不属于该 Session。这对这条线是最终结果,调用方不重试。branch/end之后、实例关闭之前,调用仍然到达这条线的所有者,由所有者按自己的契约回答。NoService { service }:Session 或线已经选中,但这个作用域里没有装这个服务,例如所用的 profile 不含它。调用方的请求满足不了,不重试。这个错误由持有者回答,不当作目标所有者的错误。
- 按 id 调用不是依赖:调用方在每次调用时给出 id 和服务名,不在装配时声明内层组的名字。
使用方
这是底座 base-1(见 #2015),分支 dim/2127-routing(#2174),要先于所有用到它的所有者完成。base-2 删掉 Session 上按线名转发的方法以后,Session 部件和 App Server 都改用它到达一条线。
验收
- 一个流程测试,覆盖两段调用的成功情况,另外:
- Session 空闲卸载后,
sessions.call先加载它,再调用成功; - Session 业务关闭后,答
NoSession; - Session 关闭期间按
lineId调用,答SessionClosing; - Session 存活时线关闭,答
NoLine,同一 Session 的其他调用不受影响; - 线已建立、还没发布时,两条路径都答
NoLine; - Agents 重载期间答
SessionReloading,重载完成后重试成功; - 存储的 Session 恢复失败,答
SessionUnavailable,并带上原因; - 目标所有者返回的错误,名字和内容原样到达调用方。
- Session 空闲卸载后,
- 一个跨语言调用经 rutis 会话到达线作用域的数据面。
- 调用登记点或生命周期服务时被拒绝。
Refs #2015
Activity
docs(design): apply the second review and the round-4 self-checks
docs(design): apply the round-four review
docs(design): address the round-4 review
design(provider): make the bindings writable and resolve the round 4 …
docs(adr): keep ADR 027 at the decision layer
docs(design): apply the round-four review
docs(design): apply the second review and the round-4 self-checks
docs(design): apply the second review and the round-4 self-checks
docs(design): apply the round-four review
docs(design): apply the round-four review
docs(design): apply the second review and the round-4 self-checks
feat(xtask): check the access layer and keep its allowlist
eric8810 commentedon Nov 25, 2026
机制已在 #2174(base-1)交付,
dim/2127-routing分支,转 ready 待评审。交付的接口(两段路由,一组操作,一条路由):
route数据面)Route::session_owner::<T>(sessionId)route.session({sessionId, service, method, args})Route::line_owner::<T>(sessionId, lineId)route.line({sessionId, lineId, service, method, args})route是进程作用域的数据面,由运行时在每个装配里提供(AgentBuilder::plugin_rows);宿主共享跨语言名字时把它标为 shared(session_typescript::share_names)。T是目标所有者自己的数据面类型,返回它、直接调它的操作;跨语言同名同参,回复是数据。AgentError的新变体(Rust 可区分,跨语言收到文本):NoSession(sessionId):空闲卸载、业务关闭或不存在的 Session;调用方向 Agents 取保持后重调。SessionClosing(sessionId):Session 正在关闭,目标是其中的分支时也答它。NoLine { session, line }:Session 存活,分支实例正在关闭、已关闭或不属于该 Session;对该分支是最终结果。branch/end已提交、实例尚未关闭的线仍路由到所有者,由所有者按自己的契约回答(测试覆盖)。sessionMethods、toolRegistry、promptRegistry、guideEntries、submitChecks)和作用域生命周期服务(sessionLifecycle、branchLifecycle)被拒,回答InvalidInput(ADR 027 D3)。这份名单在运行时内,按需随所有者迁移扩充。两处实现取择,供后续 PR 参考:
route,没有另加 Session 作用域的lineRoute:Session 部件用作用域外的进程名字读它,并给出自己的sessionId(SessionIdentity、Mount::session_id)。base-2 若要契约里的line_owner::<T>(line)原样,可在机制之上加一个绑定到本 Session 的 Session 作用域名字。PublicService仍是 Rust 门面对外读的门槛,与现有Session::service/Session::session_service一致。验收:
crates/dim-agent-capabilities/tests/routing_flow.rs覆盖两段路由的成功调用、空闲卸载后NoSession与重新加载后成功、业务关闭后NoSession、Session 关闭期间按branchId调用答SessionClosing、分支关闭答NoLine且同 Session 其他调用不受影响、跨语言经 rutis 会话到达分支组数据面、登记点与生命周期服务被拒。feat(runtime): bind the line route to its Session, and check Rust-onl…
feat(typescript): declare the addressed route a plugin authors against
114 remaining items
feat(runtime): reach the router through its owner, and keep the owner…
test(runtime): prove the router is not a facade read, and the owner's…
feat(runtime): compare an owner failure through both paths, and route…
fix(runtime): take the router off the Session facade
feat(runtime): keep a void reply apart from a null one
feat(runtime): hand the router out as a handle the runtime alone builds
fix(typescript): a routed void is null, and a close says so
docs(runtime): say per surface what a void reply and a closing Sessio…
chore: adapt to main's create_session and restore_session options
test(route): pin no_service on the sessions.call envelope
fix(route): answer an uninstalled service as NoService
test(route): pin no_service on the sessions.call envelope