From 5fff70d156ff70748992913388ded844e7652f13 Mon Sep 17 00:00:00 2001 From: Blomios Date: Thu, 20 Aug 2026 13:22:23 +0200 Subject: [PATCH] =?UTF-8?q?fix(web):=20passe=20le=20nodeId=20r=C3=A9el=20?= =?UTF-8?q?=C3=A0=20la=20custom=20CLI=20au=20lieu=20d'un=20id=20fabriqu?= =?UTF-8?q?=C3=A9=20=E2=80=94=20#225?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../features/agents/CustomAgentChatView.tsx | 31 +++++++++------ .../src/features/web/WebAgentCell.test.tsx | 38 +++++++++++++------ frontend/src/features/web/WebAgentCell.tsx | 2 +- 3 files changed, 46 insertions(+), 25 deletions(-) diff --git a/frontend/src/features/agents/CustomAgentChatView.tsx b/frontend/src/features/agents/CustomAgentChatView.tsx index 2894fcbe..78647140 100644 --- a/frontend/src/features/agents/CustomAgentChatView.tsx +++ b/frontend/src/features/agents/CustomAgentChatView.tsx @@ -44,7 +44,7 @@ export interface CustomAgentChatViewProps { profile: AgentProfile; cwd: string; layoutId?: string; - nodeId: string; + nodeId?: string; sessionId: string | null; conversationId: string | null; composerHeightPx?: number; @@ -125,6 +125,11 @@ function describe(e: unknown): string { return String(e); } +function describeOpenFailure(e: unknown, mobile: boolean): string { + if (!mobile) return describe(e); + return "Le CLI custom n'a pas pu démarrer. Vérifiez la configuration du profil ou utilisez la TUI native."; +} + function instrumentationError(e: unknown): Record { if (e && typeof e === "object") { const err = e as GatewayError & { name?: string }; @@ -803,6 +808,7 @@ export function CustomAgentChatView({ onSessionIdRef.current = onSessionId; const onConversationIdRef = useRef(onConversationId); onConversationIdRef.current = onConversationId; + const domId = nodeId ?? `agent-${agentId}`; const clampComposerHeight = useCallback( (heightPx: number): number => { @@ -891,7 +897,7 @@ export function CustomAgentChatView({ const slashPrefix = slashCommandPrefix(draft); const draftScope = useMemo(() => { if (explicitDraftScope) return explicitDraftScope; - return layoutId ? { projectId, layoutId, nodeId } : null; + return layoutId && nodeId ? { projectId, layoutId, nodeId } : null; }, [explicitDraftScope, layoutId, nodeId, projectId]); const currentConversationCacheKey = useMemo( () => conversationCacheKey(projectId, agentId, conversationId), @@ -1173,7 +1179,7 @@ export function CustomAgentChatView({ options.conversationId === undefined ? conversationId ?? undefined : options.conversationId ?? undefined, - nodeId, + ...(nodeId ? { nodeId } : {}), }; console.debug("[ticket149] recoverStructuredSession:launchAgentChat:start", { timestamp: new Date().toISOString(), @@ -1365,7 +1371,7 @@ export function CustomAgentChatView({ sessionId: externalSessionId, error: instrumentationError(e), }); - if (!cancelled) setError(describe(e)); + if (!cancelled) setError(describeOpenFailure(e, mobile)); } finally { if (!cancelled) setOpening(false); } @@ -1384,6 +1390,7 @@ export function CustomAgentChatView({ applyChatViewState, currentConversationCacheKey, conversationId, + mobile, ]); const canSend = useMemo( @@ -1822,7 +1829,7 @@ export function CustomAgentChatView({

Changer de profil @@ -1979,7 +1986,7 @@ export function CustomAgentChatView({ )} {slashMenuOpen && slashCommands.length > 0 && (