Skip to content

feat(site): Public agent page via dashboard.yaml renderer (SITE-002) #866

Open

Description

@vybe

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}-public volume, file_sharing_enabled flag, 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's dashboard.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_enabled added to admin settings (default off)
  • Per-agent gate: file_sharing_enabled must 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_access logged 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_links table with type='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.yaml schema — no changes needed

New work:

  • routers/site.py rewritten: 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_enabled platform flag in settings
  • Standalone public page template (no Trinity nav/auth)
  • Gate check: file_sharing_enabled in 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_enabled per-agent opt-in required
  • site_links_enabled platform-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/*.json on 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

Activity

  1. added
    priority-p2
    type-feature
    on May 17, 2026
  2. added
    complexity-high
    status-incubating
    on Jun 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    complexity-highpriority-p2status-incubatingtheme-ui-uxtype-feature

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions