mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-10-22 16:51:28 +02:00
fix: wire plugin event subscriptions from worker to host
Plugin workers register event handlers via `ctx.events.on()` in the SDK,
but these subscriptions were never forwarded to the host process. The host
sends events via `notifyWorker("onEvent", ...)` which produces a JSON-RPC
notification (no `id`), but the worker only dispatched `onEvent` as a
request handler — notifications were silently dropped.
Changes:
- Add `events.subscribe` RPC method so workers can register subscriptions
on the host-side event bus during setup
- Handle `onEvent` notifications in the worker notification dispatcher
(previously only `agents.sessions.event` was handled)
- Add `events.subscribe` to HostServices interface, capability map, and
host client handler
- Add `subscribe` handler in host services that registers on the scoped
plugin event bus and forwards matched events to the worker
This commit is contained in:
1 parent
675421f3a9
commit
61fd5486e8
4 files changed
+36
-1
No files matched your search
@@ -556,6 +556,17 @@ export function buildHostServices(
|
||||
}
|
||||
await scopedBus.emit(params.name, params.companyId, params.payload);
|
||||
},
|
||||
async subscribe(params: { eventPattern: string; filter?: Record<string, unknown> }) {
|
||||
scopedBus.subscribe(
|
||||
params.eventPattern as any,
|
||||
params.filter as any ?? {},
|
||||
async (event) => {
|
||||
if (notifyWorker) {
|
||||
notifyWorker("onEvent", { event });
|
||||
}
|
||||
},
|
||||
);
|
||||
},
|
||||
},
|
||||
|
||||
http: {
|
||||
|
||||
Reference in new issue
Block a user