fix(electrobun): copy sidecar/dist into build output + fix runner path resolution

This commit is contained in:
Hibryda 2026-03-26 02:06:39 +01:00
parent 541b6eda46
commit a1a5467ef9
2 changed files with 9 additions and 6 deletions

View file

@ -31,6 +31,7 @@ export default {
copy: {
"dist/index.html": "views/mainview/index.html",
"dist/assets": "views/mainview/assets",
"../sidecar/dist": "sidecar/dist",
},
watchIgnore: ["dist/**"],
mac: {

View file

@ -125,10 +125,12 @@ function resolveRunnerPath(provider: ProviderId): string {
const envRoot = process.env.AGOR_ROOT;
if (envRoot) return join(envRoot, "sidecar", "dist", `${provider}-runner.mjs`);
// Try multiple candidate roots (dev build output vs source tree)
// Try multiple candidate roots
const candidates = [
join(import.meta.dir, ".."), // build: bin/ → AppRoot/ (sidecar/dist copied here)
join(import.meta.dir, "..", "..", ".."), // source: src/bun/ → repo root
join(import.meta.dir, "..", "..", "..", "..", "..", ".."), // build: build/dev-linux-x64/App/... → repo root
join(import.meta.dir, "..", "..", "..", "..", "..", ".."), // deep build: → repo root
process.cwd(), // cwd fallback
];
for (const root of candidates) {
@ -139,10 +141,10 @@ function resolveRunnerPath(provider: ProviderId): string {
}
}
// Fallback: try finding from cwd
const cwdPath = join(process.cwd(), "sidecar", "dist", `${provider}-runner.mjs`);
dbg(`Trying cwd fallback: ${cwdPath}`);
return cwdPath;
// Last resort: hardcoded dev path
const devPath = join(homedir(), "code", "ai", "agent-orchestrator", "sidecar", "dist", `${provider}-runner.mjs`);
dbg(`Trying hardcoded dev fallback: ${devPath}`);
return devPath;
}
function findNodeRuntime(): string {