Skip to content

Architecture

Tech Stack

CategoryTechnology
FrameworkNext.js 16 (App Router)
LanguageTypeScript 5
UIReact 19 + Tailwind CSS v4 + shadcn/ui
EditorMonaco Editor
Terminalxterm.js + node-pty
WebSocketws (server) + browser native (client)
Claude Integration@anthropic-ai/claude-agent-sdk
Server RuntimeNode.js 22 (tsx runs server.ts directly)
Package Managerpnpm

Server Structure (server.ts)

A custom HTTP server handles Next.js requests, REST API, and WebSocket on a single port (4000).

HTTP :4000
+-- /ws/terminal  -> terminalWss (WebSocket)
|     node-pty session management
|
+-- /ws/chat      -> chatWss (WebSocket)
|     Claude Agent SDK query() streaming
|
+-- /api/ws/*     -> handleCustomRoutes (REST)
|     GET  /api/ws/health, /api/ws/projects, /api/ws/session
|     POST /api/ws/file, /api/ws/git
|
+-- /api/harness/* -> handleHarnessRoutes
|     Harness Engineering workflow management
|
+-- /api/team/*   -> handleTeamRoutes (team.ts)
|     Multi-agent team orchestration API
|
+-- /*            -> Next.js handle()

JikiME-ADK Integration

The webchat server calls the jikime CLI binary via execFile() for team operations:

FileCLI Calls
team.tsjikime team create/stop/tasks/inbox
server.tsReads .claude/commands/jikime/*.md, manages jikime-todo/jikime-done labels
harness.tsNode.js port of jikime serve (WORKFLOW.md-based automation)

Requirement: The jikime binary must be installed and available in PATH for team features to work.

Claude Path Discovery (findClaudePath)

At startup, the server searches for the Claude CLI native binary:

  1. CLAUDE_PATH env var (highest priority)
  2. which -a claude — full PATH search
  3. Fixed path list

Validates each candidate by reading file magic bytes (ELF for Linux, Mach-O for macOS).


Client Structure (src/)

Context Layer

ServerContext       Server list, active server, URL generation
    +-- WebSocketContext   WebSocket connection, auto-reconnect
    +-- ProjectContext     Project list, active project/session, URL routing
    +-- TeamContext        Multi-agent team state, SSE event subscription

Key Components

src/components/
+-- sidebar/        Server selection, project/session list
+-- chat/           Chat UI, streaming messages, tool approval
+-- shell/          xterm.js terminal panel
+-- file-tree/      File tree + Monaco editor
+-- git-panel/      Git changes, log, branches, Issues
+-- team/           Team tab (kanban board, create/serve modals)
+-- layout/         Tab header, panel layout (AppLayout)

WebSocket Protocol

Chat (/ws/chat)

DirectionTypeContent
Client->Serverchat{ sessionId, projectPath, prompt, model, permissionMode }
Client->ServerabortAbort response
Client->Serverpermission_response{ requestId, allow }
Server->ClienttextStreaming text chunk
Server->Clienttool_call / tool_resultTool execution info
Server->ClientdoneResponse complete
Server->Clientpermission_request{ requestId, toolName, input }

Terminal (/ws/terminal)

DirectionTypeContent
Client->Serverinit{ sessionId, cwd, cols, rows }
Client->Serverinput{ data } keystroke
Server->Clientoutput{ data } PTY output

Docker Structure

Dockerfile (multi-stage)
+-- Stage 1: builder (python3, gcc, pnpm install, next build)
+-- Stage 2: runner (build artifacts + Claude CLI)

docker-compose.yml
+-- ports: 4000:4000
+-- volumes: claude_data -> /root/.claude
+-- healthcheck: GET /api/ws/health

File Structure

webchat/
+-- server.ts                    Custom HTTP + WebSocket server
+-- harness.ts                   Harness Engineering route handler
+-- team.ts                      Multi-agent team API + SSE
+-- src/
|   +-- app/                     Next.js App Router pages + API routes
|   +-- components/              UI components (chat, shell, git, team, etc.)
|   +-- contexts/                React contexts (Server, WebSocket, Project, Team)
|   +-- i18n/                    Localization (ko, en, ja, zh)
|   +-- lib/                     Utilities (team-store, etc.)
+-- scripts/                     Build helpers (postinstall, fix-pty)
+-- Dockerfile / docker-compose.yml
+-- package.json

Released under the MIT License.