import { existsSync } from "node:fs"; export type SamStatus = { checkpointConfigured: boolean; checkpointExists: boolean; modelType: string; python: string; }; export function getSamStatus(): SamStatus { const checkpoint = process.env.SAM_CHECKPOINT; const localPython = `${process.cwd()}/.venv/bin/python`; return { checkpointConfigured: Boolean(checkpoint), checkpointExists: checkpoint ? existsSync(checkpoint) : false, modelType: process.env.SAM_MODEL_TYPE ?? "vit_h", python: process.env.SAM_PYTHON ?? (existsSync(localPython) ? localPython : "python3") }; }