import {execFileSync} from 'node:child_process'; import {readFileSync} from 'node:fs'; import path from 'node:path'; import {projectRoot} from './config.mjs'; export {selectPython as geometryPython} from './python-runtime.mjs'; export function prepareReference(python, input, output) { return JSON.parse(execFileSync(python, [path.join(projectRoot, 'geometry_grounding.py'), '--prepare', '--input', input, '--output', output], {encoding: 'utf8', windowsHide: true})); } export function groundParts(python, out) { const diagnostics = path.join(out, 'geometry-validation.json'); execFileSync(python, [path.join(projectRoot, 'geometry_grounding.py'), '--input', path.join(out, 'source.png'), '--parts', path.join(out, 'semantic-parts.json'), '--output', diagnostics, '--prompts', path.join(out, 'segmentation-prompts.json')], {encoding: 'utf8', windowsHide: true}); return JSON.parse(readFileSync(diagnostics, 'utf8')); }