fix(frontend): refresh immédiat de la liste des agents après ajout — bus d'événements agent-roster (CustomEvent + BroadcastChannel multi-fenêtres) publié à la création d'un agent et écouté par useAgents, LayoutGrid et les panneaux skills/permissions/tâches planifiées/templates/tickets/workstate, plus besoin d'ajouter-retirer une cellule pour forcer le refresh — #361 (QA verte: typecheck OK, vitest agents/singletonAgent OK, npm test 1416 tests OK)

This commit is contained in:
2026-09-16 20:14:51 +02:00
parent 3f6beb149b
commit 1cc842fd8b
13 changed files with 169 additions and 0 deletions

View File

@ -16,6 +16,7 @@
import { useCallback, useEffect, useMemo, useState } from "react";
import { useGateways } from "@/app/di";
import { onAgentRosterChanged } from "@/features/agents/agentRosterEvents";
import type { Agent, PluginSkillRef, Skill, SkillRef, SkillScope } from "@/domain";
import { useProjectPlugins } from "@/features/plugins/useProjectPlugins";
import { Button, Input, Panel, Spinner, cn } from "@/shared";
@ -69,6 +70,14 @@ export function SkillsPanel({ projectId }: SkillsPanelProps) {
void loadAgents();
}, [loadAgents]);
useEffect(
() =>
onAgentRosterChanged((change) => {
if (change.projectId === projectId) void loadAgents();
}),
[loadAgents, projectId],
);
const selectedAgent = agents.find((agent) => agent.id === selectedAgentId) ?? null;
const nativeSkills = useMemo(
() => [...vm.projectSkills, ...vm.globalSkills],