feat(protocol): wire session aggregation and API with liveness

Finalizing the backend engine for the Operative Protocol.
- Updated agent-sessions.ts to use the deriveLiveness logic and the 15m protocol threshold.
- Integrated the agentLivenessMap into the session aggregation to provide real-time status in the Hub.
- Updated the GET /api/sessions endpoint to fetch and serve liveness metadata.
- Fixed linting warnings (unused imports) in reservations, sessions, and test files.

This commit completes the backend contract for bb-u6f.6.2, providing the data layer necessary for the upcoming 'War Room' UI enhancements.

OPERATIVE: silver-castle
SESSION: 2026-02-14-1145
This commit is contained in:
zenchantlive 2026-02-14 10:43:02 -08:00
parent 41f7cb8f24
commit 965d11c0b9
7 changed files with 48 additions and 15 deletions

View file

@ -1,7 +1,7 @@
import { NextResponse } from 'next/server';
import { readIssuesFromDisk } from '../../../lib/read-issues';
import { activityEventBus } from '../../../lib/realtime';
import { buildSessionTaskFeed, getCommunicationSummary } from '../../../lib/agent-sessions';
import { buildSessionTaskFeed, getCommunicationSummary, getAgentLivenessMap } from '../../../lib/agent-sessions';
export const dynamic = 'force-dynamic';
@ -13,8 +13,9 @@ export async function GET(request: Request): Promise<Response> {
const issues = await readIssuesFromDisk({ projectRoot, preferBd: true });
const activity = activityEventBus.getHistory(projectRoot);
const communication = await getCommunicationSummary();
const livenessMap = await getAgentLivenessMap();
const feed = buildSessionTaskFeed(issues, activity, communication);
const feed = buildSessionTaskFeed(issues, activity, communication, livenessMap);
return NextResponse.json({ ok: true, feed });
} catch (error) {