Repository navigation
Description
Summary
Implement public agent website exposure using the existing dashboard.yaml schema. Trinity owns the rendering layer — agents push structured data, not arbitrary HTML. Replaces the SITE-001 reverse-proxy approach (see #865 for revert).
Context
SITE-001 (reverted in #865) attempted to expose agents' web servers by proxying port 3000. This introduced XSS risk (same-origin arbitrary HTML), process management fragility, and no permission model.
The correct approach: agents already author dashboard.yaml (DASH-001). Trinity already renders it as the Dashboard tab. The public site is the same data, rendered without Trinity chrome, gated behind a public link token.
Key insight from design discussion:
- Agents are good at writing files, not managing processes
- Trinity already owns a structured rendering layer (dashboard widgets)
- The
agent-{name}-publicvolume,file_sharing_enabledflag, and public link token system all exist - The
refresh:field in dashboard.yaml already provides real-time update cadence - Link widgets in the schema already thread into FILES-001 for file downloads
Architecture
Agent writes dashboard.yaml
→ Internal: Dashboard tab in AgentDetail (existing, DASH-001)
→ Public: /site/{token}/ → Trinity renders dashboard.yaml without nav chrome
Request flow:
Browser GET /site/{token}/
→ nginx /site/ block → backend routers/site.py
→ validate token (type=site, enabled, not expired)
→ check file_sharing_enabled on agent_ownership
→ fetch dashboard config via agent server GET /api/dashboard
→ return rendered page (SSR or thin JS shell that hydrates from public dashboard API)
Acceptance Criteria
-
GET /site/{token}/returns a rendered public page from the agent'sdashboard.yaml - All existing dashboard widget types render correctly (metric, status, progress, text, markdown, table, list, link, image, divider, spacer)
-
refresh:field in dashboard.yaml drives client-side auto-refresh of data (not full page reload) - Platform-level feature flag
site_links_enabledadded to admin settings (default off) - Per-agent gate:
file_sharing_enabledmust be true or site links return 403 - Public dashboard API endpoint
GET /api/agent-dashboard/{name}/public— unauthenticated, checks site link token, returns dashboard config JSON - Trinity chrome (nav, sidebar, auth) stripped — public page is standalone
- Rate limiting preserved from SITE-001 helpers (120 req/min/IP, 300/min/token)
- Audit event
site_accesslogged on each page load - If agent is stopped or has no
dashboard.yaml, show a graceful fallback page (not 502) - Feature flow doc created:
docs/memory/feature-flows/agent-public-site.md - Architecture doc updated
Technical Notes
Reuse from SITE-001 (kept during revert #865):
agent_public_linkstable withtype='site'column- Token validation logic
- Rate limiting helpers
AuditEventType.SITE_ACCESS
Reuse from DASH-001:
GET /api/agent-dashboard/{name}backend endpoint (add unauthenticated public variant)- All Vue widget components in
src/frontend/src/components/dashboard/ dashboard.yamlschema — no changes needed
New work:
routers/site.pyrewritten: instead of httpx proxy to port 3000, fetch dashboard config and serve render shell- Public dashboard API variant (token-gated, no JWT required)
site_links_enabledplatform flag in settings- Standalone public page template (no Trinity nav/auth)
- Gate check:
file_sharing_enabledin site router
Security:
- Trinity controls all HTML output — no agent-supplied HTML reaches browser
- Same-origin XSS risk eliminated (no arbitrary agent content)
file_sharing_enabledper-agent opt-in requiredsite_links_enabledplatform-level admin gate (default off)- Rate limiting on all requests
Dynamic data pattern for agents:
- Agent writes JSON data files to
/home/developer/public/data/*.jsonon a schedule - Dashboard
refresh:field drives client polling interval - For truly live data: agent can still optionally run a process on port 3000 as a data API (future: hybrid proxy for
/site/{token}/api/*paths only)
Dependencies
- revert: Remove SITE-001 agent website reverse proxy (port 3000) #865 must merge first (removes old site.py)
- DASH-001 must be complete (dashboard.yaml + widget components exist) ✅
Activity