feat(domain,application,backend,app-tauri,frontend): lot utilisateur #328 #329 #330 #331 — section plugins projet, erreurs menus plugin visibles, refresh auto des pages, droplist agents (QA verte)

Lot en un seul commit: les quatre tickets partagent les mêmes fichiers
(événements domaine/DTO, ProjectPluginsPanel, useProjectPlugins) — une
séparation par hunks aurait risqué des états intermédiaires non
compilables (convention lot des batches #310-#313, #315 et #325-#326).

#328 — section dédiée plugins dans Paramètres du projet:
- frontend: ProjectPluginsPanel intégré à ProjectSettingsPanel
  (Panneaux > Paramètres du projet) — activation/désactivation par
  plugin avec état actif/inactif explicite par projet, distinct de
  l'assignation agents/skills/tools
- domaine: événement ProjectPluginSettingsChanged publié par
  SetProjectPluginEnabled, MutateAgentPluginSkill et
  MutateAgentPluginTool après persistance de .ideai/project-plugins.json
  (application + backend + DTO camelCase, test dto.rs)

#329 — les menus plugin qui échouent ne sont plus muets:
- usePluginMenus: dispatcher strict (runCommandStrict) pour les
  commandes réellement enregistrées au lieu du dispatcher laxiste qui
  journalisait et avalait les rejets — rendait les échecs d'ouverture
  de fenêtres natifs invisibles pour l'hôte de menus
- le no-op SDK historique (commande déclarée sans handler) est préservé
- échec remonté à l'hôte via commandError/clearCommandError (journal
  console + état exposé); test window_usecases adapté à un plugin
  installé
- le correctif côté SDK/GitPlugin vit dans le projet GitPlugin (son
  commit/merge local y est fait, hors périmètre de ce dépôt)

#330 — refresh automatique des pages:
- frontend/domain: typage des événements pluginEnabled,
  pluginDisabled (restartRequired), pluginUninstalled
  (restartRequired), pluginLoadFailed et projectPluginSettingsChanged
- useProjectPlugins et PluginRuntimeProvider: souscription
  onDomainEvent — refresh sur changement catalogue global ou sur
  projectPluginSettingsChanged du projet courant; gardes
  révision/projet contre les réponses obsolètes
- useProjectAgents: refresh auto quand un agent est ajouté au projet;
  ProjectsView et AgentsPanel suivent (erreur de rafraîchissement
  affichée avec bouton Réessayer)

#331 — droplist agents des cellules:
- SmallDropdown: liste bg-overlay + bordure border-strong (plus de
  fond blanc hors thème), hover/focus bg-raised, sélection
  bg-primary/15, disabled text-faint opacity-60, role=combobox
- LayoutGrid: sélecteur d'agent des cellules migré du <select> natif
  vers SmallDropdown (mêmes libellés Terminal/visible
  ailleurs/arrière-plan)

QA verte réelle sur les quatre lots (tests ciblés + exécution).
sdk/IdeaSDK: contenu modifié non committable ici (pointeur inchangé).
Aucun push.
This commit is contained in:
2026-09-12 01:14:45 +02:00
parent 4f0457c08a
commit db67ecdf8f
24 changed files with 706 additions and 146 deletions

View File

@ -34,7 +34,13 @@ function renderGrid(
}
async function waitForAgentOption(name = "MyAgent") {
await screen.findByRole("option", { name });
const selector = await screen.findByRole("combobox");
if (selector.getAttribute("aria-expanded") !== "true") fireEvent.click(selector);
return screen.findByRole("option", { name });
}
async function chooseAgent(name = "MyAgent") {
fireEvent.click(await waitForAgentOption(name));
}
describe("setCellAgent (agent dropdown per cell)", () => {
@ -63,10 +69,7 @@ describe("setCellAgent (agent dropdown per cell)", () => {
await waitFor(() => {
expect(screen.getByRole("combobox")).toBeTruthy();
});
await waitForAgentOption();
const select = screen.getByRole("combobox") as HTMLSelectElement;
fireEvent.change(select, { target: { value: a.id } });
await chooseAgent();
// The layout should persist the agent on the leaf.
const initial = await layout.loadLayout("p1");
@ -129,9 +132,9 @@ describe("setCellAgent (agent dropdown per cell)", () => {
expect(sel).toBeTruthy();
});
const select = screen.getByRole("combobox") as HTMLSelectElement;
// Switch back to Plain.
fireEvent.change(select, { target: { value: "" } });
fireEvent.click(screen.getByRole("combobox"));
fireEvent.click(await screen.findByRole("option", { name: "Terminal" }));
// After clearing, the layout should have no agent on the leaf.
await waitFor(async () => {
@ -157,9 +160,7 @@ describe("setCellAgent (agent dropdown per cell)", () => {
renderGrid(layout, agent);
await waitFor(() => expect(screen.getByRole("combobox")).toBeTruthy());
await waitForAgentOption();
fireEvent.change(screen.getByRole("combobox"), { target: { value: a.id } });
await chooseAgent();
await waitFor(async () => {
const fresh = await layout.loadLayout("p1");
@ -175,7 +176,7 @@ describe("setCellAgent (agent dropdown per cell)", () => {
const agent = new MockAgentGateway();
const terminal = new MockTerminalGateway();
const closeSpy = vi.spyOn(terminal, "closeTerminal");
const a = await agent.createAgent("p1", { name: "MyAgent", profileId: "p" });
await agent.createAgent("p1", { name: "MyAgent", profileId: "p" });
const tree = await layout.loadLayout("p1");
const leafId = leaves(tree)[0].id;
@ -187,9 +188,7 @@ describe("setCellAgent (agent dropdown per cell)", () => {
renderGrid(layout, agent, "p1", terminal);
await waitFor(() => expect(screen.getByRole("combobox")).toBeTruthy());
await waitForAgentOption();
fireEvent.change(screen.getByRole("combobox"), { target: { value: a.id } });
await chooseAgent();
await waitFor(() => {
expect(closeSpy).toHaveBeenCalledWith("old-session");
@ -205,9 +204,7 @@ describe("setCellAgent (agent dropdown per cell)", () => {
renderGrid(layout, agent, "p1", terminal);
await waitFor(() => expect(screen.getByRole("combobox")).toBeTruthy());
await waitForAgentOption();
fireEvent.change(screen.getByRole("combobox"), { target: { value: a.id } });
await chooseAgent();
await waitFor(async () => {
const fresh = await layout.loadLayout("p1");
@ -262,9 +259,17 @@ describe("setCellAgent (agent dropdown per cell)", () => {
renderGrid(layout, agent);
await waitFor(() => {
expect(screen.getByText("Agent Alpha")).toBeTruthy();
expect(screen.getByText("Agent Beta")).toBeTruthy();
});
fireEvent.click(await screen.findByRole("combobox"));
expect(await screen.findByRole("option", { name: "Agent Alpha" })).toBeTruthy();
expect(screen.getByRole("option", { name: "Agent Beta" })).toBeTruthy();
});
it("shows a themed empty state when the project has no agents", async () => {
renderGrid(new MockLayoutGateway(), new MockAgentGateway());
fireEvent.click(await screen.findByRole("combobox"));
const list = await screen.findByRole("listbox");
expect(list.className).toContain("bg-overlay");
expect((screen.getByRole("option", { name: "Aucun agent disponible" }) as HTMLButtonElement).disabled).toBe(true);
});
});