2025-12-09 17:51:05 +00:00
---
2025-12-09 23:16:57 +01:00
summary: "Loopback WebChat static host and Gateway WS usage for chat UI"
2025-12-09 17:51:05 +00:00
read_when:
- Debugging or configuring WebChat access
2026-01-31 16:04:03 -05:00
title: "WebChat"
2025-12-09 17:51:05 +00:00
---
2025-12-08 12:50:37 +01:00
2026-01-31 21:13:13 +09:00
# WebChat (Gateway WebSocket UI)
2026-01-07 00:25:16 +01:00
Status: the macOS/iOS SwiftUI chat UI talks directly to the Gateway WebSocket.
2025-12-08 12:50:37 +01:00
2025-12-09 14:41:55 +01:00
## What it is
2026-01-31 21:13:13 +09:00
2026-01-07 00:25:16 +01:00
- A native chat UI for the gateway (no embedded browser and no local static server).
2026-01-13 07:15:57 +00:00
- Uses the same sessions and routing rules as other channels.
2026-01-07 00:25:16 +01:00
- Deterministic routing: replies always go back to WebChat.
2025-12-09 14:41:55 +01:00
2026-01-11 02:40:28 +01:00
## Quick start
2026-01-31 21:13:13 +09:00
1. Start the gateway.
2. Open the WebChat UI (macOS/iOS app) or the Control UI chat tab.
2026-04-04 14:14:54 +01:00
3. Ensure a valid gateway auth path is configured (shared-secret by default,
even on loopback).
2026-01-11 02:40:28 +01:00
2026-01-07 00:25:16 +01:00
## How it works (behavior)
2026-01-31 21:13:13 +09:00
2026-01-16 00:28:43 +00:00
- The UI connects to the Gateway WebSocket and uses `chat.history` , `chat.send` , and `chat.inject` .
2026-02-16 21:50:01 -05:00
- `chat.history` is bounded for stability: Gateway may truncate long text fields, omit heavy metadata, and replace oversized entries with `[chat.history omitted: message too large]` .
2026-04-04 21:53:25 +01:00
- `chat.history` is also display-normalized: inline delivery directive tags
such as `[[reply_to_*]]` and `[[audio_as_voice]]` , plain-text tool-call XML
2026-04-04 22:21:26 +01:00
payloads (including `<tool_call>...</tool_call>` ,
`<function_call>...</function_call>` , `<tool_calls>...</tool_calls>` ,
`<function_calls>...</function_calls>` , and truncated tool-call blocks), and
2026-04-04 21:53:25 +01:00
leaked ASCII/full-width model control tokens are stripped from visible text,
2026-04-04 21:55:11 +01:00
and assistant entries whose whole visible text is only the exact silent
token `NO_REPLY` / `no_reply` are omitted.
2026-01-16 00:28:43 +00:00
- `chat.inject` appends an assistant note directly to the transcript and broadcasts it to the UI (no agent run).
2026-02-15 16:55:28 -08:00
- Aborted runs can keep partial assistant output visible in the UI.
- Gateway persists aborted partial assistant text into transcript history when buffered output exists, and marks those entries with abort metadata.
2026-01-07 00:25:16 +01:00
- History is always fetched from the gateway (no local file watching).
- If the gateway is unreachable, WebChat is read-only.
2025-12-09 14:41:55 +01:00
2026-02-22 23:55:59 -06:00
## Control UI agents tools panel
2026-03-24 21:09:51 -05:00
- The Control UI `/agents` Tools panel has two separate views:
- **Available Right Now** uses `tools.effective(sessionKey=...)` and shows what the current
session can actually use at runtime, including core, plugin, and channel-owned tools.
- **Tool Configuration** uses `tools.catalog` and stays focused on profiles, overrides, and
catalog semantics.
- Runtime availability is session-scoped. Switching sessions on the same agent can change the
**Available Right Now ** list.
- The config editor does not imply runtime availability; effective access still follows policy
2026-02-22 23:55:59 -06:00
precedence (`allow` /`deny` , per-agent and provider/channel overrides).
2025-12-09 14:41:55 +01:00
## Remote use
2026-01-31 21:13:13 +09:00
2026-01-07 00:25:16 +01:00
- Remote mode tunnels the gateway WebSocket over SSH/Tailscale.
- You do not need to run a separate WebChat server.
2025-12-09 14:41:55 +01:00
2026-01-07 00:25:16 +01:00
## Configuration reference (WebChat)
2026-01-31 21:13:13 +09:00
2026-01-07 02:04:02 +01:00
Full configuration: [Configuration ](/gateway/configuration )
2025-12-08 12:50:37 +01:00
2026-04-01 19:25:17 +09:00
WebChat options:
2026-01-31 21:13:13 +09:00
2026-04-01 19:25:17 +09:00
- `gateway.webchat.chatHistoryMaxChars` : maximum character count for text fields in `chat.history` responses. When a transcript entry exceeds this limit, Gateway truncates long text fields and may replace oversized messages with a placeholder. Per-request `maxChars` can also be sent by the client to override this default for a single `chat.history` call.
2025-12-08 12:50:37 +01:00
2026-01-07 00:25:16 +01:00
Related global options:
2026-01-31 21:13:13 +09:00
2026-01-07 00:25:16 +01:00
- `gateway.port` , `gateway.bind` : WebSocket host/port.
2026-04-04 14:14:54 +01:00
- `gateway.auth.mode` , `gateway.auth.token` , `gateway.auth.password` :
shared-secret WebSocket auth.
- `gateway.auth.allowTailscale` : browser Control UI chat tab can use Tailscale
Serve identity headers when enabled.
2026-04-04 13:50:38 +01:00
- `gateway.auth.mode: "trusted-proxy"` : reverse-proxy auth for browser clients behind an identity-aware **non-loopback ** proxy source (see [Trusted Proxy Auth ](/gateway/trusted-proxy-auth )).
2026-01-07 00:25:16 +01:00
- `gateway.remote.url` , `gateway.remote.token` , `gateway.remote.password` : remote gateway target.
- `session.*` : session storage and main key defaults.