You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The forwarded-host-event bridge works end to end: api-proxy subscribes to API_REMOTE_FORWARDED_EVENTS and wraps each as a host/remote-event frame; the client runtime dispatches it to ctx.remote.$on. But the vocabulary is closed — API_REMOTE_FORWARDED_EVENTS is an 11-name as const allowlist in packages/api/remotes/src/remote-events.ts, and TypertRemoteEvent (the $on key face) is never unless an event is listed there.
A plugin that needs to push its own event to the browser client — e.g. a file-backed signal inbox that changes without a model turn — has no seam today: connection.rpc.call is unary request/response, and ConnectionHandle.start(sinks) is single-owner (the runtime object layer). Polling is the only option.
Proposal
Add one generic forwarded event to the allowlist — client/push with args [channel: string, payload: JsonValue] — and declare it in the Cordis Events map. Host plugins emit ctx.emit('client/push', channel, payload); client plugins subscribe via ctx.remote.$on('client/push', (channel, payload) => …). This reuses the existing host/remote-event path (JSON-safe, verbatim, allowlist-controlled) while making the channel content plugin-defined instead of one allowlist entry per plugin.
Why not one entry per plugin event?
It couples the DSH core allowlist to downstream plugin vocabulary, and every new plugin event needs another core change. A single client/push channel keeps the allowlist as the control point but leaves the payload vocabulary to plugins.
Ask
Is a generic client/push channel the direction you'd endorse? (Noting CONTRIBUTING says external PRs aren't accepted yet, so this is shared as a roadmap idea.) If you'd prefer a first-class ctx.clientEvents Service Definition / Provider / Consumer seam instead, we'd love to hear the intended shape. Either way we'll proceed with a local patch on our fork meanwhile.
2. 有些状态根本不该被缓存,于是轮询变成了强制的实时请求。
我们源码里另一行注释:"The panel polls; a cached answer would freeze the thread mid-turn." ——因为拿不到"变了"这个信号,我们连缓存都不敢做,只能每次都真算一遍。没有推送通道,连"什么时候可以偷懒"都无从判断。
你举的例子(file-backed signal inbox,不经过模型轮次就会变)和我们的处境完全一样:变化的时刻在 host 侧是精确已知的,只是没有任何办法把这个时刻告诉浏览器。
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Context
The forwarded-host-event bridge works end to end:
api-proxysubscribes toAPI_REMOTE_FORWARDED_EVENTSand wraps each as ahost/remote-eventframe; the client runtime dispatches it toctx.remote.$on. But the vocabulary is closed —API_REMOTE_FORWARDED_EVENTSis an 11-nameas constallowlist inpackages/api/remotes/src/remote-events.ts, andTypertRemoteEvent(the$onkey face) isneverunless an event is listed there.A plugin that needs to push its own event to the browser client — e.g. a file-backed signal inbox that changes without a model turn — has no seam today:
connection.rpc.callis unary request/response, andConnectionHandle.start(sinks)is single-owner (the runtime object layer). Polling is the only option.Proposal
Add one generic forwarded event to the allowlist —
client/pushwith args[channel: string, payload: JsonValue]— and declare it in the Cordis Events map. Host plugins emitctx.emit('client/push', channel, payload); client plugins subscribe viactx.remote.$on('client/push', (channel, payload) => …). This reuses the existinghost/remote-eventpath (JSON-safe, verbatim, allowlist-controlled) while making the channel content plugin-defined instead of one allowlist entry per plugin.Why not one entry per plugin event?
It couples the DSH core allowlist to downstream plugin vocabulary, and every new plugin event needs another core change. A single
client/pushchannel keeps the allowlist as the control point but leaves the payload vocabulary to plugins.Ask
Is a generic
client/pushchannel the direction you'd endorse? (Noting CONTRIBUTING says external PRs aren't accepted yet, so this is shared as a roadmap idea.) If you'd prefer a first-classctx.clientEventsService Definition / Provider / Consumer seam instead, we'd love to hear the intended shape. Either way we'll proceed with a local patch on our fork meanwhile.All reactions