refactor: extract agent bounded context + fix SSE comments + cleanup unused

- Extract src/lib/agent/ bounded context with types, registry, messaging
- Add comments_count to BeadIssue for SSE comment detection
- Create batch endpoints for mail/reservations APIs
- Add memory validation to session-preflight
- Remove unused empty dirs (mockup, sessions, timeline)
- Move stashes to docs/references, gitignore them
This commit is contained in:
zenchantlive 2026-03-04 22:06:40 -08:00
parent 6f41c4af31
commit 18fbafdce4
34 changed files with 62714 additions and 1970 deletions

View file

@ -0,0 +1,33 @@
import { NextResponse } from 'next/server';
import { statusAgentReservations } from '../../../../../lib/agent-reservations';
export const dynamic = 'force-dynamic';
export async function GET(request: Request): Promise<Response> {
const { searchParams } = new URL(request.url);
const agentsParam = searchParams.get('agents') ?? '';
if (!agentsParam) {
return NextResponse.json({ ok: true, data: [] }, { status: 200 });
}
const agentNames = agentsParam.split(',').map(a => a.trim()).filter(Boolean);
const results = await Promise.all(
agentNames.map(async (agent) => {
const result = await statusAgentReservations({ agent });
if (!result.ok || !result.data) {
return { agent, scope: undefined, reservations: [] };
}
const reservations = result.data.reservations ?? [];
const first = reservations[0];
return {
agent,
scope: first?.scope as string | undefined,
reservations
};
})
);
return NextResponse.json({ ok: true, data: results }, { status: 200 });
}