# WebChat

## Overview

The macOS menu bar application integrates WebChat as a native SwiftUI component, connecting to the Gateway with support for both local and remote operation modes.

## Key Features

### Connection Modes

- **Local mode**: Links directly to the local Gateway WebSocket
- **Remote mode**: Tunnels the Gateway control port through SSH

### Session Management

The app defaults to the main session for the selected agent (with a session switcher for other sessions). Onboarding operates through a separate dedicated session.

## Technical Details

### Data Plane

The system uses Gateway WebSocket methods:

- `chat.history`
- `chat.send`
- `chat.abort`
- `chat.inject`

Corresponding events for:

- Chat
- Agent
- Presence
- Tick
- Health monitoring

### Launch Options

Access through multiple methods:

- Lobster menu -> "Open Chat"
- Testing launch: `dist/OpenClaw.app/Contents/MacOS/OpenClaw --webchat`
- Logging via `./scripts/clawlog.sh` (subsystem `bot.molt`, WebChatSwiftUI category)

## Security & Constraints

- Remote mode restricts forwarding to the Gateway WebSocket control port only
- The interface is optimized for chat sessions (not a full browser sandbox)
