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
import { describe, it, expect } from 'vitest'
import { buildAgentApi } from './ws-bridge'
import { IPC } from '../../shared/ipc'
function fakeClient() {
const subs: Array<{ channel: string }> = []
const requests: Array<{ channel: string; arg: unknown }> = []
return {
subs,
requests,
subscribe: (channel: string, _fn: (...a: unknown[]) => void) => {
subs.push({ channel })
return () => {}
},
request: (channel: string, arg?: unknown) => {
requests.push({ channel, arg })
return Promise.resolve()
}
}
}
describe('buildAgentApi', () => {
it('onAgentStatus / onSubagentActivity subscribe to the right channels and return an unsub', () => {
const c = fakeClient()
const api = buildAgentApi(c as never)
const un1 = api.onAgentStatus(() => {})
const un2 = api.onSubagentActivity(() => {})
expect(c.subs).toEqual([
{ channel: IPC.agentStatus },
{ channel: IPC.agentSubagentActivity }
])
expect(typeof un1).toBe('function')
expect(typeof un2).toBe('function')
})
it('ackDone fires a fire-and-forget request on the ack-done channel', () => {
const c = fakeClient()
const api = buildAgentApi(c as never)
api.ackDone('nt-x')
expect(c.requests).toEqual([{ channel: IPC.agentAckDone, arg: 'nt-x' }])
})
})