feat: add static previews to the room pane

The preview tool could only name a port, so a static build needed a
server the terminal had to keep alive. `preview` now accepts a path:
the app reads the file or folder over the room's ssh sandbox and serves
it from a signed host, with `..` and dotfiles refused and a 16 MiB cap.

The target is stored with the room and replayed as a durable event. The
pane shows a static path with a reload control and keeps the port field
as a local fallback.
This commit is contained in:
vhaudiquet committed 2026-11-28 11:24:57 +01:00
1 parent 5be17cf4ef
commit 36de0aace7
20 files changed
+1046 -145

No files matched your search

+11 -8
View File
@@ -50,9 +50,10 @@ src/state.rs AppState: db, hub, secrets, runner, tunnels
src/api/ routes: auth, settings, rooms, messages, files
src/room/agent.rs per-turn config, ssh sandbox, HostAgent assembly
src/room/runner.rs one task per room; mention -> turn; steering
src/room/message_tool.rs the agent's only voice
src/room/message_tool.rs the agent's voice in the room
src/room/preview_tool.rs the agent's preview target
src/ssh.rs russh client, PTY terminal, direct-tcpip
src/preview.rs signed preview hosts and the ssh HTTP proxy
src/preview.rs signed preview hosts, ssh proxy, static reads
web/app/ Nuxt 4 SPA (no SSR)
```
@@ -66,17 +67,19 @@ web/app/ Nuxt 4 SPA (no SSR)
- Guests may join and chat. Only `kind = "user"` accounts create rooms
or add providers and sandbox targets.
- Room log events are append-only. `seq` is the ordering. Durable
events (`message`, `notice`, `turn_start`, `turn_end`, `tool_result`)
are stored and replay from `?since=`; deltas are broadcast only and
may leave gaps.
events (`message`, `notice`, `turn_start`, `turn_end`, `tool_result`,
`preview`) are stored and replay from `?since=`; deltas are broadcast
only and may leave gaps.
- The agent speaks through `message` only. It must always send one
before the turn ends. `message` is `ReplaySafety::Unsafe`.
- Turns are serialized per room. A new mention while a turn runs drops
the turn future (turn-level steering) and starts a new turn over the
committed session. Do not drop the room task.
- The preview host label is `r<room>-p<port>-<hmac>.<preview host>`.
The HMAC covers `room:port` with a key derived from the master key.
The preview origin must be a wildcard DNS zone for subdomains to
- The preview host label is `r<room>-p<port>-<expiry>-<hmac>.<preview
host>` for a port, or `r<room>-s<hash>-<expiry>-<hmac>.<preview host>`
for a static target. The HMAC covers the target and expiry with a key
derived from the master key. The static hash covers the root and entry
file. The preview origin must be a wildcard DNS zone for subdomains to
resolve.
## Testing