refactor(core): support multiple event streams in worker and remove workspaces from plugin api (#21348)

This commit is contained in:
James Long
2026-04-07 13:22:34 -04:00
committed by GitHub
parent ec8b9810b4
commit 5d48e7bd44
9 changed files with 51 additions and 90 deletions
+12 -3
View File
@@ -43,9 +43,18 @@ function createWorkerFetch(client: RpcClient): typeof fetch {
function createEventSource(client: RpcClient): EventSource {
return {
on: (handler) => client.on<Event>("event", handler),
setWorkspace: (workspaceID) => {
void client.call("setWorkspace", { workspaceID })
subscribe: async (directory, handler) => {
const id = await client.call("subscribe", { directory })
const unsub = client.on<{ id: string; event: Event }>("event", (e) => {
if (e.id === id) {
handler(e.event)
}
})
return () => {
unsub()
client.call("unsubscribe", { id })
}
},
}
}