/** * Minimal "Settings → AI Profiles" panel (L5). An always-available entry point * to review the configured profiles and re-run the setup wizard after the first * run. Kept intentionally small; richer per-profile editing reuses the wizard. * * Pure presentation over the {@link ProfileGateway} port (no `invoke()`). */ import { useCallback, useEffect, useState } from "react"; import type { AgentProfile, GatewayError } from "@/domain"; import { useGateways } from "@/app/di"; import { Button, Panel } from "@/shared"; import { FirstRunWizard } from "./FirstRunWizard"; export function ProfilesSettings() { const { profile } = useGateways(); const [profiles, setProfiles] = useState([]); const [error, setError] = useState(null); const [editing, setEditing] = useState(false); const refresh = useCallback(async () => { setError(null); try { setProfiles(await profile.listProfiles()); } catch (e) { setError( e && typeof e === "object" && "message" in e ? String((e as GatewayError).message) : String(e), ); } }, [profile]); useEffect(() => { void refresh(); }, [refresh]); async function del(id: string) { await profile.deleteProfile(id); await refresh(); } if (editing) { // Reopened after the first run, so force the wizard to render. return ( { setEditing(false); void refresh(); }} /> ); } return ( setEditing(true)}> Configurer les profils } >
{error && (

{error}

)} {profiles.length === 0 ? (

Aucun profil configuré.

) : (
    {profiles.map((p) => (
  • {p.name} {p.command}
  • ))}
)}
); }