Files
PaperClipAI/ui/src/pages/org-chart/tasks.ts
T
TonioandPaperclip 9dfdeaad86 Refine agent workspaces and organization charts (#20973)
Refine agent details, identity editing, responsive controls, and organization charts with three card tiers, clearer save feedback, and stable filtering.

Guard instruction-file renames and root configuration updates in one transaction through the agent lifecycle integration, preserving conflict checks, rollback, and configuration history.

Co-Authored-By: Paperclip <noreply@paperclip.ing>
2026-11-12 01:23:59 +00:00

18 lines
1.1 KiB
TypeScript

import type { IssueSummary } from "@paperclipai/shared";
import type { LiveRunForIssue } from "../../api/heartbeats";
export interface ChartTask { id: string; title: string; identifier: string | null; agentIds: string[]; ownerId: string }
/** Only actual running executions create associations. No inference from reporting lines. */
export function collectChartTasks(runs: LiveRunForIssue[], summaries: IssueSummary[], agentIds: ReadonlySet<string>): ChartTask[] {
const names = new Map(summaries.map(task => [task.id, task]));
const associations = new Map<string, Set<string>>();
for (const run of runs) {
if (run.status !== "running" || !run.issueId || !agentIds.has(run.agentId)) continue;
const ids = associations.get(run.issueId) ?? new Set<string>();
ids.add(run.agentId); associations.set(run.issueId, ids);
}
return [...associations].sort(([a], [b]) => a.localeCompare(b)).map(([id, agents]) => {
const task = names.get(id), ids = [...agents].sort();
return { id, title: task?.title ?? "Running task", identifier: task?.identifier ?? null, agentIds: ids, ownerId: ids[0] };
});
}