/** * v0.6 — JSONL → SQLite (FTS5) rotation cron. * * Per docs/plan/v0.6-default-workflow-tuning.md §4.3 + §4.6 + §4.7. * Runs nightly (00:00) via `archive-rotate` cron. The hot tier * (`/memory/*.jsonl`) keeps the last 7 days; everything older is * moved into `archive.sqlite` and *deleted from the JSONL* to keep grep * cheap. * * Inputs scanned: * - `/memory/*.jsonl` (signals.jsonl, decisions.jsonl, …) * - `/memory/route-events.jsonl` (v0.5/v0.6 route + author + spawn) * - `/memory/cron-logs/*.jsonl` (any future jsonl logs there) * * Each archived row gets a normalized `event_type`. Lines that already carry * a recognized `event_type` field keep it; otherwise default to * `routine_log` (backward-compatible with v0.5 jsonl files). */ export interface RotateOpts { /** Workspace root (parent of /). */ workspace: string; /** Org slug. */ orgSlug: string; /** Default 365. Rows older than this in SQLite are deleted by retention pass. */ retentionDays?: number; /** Default 8. JSONL rows older than this are migrated into SQLite. */ hotWindowDays?: number; /** When true, retention pass dumps a `archive-.zst` before DELETE. */ compressBeforeDelete?: boolean; /** Override "now" for deterministic tests (ISO string). */ now?: string; } export interface RotateStats { scanned_files: number; archived_rows: number; deleted_from_jsonl: number; deleted_by_retention: number; compressed_archives: string[]; per_event_type: Record; } export declare function rotateArchive(opts: RotateOpts): RotateStats;