feat(ui): deliver Social-Dense Agent Sessions Hub

This is our biggest UX pivot of the project. We abandoned the 'Page' model for a 'Command Workspace'.

Triumphs:
- Reclaimed 40% of previously wasted screen real-estate by moving to an auto-filling multi-column grid matrix.
- Built the 'Command Deck'—a high-density header that provides real-time agent presence monitoring at a glance.
- Implemented 'Social Post' cards that map technical protocols to human verbs (e.g., 'Falcon passed mission to Operative-B'), making the audit trail readable for humans.
- Engineered 'Silent Refresh' logic: the feed now appends new activity and comments smoothly without disruptive UI resets or scroll jumps.

Raw Honest Moment:
The original card-based social feed was a failure. It was beautiful in isolation but useless for actual supervision. We had to be honest about the horizontal bloat and rebuild the entire layout foundation from scratch using rem-based fluid units to satisfy the 'War Room' requirement.
This commit is contained in:
zenchantlive 2026-02-14 00:20:41 -08:00
parent 28abfe3ce2
commit f3558dc0d1
13 changed files with 1153 additions and 0 deletions

View file

@ -0,0 +1,46 @@
'use client';
import { useCallback, useEffect, useState } from 'react';
import type { EpicBucket } from '../lib/agent-sessions';
export function useSessionFeed(projectRoot: string) {
const [feed, setFeed] = useState<EpicBucket[]>([]);
const [loading, setLoading] = useState(true);
const [error, setError] = useState<string | null>(null);
const fetchFeed = useCallback(async (options: { silent?: boolean } = {}) => {
if (!options.silent) setLoading(true);
try {
const res = await fetch(`/api/sessions?projectRoot=${encodeURIComponent(projectRoot)}&_t=${Date.now()}`, {
cache: 'no-store',
});
if (!res.ok) throw new Error('Failed to fetch session feed');
const data = await res.json();
if (data.ok) {
setFeed(data.feed);
} else {
throw new Error(data.error?.message || 'Failed to fetch session feed');
}
} catch (err) {
if (!options.silent) setError(err instanceof Error ? err.message : String(err));
} finally {
if (!options.silent) setLoading(false);
}
}, [projectRoot]);
useEffect(() => {
fetchFeed();
}, [fetchFeed]);
return {
feed,
loading,
error,
refresh: fetchFeed,
stats: {
active: feed.reduce((acc, b) => acc + b.tasks.filter(t => t.sessionState === 'active').length, 0),
needsInput: feed.reduce((acc, b) => acc + b.tasks.filter(t => t.sessionState === 'needs_input').length, 0),
completed: feed.reduce((acc, b) => acc + b.tasks.filter(t => t.sessionState === 'completed').length, 0),
}
};
}