/** * digestCron.ts * * Weekly brain activity digest — cron orchestrator. * * Schedule: Sunday 08:00 UTC (aligned with brainspace week-end review). * Reads opted-in users from `digest_preferences`, generates a digest for * each user's wiki, emails them via Resend, and saves the digest page to * `history/digest-YYYY-WW.md` in their scoped storage. * * Phase 1 acceptance: * - CRON fires Sunday 08:00 UTC * - Digest covers prior 7 days * - Email sent to opted-in users * - Digest saved to history/ namespace * - Manual trigger via runDigestForUser() */ import { type StorageClient } from "../storage/client.js"; export declare function msUntilNextSundayAt8UTC(now?: Date): number; interface DigestConfig { supabaseUrl: string; serviceRoleKey: string; resendApiKey: string; fromEmail: string; fromName: string; } export interface DigestResult { userId: string; email: string; skipped: boolean; skipReason?: string; pageSaved?: string; emailSent: boolean; error?: string; } export declare function runDigestForUser(userId: string, userEmail: string, userDrive: StorageClient, config: DigestConfig, now?: Date): Promise; export declare function runWeeklyDigest(baseDrive: StorageClient, config: DigestConfig, now?: Date): Promise; export declare function startDigestCron(baseDrive: StorageClient, config: DigestConfig): () => void; export {}; //# sourceMappingURL=digestCron.d.ts.map