import { apiJSON, apiMutate } from '$lib/api/client.js'; export type RuntimeLogAutoEstimateItem = { filename: string; size_bytes: number; would_cleanup: boolean; skip_reason?: string; }; export type RuntimeLogAutoEstimate = { policy?: { enabled?: boolean; max_file_bytes?: number; schedule?: string; mode?: 'truncate' | 'delete'; }; items?: RuntimeLogAutoEstimateItem[]; would_count?: number; }; export type RuntimeLogAutoRunResult = { dry_run?: boolean; trigger?: string; cleaned_count?: number; skipped_count?: number; cleaned?: unknown[]; skipped?: unknown[]; }; export async function fetchRuntimeLogAutoEstimate(): Promise { return apiJSON('/v1/runtime-logs/auto-estimate'); } export async function runRuntimeLogAutoCleanup(dryRun = false): Promise { const q = dryRun ? '?dry_run=true' : ''; return apiMutate(`/v1/runtime-logs/auto-run${q}`, 'POST'); }