"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.resolvePythonPath = void 0; const path_1 = __importDefault(require("path")); const fs_1 = __importDefault(require("fs")); const paths_1 = require("./paths"); const isWindows = process.platform === 'win32'; // Shared resolver used by both the cron worker and Next.js API routes // so the Python interpreter is configured in exactly one place. const resolvePythonPath = () => { const candidates = []; if (isWindows) { candidates.push(path_1.default.join(paths_1.TOOLKIT_ROOT, '.venv', 'Scripts', 'python.exe')); candidates.push(path_1.default.join(paths_1.TOOLKIT_ROOT, 'venv', 'Scripts', 'python.exe')); } else { candidates.push(path_1.default.join(paths_1.TOOLKIT_ROOT, '.venv', 'bin', 'python')); candidates.push(path_1.default.join(paths_1.TOOLKIT_ROOT, 'venv', 'bin', 'python')); } for (const candidate of candidates) { if (fs_1.default.existsSync(candidate)) { return candidate; } } return isWindows ? 'python.exe' : 'python3'; }; exports.resolvePythonPath = resolvePythonPath;