Docs: webchat now served in-process, no CLI spawn
This commit is contained in:
@@ -24,7 +24,7 @@ This flow lets the macOS app act as a full remote control for a Clawdis relay ru
|
|||||||
|
|
||||||
## Web Chat over SSH
|
## Web Chat over SSH
|
||||||
- The relay hosts a loopback-only HTTP server (default 18788, see `webchat.port`).
|
- The relay hosts a loopback-only HTTP server (default 18788, see `webchat.port`).
|
||||||
- The mac app forwards `127.0.0.1:<port>` over SSH (`ssh -L <ephemeral>:127.0.0.1:<port>`), then loads `/webchat/?session=<key>` in-app.
|
- The mac app forwards `127.0.0.1:<port>` over SSH (`ssh -L <ephemeral>:127.0.0.1:<port>`), then loads `/webchat/?session=<key>` in-app. Sends go in-process on the relay (no CLI spawn/PATH issues).
|
||||||
- Keep the feature enabled in *Settings → Config → Web chat*. Disable it to hide the menu entry entirely.
|
- Keep the feature enabled in *Settings → Config → Web chat*. Disable it to hide the menu entry entirely.
|
||||||
|
|
||||||
## Permissions
|
## Permissions
|
||||||
@@ -38,7 +38,7 @@ This flow lets the macOS app act as a full remote control for a Clawdis relay ru
|
|||||||
## Troubleshooting
|
## Troubleshooting
|
||||||
- **exit 127 / not found**: `clawdis` isn’t on PATH for non-login shells. Add it to `/etc/paths`, your shell rc, or symlink into `/usr/local/bin`/`/opt/homebrew/bin`.
|
- **exit 127 / not found**: `clawdis` isn’t on PATH for non-login shells. Add it to `/etc/paths`, your shell rc, or symlink into `/usr/local/bin`/`/opt/homebrew/bin`.
|
||||||
- **Health probe failed**: check SSH reachability, PATH, and that Baileys is logged in (`clawdis status --json`).
|
- **Health probe failed**: check SSH reachability, PATH, and that Baileys is logged in (`clawdis status --json`).
|
||||||
- **Web Chat stuck**: confirm the relay is running on the remote host and `webchat.enabled` is true; ensure the forwarded port matches *Settings → Config*.
|
- **Web Chat stuck**: confirm the relay is running on the remote host and `webchat.enabled` is true; ensure the forwarded port matches *Settings → Config*. Since RPC is in-process, PATH is no longer a factor.
|
||||||
- **Voice Wake**: trigger phrases are forwarded automatically in remote mode; no separate forwarder is needed.
|
- **Voice Wake**: trigger phrases are forwarded automatically in remote mode; no separate forwarder is needed.
|
||||||
|
|
||||||
## Notification sounds
|
## Notification sounds
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ The macOS menu bar app opens the relay’s loopback web chat server in a WKWebVi
|
|||||||
|
|
||||||
## How it’s wired
|
## How it’s wired
|
||||||
- Assets: `apps/macos/Sources/Clawdis/Resources/WebChat/` contains the `pi-web-ui` dist plus a local import map pointing at bundled vendor modules and a tiny `pi-ai` stub. Everything is served from the relay at `/webchat/*`.
|
- Assets: `apps/macos/Sources/Clawdis/Resources/WebChat/` contains the `pi-web-ui` dist plus a local import map pointing at bundled vendor modules and a tiny `pi-ai` stub. Everything is served from the relay at `/webchat/*`.
|
||||||
- Bridge: none. The web UI calls `/webchat/rpc` directly; Swift no longer proxies messages.
|
- Bridge: none. The web UI calls `/webchat/rpc` directly; Swift no longer proxies messages. RPC is handled in-process inside the relay (no CLI spawn/PATH dependency).
|
||||||
- Session: always primary; multiple transports (WhatsApp/Telegram/Desktop) share the same session key so context is unified.
|
- Session: always primary; multiple transports (WhatsApp/Telegram/Desktop) share the same session key so context is unified.
|
||||||
|
|
||||||
## Security / surface area
|
## Security / surface area
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ Updated: 2025-12-08
|
|||||||
- Endpoints:
|
- Endpoints:
|
||||||
- `GET /webchat/info?session=<key>` → `{port, sessionId, initialMessages, basePath}` plus history from the relay’s session store.
|
- `GET /webchat/info?session=<key>` → `{port, sessionId, initialMessages, basePath}` plus history from the relay’s session store.
|
||||||
- `GET /webchat/*` → static Web Chat assets.
|
- `GET /webchat/*` → static Web Chat assets.
|
||||||
- `POST /webchat/rpc` → runs `clawdis agent --json` and returns `{ ok, payloads?, error? }`.
|
- `POST /webchat/rpc` → runs the agent in-process and returns `{ ok, payloads?, error? }` (no CLI spawn, no PATH dependency).
|
||||||
- The macOS app simply loads `http://127.0.0.1:<port>/webchat/?session=<key>` (or the SSH-forwarded port in remote mode). No Swift bridge is used for sends; all chat traffic stays inside the Node relay.
|
- The macOS app simply loads `http://127.0.0.1:<port>/webchat/?session=<key>` (or the SSH-forwarded port in remote mode). No Swift bridge is used for sends; all chat traffic stays inside the Node relay.
|
||||||
- Initial messages are fetched from `/webchat/info`, so history appears immediately.
|
- Initial messages are fetched from `/webchat/info`, so history appears immediately.
|
||||||
- Enable/disable via `webchat.enabled` (default **true**); set the port with `webchat.port`.
|
- Enable/disable via `webchat.enabled` (default **true**); set the port with `webchat.port`.
|
||||||
@@ -24,6 +24,7 @@ Updated: 2025-12-08
|
|||||||
- Static assets stay in `apps/macos/Sources/Clawdis/Resources/WebChat`; the server reads them directly.
|
- Static assets stay in `apps/macos/Sources/Clawdis/Resources/WebChat`; the server reads them directly.
|
||||||
- Server code: `src/webchat/server.ts`.
|
- Server code: `src/webchat/server.ts`.
|
||||||
- CLI entrypoint (optional): `clawdis webchat --json [--port N]` to query/start manually.
|
- CLI entrypoint (optional): `clawdis webchat --json [--port N]` to query/start manually.
|
||||||
|
- RPC send path is in-process; the relay does not spawn `clawdis` or rely on PATH.
|
||||||
- Mac glue: `WebChatWindow.swift` (bootstrap + tunnel) and `WebChatTunnel` (SSH -L).
|
- Mac glue: `WebChatWindow.swift` (bootstrap + tunnel) and `WebChatTunnel` (SSH -L).
|
||||||
|
|
||||||
## TODO / nice-to-haves
|
## TODO / nice-to-haves
|
||||||
|
|||||||
Reference in New Issue
Block a user