为第三方插件提供宿主→客户端事件转发扩展点(如 session/open) #5358
Replies: 1 comment
|
Verified against 1. The runtime gate is single-slot, not just convention
So a third-party plugin calling 2. The type side is already open — the merge seats exist The type projection is not a private list; it is merge-extensible by design:
So the current asymmetry is: types are open, runtime is closed. A plugin can already declare 3. The session-controller forwarded vocabulary is exactly five events, all already allowlisted: Design sketch (minimal, preserving the current intent) The current design's intent is an auditable forward surface: one file lists every event a client can ever see, and producers stay private so business plugins can only
Your acceptance criteria map cleanly onto this: no official edits (the plugin registers through the service), survives upgrades (it is an official API), and Workaround today, precisely scoped: if the bridge plugin drives the session open through the official host-side session services, the client's list state will already update via the existing Thanks for the reference implementation — |
Uh oh!
There was an error while loading. Please reload this page.
一句话预期结果:第三方插件(如桌宠)应能通过官方 API 把宿主事件(如
session/open)转发给 Web 客户端,客户端用ctx.remote.$on订阅,而无需修改官方 allowlist 或绕过 harness。背景 / 动机
桌宠插件(
dsh-pet-plugin)需要在"用户点击桌宠托盘里的会话项"时,让 DSH Web 客户端跳转到对应会话。链路是:但当前宿主→客户端事件只有一条通道:
packages/api/remotes/src/remote-events.ts的API_REMOTE_FORWARDED_EVENTS。官方设计明确说明:$on."也就是说第三方插件没有官方扩展点来把宿主事件加入转发表。目前的可行做法只有:
dsh-api-remotes安装包的 allowlist(升级 DSH 即被覆盖,且修改了官方代码);期望
提供一个官方扩展点,让第三方插件能注册一个可转发的宿主事件,例如:
registerForwardedEvent({ event: 'session/open', mode: 'emit' }),或注册后,客户端即可通过现有
ctx.remote.$on('session/open', …)订阅,无需其他改官方代码。验收条件
ctx.remote.$on的类型/模式约束(TypertForwardableEventEntry)对注册事件同样生效。用户或模型可见变化
桌宠托盘点击 → DSH GUI 切换到对应会话,不再依赖修改官方代码。
测试证据
https://github.com/yshark/dsh-pet-plugin的plugins/pet(桥接插件)与apps/desktop-pet(桌宠 + 独立托盘窗口)。dsh-api-remotes的API_REMOTE_FORWARDED_EVENTS(加入{ event: 'session/open', mode: 'emit' }),alpha 升级时补丁即被覆盖、需重打——这正是希望官方解决的脆弱点。.agents/notes/implemented/architecture/2026-08-10-remote-event-delivery.md。All reactions