🚨 Active Supply Chain Attack:node-ipc Package Compromised.Learn More β†’
Socket
Book a DemoSign in
Socket

ai-cli-online

Package Overview
Dependencies
Maintainers
1
Versions
42
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ai-cli-online

AI-Cli Online - Web Terminal for Claude Code via xterm.js + tmux

latest
Source
npmnpm
Version
3.0.20
Version published
Weekly downloads
35
9.38%
Maintainers
1
Weekly downloads
Β 
Created
Source

AI-Cli Online

npm version License: MIT Node.js

An AI-powered development environment that runs in your browser. Persistent terminal sessions, structured task lifecycle, and autonomous execution β€” all through a single Node.js process.

Built for running Claude Code, Codex CLI, Gemini CLI, or any other AI CLI over unstable networks. tmux keeps everything alive when connections drop; the browser UI provides planning, annotation, and chat panels alongside the terminal.

npm: https://www.npmjs.com/package/ai-cli-online | GitHub: https://github.com/huacheng/ai-cli-online

δΈ­ζ–‡ζ–‡ζ‘£

screenshot

What It Does

Terminal + Planning + Execution in one screen:

β”Œβ”€ Tabs ──────────────────────────────────────────────────────┐
β”‚ β”Œβ”€ Plan Panel ──────┬─ Terminal ────────────────────────┐   β”‚
β”‚ β”‚ AiTasks/ browser   β”‚                                   β”‚   β”‚
β”‚ β”‚ Markdown viewer    β”‚  $ /ai-cli-task auto my-feature   β”‚   β”‚
β”‚ β”‚ Inline annotations β”‚  β–Ά planning...                    β”‚   β”‚
β”‚ β”‚ (insert/delete/    β”‚  β–Ά check(post-plan): PASS         β”‚   β”‚
β”‚ β”‚  replace/comment)  β”‚  β–Ά executing step 1/4...          β”‚   β”‚
β”‚ β”‚                    β”‚  β–Ά executing step 2/4...          β”‚   β”‚
β”‚ β”‚ Mermaid diagrams   β”‚  ...                              β”‚   β”‚
β”‚ β”‚                    β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€   β”‚
β”‚ β”‚                    β”‚ Chat Editor                        β”‚   β”‚
β”‚ β”‚                    β”‚ Multi-line Markdown + /commands    β”‚   β”‚
β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜   β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
  • Plan Panel β€” browse AiTasks/ files, annotate documents with 4 annotation types, send structured feedback to AI
  • Terminal β€” full xterm.js with WebGL rendering, binary protocol for ultra-low latency
  • Chat Editor β€” multi-line Markdown editor with slash commands, server-side draft persistence
  • All three panels can be open simultaneously, each independently resizable

AI Task Lifecycle

The ai-cli-task plugin provides an 8-skill lifecycle for structured AI task execution:

init β†’ plan β†’ check β†’ exec β†’ check β†’ merge β†’ report
                ↑        ↓
              re-plan β†β”€β”€β”˜ (on issues)
SkillWhat it does
initCreate task module (AiTasks/<name>/), git branch, optional worktree
planGenerate implementation plan or process human annotations
checkEvaluate feasibility at 3 checkpoints (post-plan / mid-exec / post-exec)
execExecute plan steps with per-step verification
mergeMerge task branch to main with conflict resolution (up to 3 retries)
reportGenerate completion report, distill lessons to experience database
autoRun the full lifecycle autonomously in a single Claude session
cancelStop execution, set status to cancelled, optional cleanup

Auto Mode

/ai-cli-task auto my-feature

One command triggers the entire lifecycle. A single Claude session runs plan β†’ check β†’ exec β†’ merge β†’ report internally, sharing context across all steps. A daemon monitors progress via .auto-signal files, enforces timeouts, and detects stalls.

Task Structure

AiTasks/
β”œβ”€β”€ .index.json                  # Module listing
β”œβ”€β”€ .experiences/                # Cross-task knowledge base (by domain type)
β”‚   β”œβ”€β”€ .summary.md              # Experience file index
β”‚   └── <type>.md
β”œβ”€β”€ .references/                 # External reference materials (collected during plan/exec)
β”‚   β”œβ”€β”€ .summary.md              # Reference file index
β”‚   └── <topic>.md
└── my-feature/
    β”œβ”€β”€ .index.json              # Status, phase, timestamps, dependencies (JSON)
    β”œβ”€β”€ .target.md               # Requirements (human-authored)
    β”œβ”€β”€ .summary.md              # Condensed context (prevents context overflow)
    β”œβ”€β”€ .analysis/               # Evaluation history
    β”œβ”€β”€ .test/                   # Test criteria & results
    β”œβ”€β”€ .bugfix/                 # Issue history
    β”œβ”€β”€ .notes/                  # Research findings
    β”œβ”€β”€ .report.md               # Completion report
    └── .plan.md                 # Implementation plan

Type-Aware Execution

Tasks are classified by domain type (software, dsp, ml, literary, science:physics, etc.). Each type adapts planning methodology, execution tools, and verification criteria. Completed task lessons are stored in .experiences/<type>.md and referenced by future tasks of the same type.

Terminal Features

  • Session Persistence β€” tmux keeps processes alive through disconnects; fixed socket path ensures auto-reconnect after server restarts
  • Multi-Tab β€” independent terminal groups with layout persistence across refreshes
  • Split Panes β€” horizontal / vertical splits, arbitrarily nested
  • Binary Protocol β€” 1-byte prefix frames for terminal I/O, TCP Nagle disabled, WebSocket compression
  • WebGL Rendering β€” 3-10x throughput vs canvas
  • Copy & Paste β€” mouse selection auto-copies; right-click pastes
  • Scroll History β€” capture-pane scrollback with ANSI color preservation
  • File Transfer β€” upload/download files, browse directories, download CWD as tar.gz
  • Network Indicator β€” real-time RTT latency with signal bars
  • Auto Reconnect β€” exponential backoff with jitter

Annotation System

The Plan panel provides 4 annotation types for structured AI feedback:

TypeIconDescription
Insert+Add content at a specific location
Deleteβˆ’Mark text for removal
Replace↔Substitute old text with new
Comment?Ask questions or leave notes

Annotations are persisted (localStorage + SQLite) and sent to the AI as structured JSON. The plan skill processes them β€” triaging by impact, applying changes, and updating task files.

Quick Start

npx ai-cli-online

Option 2: Global Install

npm install -g ai-cli-online
ai-cli-online

Option 3: From Source

git clone https://github.com/huacheng/ai-cli-online.git
cd ai-cli-online
npm install
npm run build
npm start

Prerequisites

  • Node.js >= 18
  • tmux installed (sudo apt install tmux or brew install tmux)

Configuration

Create server/.env:

PORT=3001                        # Server port
HOST=0.0.0.0                     # Bind address
AUTH_TOKEN=your-secret-token     # Auth token (required for production)
DEFAULT_WORKING_DIR=/home/user   # Default working directory
HTTPS_ENABLED=true               # Set to false behind nginx reverse proxy
TRUST_PROXY=1                    # Set to 1 when behind nginx/reverse proxy

See server/.env.example for all available options.

Architecture

Browser (xterm.js + WebGL)
  β”œβ”€β”€ Plan Panel (annotation editor)
  β”œβ”€β”€ Chat Editor (Markdown + /commands)
  └── Terminal View (WebGL renderer)
        β”‚
        ↕ WebSocket binary/JSON + REST API
        β”‚
Express Server (Node.js)
  β”œβ”€β”€ WebSocket ↔ PTY relay
  β”œβ”€β”€ tmux session manager
  β”œβ”€β”€ File transfer API
  β”œβ”€β”€ SQLite (drafts, annotations, settings)
  └── Route modules (sessions, files, editor, settings)
        β”‚
        ↕ PTY / tmux sockets
        β”‚
tmux sessions β†’ shell β†’ Claude Code / AI agents
  └── AiTasks/ lifecycle (init/plan/check/exec/merge/report/auto)
  • Frontend: React + Zustand + xterm.js (WebGL)
  • Backend: Node.js + Express + node-pty + WebSocket + better-sqlite3
  • Session Manager: tmux (persistent terminal sessions)
  • Layout: Tabs + recursive split tree (LeafNode / SplitNode)
  • Transport: Binary frames (hot path) + JSON (control messages)
  • Task System: 8-skill plugin with state machine, dependency gates, and experience database

Project Structure

ai-cli-online/
β”œβ”€β”€ shared/              # Shared type definitions
β”œβ”€β”€ server/src/
β”‚   β”œβ”€β”€ index.ts         # Main entry (middleware + routes + server)
β”‚   β”œβ”€β”€ websocket.ts     # WebSocket ↔ PTY relay (binary + JSON)
β”‚   β”œβ”€β”€ tmux.ts          # tmux session management
β”‚   β”œβ”€β”€ files.ts         # File operations + path validation
β”‚   β”œβ”€β”€ pty.ts           # node-pty wrapper
β”‚   β”œβ”€β”€ db.ts            # SQLite database
β”‚   β”œβ”€β”€ auth.ts          # Auth utilities
β”‚   β”œβ”€β”€ middleware/       # Auth middleware
β”‚   └── routes/          # REST API routes (sessions, files, editor, settings)
β”œβ”€β”€ web/src/
β”‚   β”œβ”€β”€ App.tsx           # Main app (Login / TabBar / Terminal / Theme)
β”‚   β”œβ”€β”€ store/            # Zustand store (modular slices)
β”‚   β”œβ”€β”€ components/
β”‚   β”‚   β”œβ”€β”€ TerminalPane.tsx              # 2D grid layout (Plan + Terminal + Chat)
β”‚   β”‚   β”œβ”€β”€ TerminalView.tsx              # xterm.js terminal
β”‚   β”‚   β”œβ”€β”€ PlanPanel.tsx                 # Plan annotation panel
β”‚   β”‚   β”œβ”€β”€ PlanAnnotationRenderer.tsx    # Markdown + inline annotations
β”‚   β”‚   β”œβ”€β”€ PlanFileBrowser.tsx           # AiTasks/ file browser
β”‚   β”‚   β”œβ”€β”€ MarkdownEditor.tsx            # Chat editor
β”‚   β”‚   └── ...
β”‚   β”œβ”€β”€ hooks/            # React hooks (WebSocket, file stream, resize, etc.)
β”‚   └── api/              # Typed API client modules
β”œβ”€β”€ bin/                  # npx entry point
β”œβ”€β”€ start.sh              # Production start script
└── install-service.sh    # systemd + nginx installer

Development

# Dev mode (frontend + backend separately)
npm run dev

# Build
npm run build

# Production (build + start)
bash start.sh

systemd Service + nginx Reverse Proxy

sudo bash install-service.sh          # Interactive install (systemd + optional nginx)
sudo systemctl start ai-cli-online    # Start service
sudo journalctl -u ai-cli-online -f   # View logs

The install script will:

  • Create a systemd service for auto-start and process management
  • Detect nginx and optionally configure reverse proxy (WebSocket support, SSL, client_max_body_size)
  • Auto-set HTTPS_ENABLED=false and TRUST_PROXY=1 in server/.env when nginx is enabled

Security

  • Token authentication with timing-safe comparison
  • Symlink traversal protection on all file operations
  • Unauthenticated WebSocket connection limits
  • TOCTOU download guard (streaming size check)
  • CSP headers (frame-ancestors, base-uri, form-action)
  • Rate limiting (configurable read/write thresholds)

License

MIT

Keywords

terminal

FAQs

Package last updated on 18 Feb 2026

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts