* feat: Add Claude Code Agent Teams support - Add TeamState schemas and types for team collaboration - Extract team state from TeamCreate, SendMessage, Task tools - Add database migration V3→V4 for team_state storage - Add TeamPanel component to display team members, tasks, messages - Add team tool icons and presentation rules - Support vite proxy configuration via VITE_HUB_PROXY env var via [HAPI](https://hapi.run) Co-Authored-By: HAPI <noreply@hapi.run> * fix: Add timestamp protection for team_state updates Prevent old messages from overwriting newer team state by checking team_state_updated_at before updating. via [HAPI](https://hapi.run) Co-Authored-By: HAPI <noreply@hapi.run> * fix: Extract team tasks from Task/TaskCreate/TaskUpdate tools - Enhance processTaskToolWithTeam to also generate task entries from the Task tool's description field when spawning teammates - Add processTaskCreate handler for TaskCreate tool calls - Add processTaskUpdate handler for TaskUpdate tool calls - Register both new tools in the extraction switch statement This fixes the gap where the Tasks section in TeamPanel could never populate because team task data was not being extracted from the message stream. via [HAPI](https://hapi.run) Co-Authored-By: HAPI <noreply@hapi.run> * fix: Skip orphan TaskUpdate without title to prevent schema validation failure When TaskUpdate arrives before TaskCreate (message ordering), skip inserting incomplete tasks that lack required title field, preventing entire teamState from being dropped by schema validation. via [HAPI](https://hapi.run) Co-Authored-By: HAPI <noreply@hapi.run> * test: Add unit tests for orphan TaskUpdate handling Verify that applyTeamStateDelta correctly skips inserting tasks without title field (orphan TaskUpdate) while still allowing normal task creation and updates to existing tasks. via [HAPI](https://hapi.run) Co-Authored-By: HAPI <noreply@hapi.run> --------- Co-authored-by: tfq <tfq@gmail.com> Co-authored-by: HAPI <noreply@hapi.run>
hapi-web
React Mini App / PWA for monitoring and controlling hapi sessions.
What it does
- Session list with status, pending approvals, todos, and summaries.
- Chat view with streaming updates and message sending.
- Permission approval and denial workflows.
- Permission mode and model selection.
- Machine list and remote session spawn.
- File browser and git status/diff views.
- PWA install prompt and offline banner.
Runtime behavior
- When opened inside Telegram, auth uses Telegram WebApp init data.
- When opened in a normal browser, you can log in with
CLI_API_TOKEN:<namespace>(orCLI_API_TOKENfor the default namespace). - The login screen includes a top-right hub picker; if unset, the app uses the same origin it was loaded from.
- Live updates come from the hub via SSE.
Routes
See src/router.tsx for route definitions.
/- Redirect to /sessions./sessions- Session list./sessions/$sessionId- Chat interface./sessions/new- Create new session./sessions/$sessionId/files- File browser with git status./sessions/$sessionId/file- File viewer with diff support./sessions/$sessionId/terminal- Terminal interface./settings- Application settings.
Features
Session list (src/components/SessionList.tsx)
- Active/inactive status indicator.
- Session title from name, summary, or path.
- Todo progress display.
- Pending permission request count.
- Agent flavor label (claude/codex/gemini).
- Model mode display.
Chat interface (src/components/SessionChat.tsx)
- Message thread with infinite scroll.
- Composer for sending messages.
- Permission mode toggle (default/acceptEdits/bypassPermissions/plan).
- Model selection (default/sonnet/opus).
- Session abort and mode switch controls.
- Context size display.
File browser (src/routes/sessions/files.tsx)
- Git status view (staged/unstaged files).
- File search with ripgrep.
- Navigate to file viewer.
File viewer (src/routes/sessions/file.tsx)
- File content display with syntax highlighting.
- Staged/unstaged diff view.
Terminal (src/routes/sessions/terminal.tsx)
- Remote terminal via xterm.js
- Real-time via Socket.IO
- Resize handling
Voice assistant
- ElevenLabs integration (@elevenlabs/react)
- Real-time voice control
New session (src/components/NewSession/)
Modular session creation:
- Machine selector
- Directory input with recent paths
- Agent type selector
- Model selector
- Permission mode toggle (YOLO mode)
Authentication
See src/hooks/useAuth.ts and src/hooks/useAuthSource.ts.
- Telegram Mini App: Uses initData from WebApp SDK.
- Browser: Uses CLI_API_TOKEN from login prompt.
- JWT tokens with auto-refresh.
Data fetching
See src/hooks/queries/ for query hooks and src/hooks/mutations/ for mutations.
- Sessions, messages, machines via TanStack Query.
- Git status and file operations.
- Optimistic updates for message sending.
Real-time updates
See src/hooks/useSSE.ts.
- SSE connection to
/api/events. - Session/message/machine update events.
- Automatic cache invalidation on events.
Stack
React 19 + Vite + TanStack Router/Query + Tailwind + @assistant-ui/react + xterm.js + @elevenlabs/react + socket.io-client + workbox + shiki.
Source structure
src/router.tsx- Route definitions.src/components/- UI components.src/hooks/- Data fetching and state hooks.src/api/client.ts- API client.src/types/api.ts- Type definitions.
Development
From the repo root:
bun install
bun run dev:web
If testing in Telegram, set:
HAPI_PUBLIC_URLto the public HTTPS URL of the dev server.CORS_ORIGINSto include the dev server origin.
Build
bun run build:web
The built assets land in web/dist and are served by hapi-hub. The single executable can embed these assets.
Standalone hosting
You can host web/dist on a static host (GitHub Pages, Cloudflare Pages) and point it at any hapi hub:
- Build the web app. If your static host uses a subpath, set the Vite base:
bun run build:web -- --base /<repo>/
- Deploy
web/distto your static host. - Set hub CORS to allow the static origin (
HAPI_PUBLIC_URLorCORS_ORIGINS). - Open the static site, click the top-right Hub button on the login screen, and enter the hapi hub origin.
Clear the hub override in the same dialog to return to same-origin behavior.