Repository navigation
Description
Summary
Agents can own and serve a public-facing website by running a standardized web server (e.g. Next.js) inside their container. Trinity's backend exposes a `/site/{token}/{path*}` endpoint that HTTP-proxies requests to the agent's web server via the internal Docker network. The agent has full ownership of its site directory, manages content autonomously, and is aware of the site's structure — no CMS or external deploy pipeline needed.
Context
Every agent should be able to have a public "face" — a real website it maintains itself (dashboards, landing pages, status pages, portfolios). The agent runs a web server on a known internal port; Trinity proxies it through the public links mechanism. A standardized stack (same framework across all webmaster-type agents) means agents have consistent knowledge of their own site structure and can edit, rebuild, and redeploy it via scheduled skills.
Architecture
Browser → Trinity /site/{token}/path
→ validate token (public_links, type=site)
→ HTTP proxy to http://trinity-agent-{name}:{SITE_PORT}/path
(agent Docker network 172.28.0.0/16)
→ agent web server (Next.js on port 3000, standardized)
→ agent manages ~/site/ directory directly
Key points:
- Agent runs its own web server (standardized stack) as a background process in the container
- Proxy is live HTTP — supports routing, dynamic content, assets, SSR
- Agent owns `~/site/` and has full structural awareness; it edits files and triggers rebuilds itself
- No `docker get_archive` / static file extraction (that's FILES-001's domain)
Acceptance Criteria
- New public link type `site` in `public_links` table (add `type TEXT DEFAULT 'chat'` + migration)
- `GET /site/{token}/{path:path}` endpoint: validates token (type=site, enabled, not expired), reverse-proxies to `http://trinity-agent-{name}:{SITE_PORT}/{path}\` via httpx
- `SITE_PORT` is a fixed convention (e.g. 3000) known to both the template and the proxy
- 502 if agent web server is not running; 410 if link revoked/expired; 401 if token invalid
- Existing `/chat/{token}` behavior unchanged
- Agent owner can create/revoke site links via UI (Sharing panel, new "Website" tab or toggle)
- External URL: `{public_chat_url}/site/{token}/`
- Rate-limited per token; audit event `site_link_visit` logged
- Webmaster agent template ships with: Next.js scaffold in `~/site/`, startup script that runs `npm start` on port 3000, `CLAUDE.md` with site structure documentation so the agent knows how to maintain it
Technical Notes
Backend changes:
- `db/schema.py`: `type` column on `public_links` + versioned migration
- `routers/public_links.py`: create/revoke for type=site
- New `routers/site.py`: `GET /site/{token}/{path:path}` — token lookup, then `httpx.AsyncClient` reverse proxy to agent container (no timeout for streaming; forward `Content-Type`, `Cache-Control`)
- Agent container hostname convention: `trinity-agent-{name}` (already on `172.28.0.0/16`)
Agent template (follow-on issue):
- Standardized stack (Next.js or equivalent)
- `~/site/` directory the agent owns
- Startup integration (run web server alongside agent-server)
- Scheduled skill scaffold for content refresh
Out of scope here (follow-on):
- The webmaster agent template itself
- SPA fallback (serve `index.html` for unknown paths)
- Custom domain mapping
- Build step orchestration (agent handles this itself)
Related: `routers/public_links.py`, `routers/public.py`, Docker network `172.28.0.0/16`, FILES-001
Activity
[-]Agent websites: serve static sites from agent public/ via /site/{token} endpoint (SITE-001)[/-][+]Agent websites: proxy live web server in agent container via /site/{token} endpoint (SITE-001)[/+]vybe commentedon May 3, 2026
/claim
github-actions commentedon May 3, 2026
Claimed by @vybe. Label
status-in-progressadded.Next steps:
feature/633-<short-slug>Fixes #633feat(site): agent website proxy via /site/{token} endpoint (SITE-001) (…
docs(releases): v0.6.0 release notes archive (#1016)