import type { Capability } from '@feltdb/core'; import { auditEvents, type AuditEvent } from '../src/feltdb'; export interface ActivitySummary { summary: string; total: number; actions: string[] } export const activitySummary: Capability = { id: 'activity-summary', name: 'Activity summary', async execute(): Promise { const events = (await auditEvents.all() as AuditEvent[]).slice(-20); const actions = [...new Set(events.map(event => event.action))]; return { total: events.length, actions, summary: events.length ? `${events.length} recent events across ${actions.length} action types: ${actions.join(', ')}.` : 'No application activity has been recorded yet.' }; }, };