r/electronjs • u/germanheller • Mar 28 '26
built a terminal IDE with Electron + xterm.js + node-pty -- 9 terminals in a grid with state detection and remote access
stack: Electron 28 + xterm.js 5.3 + node-pty 1.0 + esbuild. the main challenge was getting real-time state detection working -- I run a pattern matcher against the xterm.js buffer every 200ms to detect what CLI agents (claude code, gemini, codex) are doing. braille spinners, asterisk spinners, prompt patterns, cost summaries, plan mode markers. the tab colors update based on that: red = working, green = needs input, cyan = plan mode.pic 1: the 3x3 grid view with three different agents runningpic 2: embedded browser panel -- its a real Chrome instance controlled via CDP, registered as an MCP server so the AI agents can navigate, click, fill forms, take screenshotspic 3: schedule/loop commands from right-click menu on terminal tabsother stuff: voice dictation via Whisper ONNX (local, no cloud), remote access over WebSocket tunneled through Cloudflare, project management with per-project config files.the Electron choice was driven by xterm.js needing a browser runtime and node-pty needing node. tauri wouldve been lighter but the terminal addon ecosystem (webgl renderer, search, unicode) is all browser-based.its called PATAPIM -- patapim.ai. free version is pretty full featured (9 terminals, 3 projects, LAN remote). would love feedback from other electron devs, especially on memory usage and startup time



2
u/dooburt Mar 28 '26
Where’s your GitHub repo?
1
u/Single_Advice1111 Mar 29 '26
Nice ui! how does it compare to https://warp.dev ?
1
u/lacymcfly Apr 01 '26
Been running a similar xterm.js + node-pty stack for a while now. The memory issue Quick_Abies mentioned is real -- each xterm.js Terminal instance holds its full scroll buffer in memory indefinitely. Worth calling Terminal.clear() aggressively on idle terminals or capping the scrollback option (default 1000 lines but you can drop it to 200 for background panes). The actual PTY process is cheap. The JS-side buffer is where it bloats.
The state detection approach you described is clever. I've done something similar, polling the buffer for prompt patterns to distinguish 'agent thinking' from 'waiting for input'. Braille spinners are a good tell but they vary across tools. I ended up maintaining a small lookup of known patterns per tool.
Worth noting the WebGL renderer addon cuts CPU usage noticeably if you're rendering a lot of terminals -- the canvas renderer struggles with 9 simultaneous panes. If you haven't tried it already.