feat(ui): édition templates — nom d'agent par défaut, permissions système et MCP outils — #242

TemplateEditor/TemplatesPanel étendus aux nouveaux champs, projection
useTemplates/adapters/ports, panneau Agents aligné, templatePresentation.ts
extrait. Tests frontend étendus (templates, agents, routage chat WS).
This commit is contained in:
2026-08-23 11:00:04 +02:00
parent d6c80be56d
commit f952807882
13 changed files with 551 additions and 174 deletions

View File

@ -9,7 +9,7 @@
import { useCallback, useEffect, useState } from "react";
import type { GatewayError, Template } from "@/domain";
import type { CreateTemplateInput } from "@/ports";
import type { CreateTemplateInput, UpdateTemplateInput } from "@/ports";
import { useGateways } from "@/app/di";
/** What the templates UI needs from this hook. */
@ -24,8 +24,8 @@ export interface TemplatesViewModel {
refresh: () => Promise<void>;
/** Creates a new template and refreshes the list. */
createTemplate: (input: CreateTemplateInput) => Promise<void>;
/** Updates the content of an existing template. */
updateTemplate: (templateId: string, content: string) => Promise<void>;
/** Updates an existing template. */
updateTemplate: (templateId: string, input: UpdateTemplateInput) => Promise<void>;
/** Deletes a template by id. */
deleteTemplate: (templateId: string) => Promise<void>;
/** Creates an agent from a template in the given project. */
@ -84,11 +84,11 @@ export function useTemplates(): TemplatesViewModel {
);
const updateTemplate = useCallback(
async (templateId: string, content: string) => {
async (templateId: string, input: UpdateTemplateInput) => {
setBusy(true);
setError(null);
try {
const updated = await template.updateTemplate(templateId, content);
const updated = await template.updateTemplate(templateId, input);
setTemplates((prev) =>
prev.map((t) => (t.id === templateId ? updated : t)),
);