import fs from 'node:fs'; import path from 'node:path'; import { desktopExecutableIdentity } from '../src/core/desktop/app-installation.mjs'; import { samePath } from '../src/core/desktop/file-state.mjs'; export function desktopLaunchCommand(appRoot, args) { const root = fs.realpathSync.native(appRoot), executablePath = desktopExecutableIdentity(root).path; // Packaged Electron loads resources/app itself; only the default Electron // runtime takes the compiled main program as a positional argument. const packaged = samePath(executablePath, path.join(root, 'desktop/AgentWorkbench.exe')); return { executablePath, args: [...(packaged ? [] : [path.join(root, 'dist-desktop/main.cjs')]), ...args] }; }