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: { copy: {
"dist/index.html": "views/mainview/index.html", "dist/index.html": "views/mainview/index.html",
"dist/assets": "views/mainview/assets", "dist/assets": "views/mainview/assets",
"../sidecar/dist": "sidecar/dist",
}, },
watchIgnore: ["dist/**"], watchIgnore: ["dist/**"],
mac: { mac: {

View file

@ -125,10 +125,12 @@ function resolveRunnerPath(provider: ProviderId): string {
const envRoot = process.env.AGOR_ROOT; const envRoot = process.env.AGOR_ROOT;
if (envRoot) return join(envRoot, "sidecar", "dist", `${provider}-runner.mjs`); 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 = [ 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, "..", "..", ".."), // 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) { for (const root of candidates) {
@ -139,10 +141,10 @@ function resolveRunnerPath(provider: ProviderId): string {
} }
} }
// Fallback: try finding from cwd // Last resort: hardcoded dev path
const cwdPath = join(process.cwd(), "sidecar", "dist", `${provider}-runner.mjs`); const devPath = join(homedir(), "code", "ai", "agent-orchestrator", "sidecar", "dist", `${provider}-runner.mjs`);
dbg(`Trying cwd fallback: ${cwdPath}`); dbg(`Trying hardcoded dev fallback: ${devPath}`);
return cwdPath; return devPath;
} }
function findNodeRuntime(): string { function findNodeRuntime(): string {