Node-based terminal manager for AI coding agents — tmux-backed terminals and parallel agent sessions as draggable nodes on an infinite pan/zoom canvas. macOS, Linux, and a browser Server Edition.
TypeScript adhdagent-orchestrationai-agentscanvasclaude-codecodexcoding-agentsdeveloper-toolselectrongeminilinuxmacosmultiplexeropencodeparallel-agentsterminalterminal-emulatorterminal-multiplexertmuxworkspace-manager
fix(server): platform.on supports multiple listeners per channel (matches ipcMain.on)
enes02635f0429c7
diff --git a/src/server/platform-server.test.ts b/src/server/platform-server.test.tsindex 5a355df55..1f5b03a22 100644--- a/src/server/platform-server.test.ts+++ b/src/server/platform-server.test.ts@@ -45,6 +45,18 @@ describe('ServerPlatform', () => {expect(got).toEqual(['hello'])})+ it('on() supports multiple listeners per channel; cast fires all of them', () => {+ const p = new ServerPlatform({ userDataDir: '/tmp', appVersion: '0' })+ const hits: string[] = []+ p.on('w', (a: string) => hits.push(`A:${a}`))+ p.on('w', (a: string) => hits.push(`B:${a}`))+ const ui = p.attach({ sendText: () => {}, sendBinary: () => {} })+ p.cast(ui, 'w', ['x'])+ expect(hits).toEqual(['A:x', 'B:x'])+ p.cast(ui, 'unknown', ['ignored']) // no listener → silent no-op+ expect(hits).toEqual(['A:x', 'B:x'])+ })+it('sendTo routes pty:data as binary, other channels as JSON events, drops when detached', () => {const p = new ServerPlatform({ userDataDir: '/tmp/x', appVersion: '1.0.0' })const a = fakeSink()diff --git a/src/server/platform-server.ts b/src/server/platform-server.tsindex 0c253f531..6b98165b0 100644--- a/src/server/platform-server.ts+++ b/src/server/platform-server.ts@@ -30,7 +30,7 @@ export class ServerPlatform implements CorePlatform {readonly isPackaged = trueprivate handlers = new Map<string, Handler>()- private listeners = new Map<string, (...args: any[]) => void>()+ private listeners = new Map<string, Set<(...args: any[]) => void>>()private sinks = new Map<number, UiSink>()private nextUiId = 1@@ -57,7 +57,12 @@ export class ServerPlatform implements CorePlatform {}on(channel: string, fn: (...args: any[]) => void): void {- this.listeners.set(channel, fn)+ let set = this.listeners.get(channel)+ if (!set) {+ set = new Set()+ this.listeners.set(channel, set)+ }+ set.add(fn)}sendTo(uiId: number, channel: string, ...args: any[]): void {@@ -127,6 +132,8 @@ export class ServerPlatform implements CorePlatform {cast(uiId: number, method: string, args: unknown[]): void {void uiId- this.listeners.get(method)?.(...args)+ const set = this.listeners.get(method)+ if (!set) return+ for (const fn of set) fn(...args)}}