Trovella Wiki

Admin Dashboard

Overview of all admin views for monitoring AI usage, research plans, skill executions, and hybrid search.

The admin dashboard is a set of internal views under /admin/* that provide visibility into the research engine's runtime behavior. Every admin page requires authentication (per-page getSession() check) and wraps its content in the standard DashboardPage shell with sidebar navigation.

Admin Views

The dashboard is organized around four views, each targeting a different operational concern:

ViewRoutePurpose
AI Logs/admin/ai-logsMonitor Claude API usage, costs, latency, and test prompts in the playground
Research Plans/admin/research-plansInspect plan execution, step progress, artifacts, extractions, and audit trails
Skill Executions/admin/skill-executionsTrack skill invocations, routing decisions, durations, and failure rates
Hybrid Search/admin/searchDebug search queries across keyword and semantic indexes, monitor chunk health

Architecture Pattern

All admin views follow the same structural pattern:

app/admin/<view>/page.tsx          Server component: auth check + DashboardPage wrapper
  |
  v
components/admin/<view>-content.tsx  Client component: orchestrates queries and child components
  |
  +-- KPI / summary cards             Aggregated metrics from summary tRPC procedures
  +-- Charts (recharts)                Time-series and distribution visualizations
  +-- Paginated data table             Filterable list with drill-down to detail views
  +-- Detail panel / page              Full record inspection with collapsible sections

Each view queries its own tRPC router. The routers live in packages/api/src/routers/ and enforce authorization via authorizedProcedure (auth + RLS + CASL). See Authorization -- Router Enforcement for how this works.

Data Flow

Admin components use tRPC via TanStack Query (trpc.*.useQuery()) for data fetching. There is no custom caching layer -- TanStack Query's built-in stale-while-revalidate handles cache invalidation.

Client component
  |-- trpc.<router>.<procedure>.useQuery(input)
  |
  v
tRPC client (HTTP batching via httpBatchStreamLink)
  |
  v
/api/trpc/* route handler
  |
  v
authorizedProcedure (session + RLS + CASL check)
  |
  v
Drizzle ORM query against PostgreSQL

Shared Components

All admin views share a small set of utility components:

  • QueryError -- inline destructive alert for failed tRPC queries, showing the error message in monospace
  • DashboardPage -- server component wrapper providing the sidebar shell and session context

tRPC Routers Backing Admin Views

RouterFileProcedures
aiLogspackages/api/src/routers/ai-logs.tssummary, usageOverTime, modelDistribution, list, detail, sendPrompt
researchPlanpackages/api/src/routers/research-plan.tslist, detail, healthSummary, stepResults, artifacts, extractionResults, branchingConditions, toolCallLog, outputs, feedback, skillExecution, auditLog
skillExecutionpackages/api/src/routers/skill-execution.tslist, detail, summary
hybridSearchpackages/api/src/routers/hybrid-search.tsdebugSearch, stats

All procedures require the read ability on either Organization or ResearchPlan CASL subjects. The sendPrompt mutation (playground) requires update on Organization.

On this page