b8b6b16531
Lands the dynamic Team-memory redesign on top of main's continual-learning pipeline. main already computes loop/activity in the API but its GraphView never rendered them and kept a static-column graph; this swaps in the dynamic graph and surfaces the rails, reusing main's richer PodLearningLoop / PodGraphActivity types. Frontend (new frontend/src/components/graph/*, composed into GraphView.tsx): - forceSim.ts: dependency-free force layout (charge, link springs, centroid recenter, 2-pass collision, bounds clamp, alpha anneal) — no new deps/lockfile churn. - GraphCanvas.tsx: SVG render from the sim — draggable + pinnable nodes, curved edges, weight-sized shapes, fade-in, animated learned_from dash, risk-path lighting / rest dimmed, label collision-avoidance. - MetricsRail / LearningLoop / ActivityStream / SelectedNodePanel / encoding.ts: the mock's rails + stream + detail panel in light shadcn. LearningLoop consumes main's PodLearningLoop (steps + activeStep); ActivityStream consumes PodGraphActivity (title + detail). SelectedNodePanel adds a Flow section that narrates the path through a clicked node (flowNarrative); default copy is mode-aware. Edge legend rounded out (editing/touches). - GraphView polls every 5s and diffs (positions preserved), + ws /api/events nudge. Stale selection (node gone across a poll) dropped so the canvas can't dim entirely. Backend (surgical — main's materializer + buildLoop kept): - live.ts: headline metric cards derived from the FINAL de-noised graph (Open risk paths = distinct collision files; Learned owners = distinct owner engineers) instead of raw collision-signature / accepted-outcome counts that inflate with test churn (50 -> 4 risk files, 16 -> 1 owner on live). buildLoop untouched. - demo.ts: metrics realigned to the demo graph (3 owners / 1 risk path / 100%). Verified: lint + -r typecheck + -r build pass; Playwright confirmed the dynamic graph (ticks on load, draggable), the loop rail (5 steps, ADAPT active) and activity stream rendering main's shapes, honest metrics (3/1/100%), and the flow narrative per node kind — zero page errors. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
64 lines
2.3 KiB
TypeScript
64 lines
2.3 KiB
TypeScript
import type { PodGraphNode } from '@podman/shared';
|
|
import { Badge } from '@/components/ui/badge';
|
|
import { statusColor, modeBlurb, VIOLET, type Mode } from './encoding.js';
|
|
|
|
export function SelectedNodePanel({
|
|
node,
|
|
relCount,
|
|
flow,
|
|
mode,
|
|
}: {
|
|
node: PodGraphNode | undefined;
|
|
relCount: number;
|
|
flow: string;
|
|
mode: Mode;
|
|
}) {
|
|
if (!node) {
|
|
return (
|
|
<div className="flex h-full flex-col">
|
|
<p className="mb-2 text-xs font-medium uppercase tracking-wide text-muted-foreground">
|
|
{mode === 'learn' ? 'Learning edges' : mode === 'all' ? 'Whole graph' : 'Risk path'}
|
|
</p>
|
|
<h3 className="mb-2 font-heading text-base font-medium">What you're looking at</h3>
|
|
<p className="text-sm leading-relaxed text-muted-foreground">{modeBlurb(mode)}</p>
|
|
<p className="mt-3 text-sm leading-relaxed text-muted-foreground">
|
|
Click any node to trace its{' '}
|
|
<span className="font-medium" style={{ color: VIOLET }}>
|
|
flow
|
|
</span>{' '}
|
|
— what PodMan saw, flagged, and learned. Drag to rearrange.
|
|
</p>
|
|
</div>
|
|
);
|
|
}
|
|
return (
|
|
<div className="flex h-full flex-col">
|
|
<p className="text-xs font-medium uppercase tracking-wide text-muted-foreground">
|
|
{node.kind}
|
|
</p>
|
|
<h3 className="mb-2 mt-0.5 font-heading text-lg font-medium">{node.label}</h3>
|
|
<div className="flex items-center justify-between border-b py-1.5 text-sm text-muted-foreground">
|
|
<span>Status</span>
|
|
<Badge variant="outline" style={{ color: statusColor(node.status) }}>
|
|
{node.status}
|
|
</Badge>
|
|
</div>
|
|
<div className="flex items-center justify-between border-b py-1.5 text-sm text-muted-foreground">
|
|
<span>Relationships</span>
|
|
<span className="font-medium text-foreground">{relCount}</span>
|
|
</div>
|
|
{flow && (
|
|
<>
|
|
<p className="mt-2.5 text-[0.7rem] font-medium uppercase tracking-wide text-muted-foreground">
|
|
Flow
|
|
</p>
|
|
<p className="mt-1 text-sm leading-relaxed text-foreground/90">{flow}</p>
|
|
</>
|
|
)}
|
|
{node.summary && node.summary !== flow && (
|
|
<p className="mt-2 text-xs leading-relaxed text-muted-foreground">{node.summary}</p>
|
|
)}
|
|
</div>
|
|
);
|
|
}
|