fix: orchestrator button + Pi SDK session error

- Move leftSidebarMode from URL state to local useState in unified-shell,
    avoiding force-dynamic router round-trip that made the button appear broken                                           - Replace fileURLToPath(new URL(..., import.meta.url)) with process.cwd()
    in bb-pi-bootstrap.ts — import.meta.url is a webpack:// URL in Next.js,
    causing cross-realm TypeError when passed to Node.js fileURLToPath()
This commit is contained in:
zenchantlive 2026-03-24 15:39:19 -07:00
parent 643fa299dd
commit d335e5bf71
98 changed files with 17851 additions and 944 deletions

View file

@ -0,0 +1,24 @@
import { NextResponse } from 'next/server';
import { bbDaemon } from '../../../../lib/bb-daemon';
export const dynamic = 'force-dynamic';
export async function POST(request: Request): Promise<Response> {
try {
const body = await request.json();
const projectRoot = typeof body?.projectRoot === 'string' ? body.projectRoot.trim() : '';
if (!projectRoot) {
return NextResponse.json({ ok: false, error: 'projectRoot is required' }, { status: 400 });
}
const lifecycle = await bbDaemon.ensureRunning();
const orchestrator = await bbDaemon.ensureOrchestrator(projectRoot);
return NextResponse.json({ ok: true, lifecycle, data: orchestrator });
} catch (error) {
return NextResponse.json(
{ ok: false, error: error instanceof Error ? error.message : 'Invalid request' },
{ status: 400 },
);
}
}