yt-video-terminal
Simple AI terminal from my YouTube video. A simplified explanation of Terax, my main terminal project.
Links
README
From the repo.
Minimal AI Terminal
A small, GPU-accelerated AI terminal built from scratch with Rust, Tauri, and React. This is the companion source for the video How to Build Your Own AI Terminal.
It is intentionally minimal: the smallest solid terminal that still does the real thing, a PTY-backed shell, GPU rendering, and an AI agent that can read the terminal and run commands. For the full product built on these ideas, see Terax.
If the video does not play inline, watch terminal-preview.mp4.
Features
- Real shell in a pseudo-terminal (PTY) via
portable-pty, cross-platform. - Raw bytes streamed from Rust to the frontend over a Tauri Channel, no JSON round trip.
- GPU rendering with xterm.js and its WebGL addon.
- An AI panel (OpenAI) that reads recent terminal output and runs commands through the same PTY, using tool calling.
Stack
Rust + Tauri v2 · React 19 + TypeScript + Vite · xterm.js (WebGL) · portable-pty · OpenAI SDK · Tailwind v4 + streamdown
How it works
- Backend (
src-tauri) spawns a shell inside a PTY and exposes three commands:pty_spawn,pty_write,pty_resize. A dedicated thread reads the shell's output and streams the raw bytes to the frontend over a Tauri Channel. - Frontend (
src) renders that byte stream with xterm.js on the GPU, sends keystrokes back throughpty_write, and reflows on resize. - AI agent (
src/lib) gives the model two tools,run_commandandread_terminal, and loops: the model asks for a tool, we run it against the PTY, feed the result back, and repeat until it answers.
The full walkthrough is in the video.
Prerequisites
Run
git clone https://github.com/crynta/yt-video-terminal.git
cd yt-video-terminal
pnpm install
pnpm tauri dev
The terminal works out of the box. To enable the AI panel, add an OpenAI key:
cp .env.example .env.local
# then set VITE_OPENAI_API_KEY in .env.local
Note: this calls OpenAI from the frontend, so the key lives in the app. That is fine for a demo, but in production you would proxy the request through the Rust backend. The model is set in src/lib/agent.ts.
Build
pnpm tauri build
Project structure
src-tauri/src/
pty.rs PTY session: spawn, read thread, write, resize
lib.rs Tauri commands + shared session state
src/
components/
Terminal.tsx xterm.js + WebGL, wired to the PTY
AiPanel.tsx the AI chat panel
lib/
agent.ts OpenAI tool-calling loop
terminalBridge.ts read terminal output + run commands
App.tsx terminal + AI panel layout
License
MIT
Collected info
- ★ 28 stars
- ⎇ 6 forks
- Language: TypeScript
- Source updated: 8/3/2026
Config for your environment
Replace {MCP_ENDPOINT_URL} with this MCP’s endpoint URL (from its repo or docs above). No API key — you connect directly.
Tool
OS
Config file: ~/.cursor/mcp.json
{
"mcpServers": {
"mcp-server": {
"url": "{MCP_ENDPOINT_URL}"
}
}
}Paste into mcpServers in the config file. Restart Cursor after saving.
If this MCP is also published on mcpchannel.ai, you can subscribe from Browse and use the gateway config there instead.